[tbb-commits] [tor-browser/tor-browser-38.5.0esr-5.0-2] Bug 17931: Update GonkGPSGeolocationProvider.cpp to use B2G-style logging

gk at torproject.org gk at torproject.org
Tue Jan 5 16:25:21 UTC 2016


commit 8e50016a5c562efe0b395ea75a889d4d3528fc9b
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Mon Jan 4 09:46:17 2016 -0800

    Bug 17931: Update GonkGPSGeolocationProvider.cpp to use B2G-style logging
---
 dom/system/gonk/GonkGPSGeolocationProvider.cpp |   32 ++++++++++++------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/dom/system/gonk/GonkGPSGeolocationProvider.cpp b/dom/system/gonk/GonkGPSGeolocationProvider.cpp
index e5a63db..3cf657f 100644
--- a/dom/system/gonk/GonkGPSGeolocationProvider.cpp
+++ b/dom/system/gonk/GonkGPSGeolocationProvider.cpp
@@ -51,6 +51,13 @@
 
 #define FLUSH_AIDE_DATA 0
 
+#undef LOG
+#undef ERR
+#undef DBG
+#define LOG(args...)  __android_log_print(ANDROID_LOG_INFO,  "GonkGPSGeolocationProvider", ## args)
+#define ERR(args...)  __android_log_print(ANDROID_LOG_ERROR, "GonkGPSGeolocationProvider", ## args)
+#define DBG(args...)  __android_log_print(ANDROID_LOG_DEBUG, "GonkGPSGeolocationProvider" , ## args)
+
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -145,8 +152,7 @@ void
 GonkGPSGeolocationProvider::NmeaCallback(GpsUtcTime timestamp, const char* nmea, int length)
 {
   if (gDebug_isLoggingEnabled) {
-    nsContentUtils::LogMessageToConsole("geo: NMEA: timestamp:\t%lld, length: %d, %s",
-                                        timestamp, length, nmea);
+    DBG("NMEA: timestamp:\t%lld, length: %d, %s", timestamp, length, nmea);
   }
 }
 
@@ -420,15 +426,13 @@ GonkGPSGeolocationProvider::RequestSettingValue(const char* aKey)
   nsCOMPtr<nsISettingsServiceLock> lock;
   nsresult rv = ss->CreateLock(nullptr, getter_AddRefs(lock));
   if (NS_FAILED(rv)) {
-    nsContentUtils::LogMessageToConsole(
-      "geo: error while createLock setting '%s': %d\n", aKey, rv);
+    ERR("error while createLock setting '%s': %d\n", aKey, rv);
     return;
   }
 
   rv = lock->Get(aKey, this);
   if (NS_FAILED(rv)) {
-    nsContentUtils::LogMessageToConsole(
-      "geo: error while get setting '%s': %d\n", aKey, rv);
+    ERR("error while get setting '%s': %d\n", aKey, rv);
     return;
   }
 }
@@ -599,8 +603,7 @@ GonkGPSGeolocationProvider::InjectLocation(double latitude,
                                            float accuracy)
 {
   if (gDebug_isLoggingEnabled) {
-    nsContentUtils::LogMessageToConsole("geo: injecting location (%f, %f) accuracy: %f",
-                                        latitude, longitude, accuracy);
+    DBG("injecting location (%f, %f) accuracy: %f", latitude, longitude, accuracy);
   }
 
   MOZ_ASSERT(NS_IsMainThread());
@@ -818,14 +821,12 @@ GonkGPSGeolocationProvider::NetworkLocationUpdate::Update(nsIDOMGeoPosition *pos
        (isGPSTempInactive && delta > kMinMLSCoordChangeInMeters))
     {
       if (gDebug_isLoggingEnabled) {
-        nsContentUtils::LogMessageToConsole("geo: Using MLS, GPS age:%fs, MLS Delta:%fm\n",
-                                            diff_ms / 1000.0, delta);
+        DBG("Using MLS, GPS age:%fs, MLS Delta:%fm\n", diff_ms / 1000.0, delta);
       }
       provider->mLocationCallback->Update(position);
     } else if (provider->mLastGPSPosition) {
       if (gDebug_isLoggingEnabled) {
-        nsContentUtils::LogMessageToConsole("geo: Using old GPS age:%fs\n",
-                                            diff_ms / 1000.0);
+        DBG("Using old GPS age:%fs\n", diff_ms / 1000.0);
       }
 
       // This is a fallback case so that the GPS provider responds with its last
@@ -1058,16 +1059,15 @@ GonkGPSGeolocationProvider::Observe(nsISupports* aSubject,
     }
 
     if (setting.mKey.EqualsASCII(kSettingDebugGpsIgnored)) {
-      nsContentUtils::LogMessageToConsole("geo: received mozsettings-changed: ignoring\n");
+      LOG("received mozsettings-changed: ignoring\n");
       gDebug_isGPSLocationIgnored =
         setting.mValue.isBoolean() ? setting.mValue.toBoolean() : false;
       if (gDebug_isLoggingEnabled) {
-        nsContentUtils::LogMessageToConsole("geo: Debug: GPS ignored %d\n",
-                                            gDebug_isGPSLocationIgnored);
+        DBG("GPS ignored %d\n", gDebug_isGPSLocationIgnored);
       }
       return NS_OK;
     } else if (setting.mKey.EqualsASCII(kSettingDebugEnabled)) {
-      nsContentUtils::LogMessageToConsole("geo: received mozsettings-changed: logging\n");
+      LOG("received mozsettings-changed: logging\n");
       gDebug_isLoggingEnabled =
         setting.mValue.isBoolean() ? setting.mValue.toBoolean() : false;
       return NS_OK;





More information about the tbb-commits mailing list