зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1237831 - Update GonkGPSGeolocationProvider.cpp to use B2G-style. r=jst
From 735d634f21a9e9317dd90c24806f42eb11e999d0 Mon Sep 17 00:00:00 2001 logging --- dom/system/gonk/GonkGPSGeolocationProvider.cpp | 48 +++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) --HG-- extra : rebase_source : d25154abc42023833226a60ea167523326d52aa5
This commit is contained in:
Родитель
97001c7196
Коммит
14644ccf2b
|
@ -56,6 +56,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;
|
||||
|
||||
|
@ -139,10 +146,10 @@ GonkGPSGeolocationProvider::LocationCallback(GpsLocation* location)
|
|||
// set in the DOM JS.
|
||||
|
||||
if (gDebug_isLoggingEnabled) {
|
||||
nsContentUtils::LogMessageToConsole("geo: GPS got a fix (%f, %f). accuracy: %f",
|
||||
location->latitude,
|
||||
location->longitude,
|
||||
location->accuracy);
|
||||
DBG("geo: GPS got a fix (%f, %f). accuracy: %f",
|
||||
location->latitude,
|
||||
location->longitude,
|
||||
location->accuracy);
|
||||
}
|
||||
|
||||
RefPtr<UpdateLocationEvent> event = new UpdateLocationEvent(somewhere);
|
||||
|
@ -199,7 +206,7 @@ GonkGPSGeolocationProvider::StatusCallback(GpsStatus* status)
|
|||
break;
|
||||
}
|
||||
if (gDebug_isLoggingEnabled){
|
||||
nsContentUtils::LogMessageToConsole(msgStream);
|
||||
DBG("%s", msgStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +247,7 @@ GonkGPSGeolocationProvider::SvStatusCallback(GpsSvStatus* sv_info)
|
|||
svEphemerisCount != numEphemeris ||
|
||||
svUsedCount != numUsedInFix) {
|
||||
|
||||
nsContentUtils::LogMessageToConsole(
|
||||
LOG(
|
||||
"geo: Number of SVs have (visibility, almanac, ephemeris): (%d, %d, %d)."
|
||||
" %d of these SVs were used in fix.\n",
|
||||
sv_info->num_svs, svAlmanacCount, svEphemerisCount, svUsedCount);
|
||||
|
@ -257,8 +264,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -532,15 +538,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;
|
||||
}
|
||||
}
|
||||
|
@ -639,8 +643,8 @@ ConvertToGpsRefLocationType(const nsAString& aConnectionType)
|
|||
}
|
||||
|
||||
if (gDebug_isLoggingEnabled) {
|
||||
nsContentUtils::LogMessageToConsole("geo: Unsupported connection type %s\n",
|
||||
NS_ConvertUTF16toUTF8(aConnectionType).get());
|
||||
DBG("geo: Unsupported connection type %s\n",
|
||||
NS_ConvertUTF16toUTF8(aConnectionType).get());
|
||||
}
|
||||
return AGPS_REF_LOCATION_TYPE_GSM_CELLID;
|
||||
}
|
||||
|
@ -744,8 +748,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());
|
||||
|
@ -947,14 +950,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
|
||||
|
@ -1185,16 +1186,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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче