Backed out changeset 6797040a2034 (bug 1089619) for breaking non-unified b2g builds

This commit is contained in:
Carsten "Tomcat" Book 2014-10-30 13:46:09 +01:00
Родитель b840ddbb12
Коммит 0622bea387
1 изменённых файлов: 21 добавлений и 54 удалений

Просмотреть файл

@ -32,7 +32,6 @@
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "prtime.h" #include "prtime.h"
#include "mozilla/dom/SettingChangeNotificationBinding.h"
#ifdef MOZ_B2G_RIL #ifdef MOZ_B2G_RIL
#include "nsIIccInfo.h" #include "nsIIccInfo.h"
@ -401,21 +400,9 @@ GonkGPSGeolocationProvider::RequestSettingValue(const char* aKey)
MOZ_ASSERT(ss); MOZ_ASSERT(ss);
return; return;
} }
nsCOMPtr<nsISettingsServiceLock> lock; nsCOMPtr<nsISettingsServiceLock> lock;
nsresult rv = ss->CreateLock(nullptr, getter_AddRefs(lock)); ss->CreateLock(nullptr, getter_AddRefs(lock));
if (NS_FAILED(rv)) { lock->Get(aKey, this);
nsContentUtils::LogMessageToConsole(
"geo: 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);
return;
}
} }
#ifdef MOZ_B2G_RIL #ifdef MOZ_B2G_RIL
@ -827,10 +814,6 @@ GonkGPSGeolocationProvider::Startup()
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
if (mStarted) {
return NS_OK;
}
RequestSettingValue(kSettingDebugEnabled); RequestSettingValue(kSettingDebugEnabled);
RequestSettingValue(kSettingDebugGpsIgnored); RequestSettingValue(kSettingDebugGpsIgnored);
@ -843,6 +826,10 @@ GonkGPSGeolocationProvider::Startup()
} }
} }
if (mStarted) {
return NS_OK;
}
if (!mInitThread) { if (!mInitThread) {
nsresult rv = NS_NewThread(getter_AddRefs(mInitThread)); nsresult rv = NS_NewThread(getter_AddRefs(mInitThread));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -881,7 +868,6 @@ GonkGPSGeolocationProvider::Shutdown()
if (!mStarted) { if (!mStarted) {
return NS_OK; return NS_OK;
} }
mStarted = false; mStarted = false;
if (mNetworkLocationProvider) { if (mNetworkLocationProvider) {
mNetworkLocationProvider->Shutdown(); mNetworkLocationProvider->Shutdown();
@ -890,17 +876,10 @@ GonkGPSGeolocationProvider::Shutdown()
nsCOMPtr<nsIObserverService> obs = services::GetObserverService(); nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (obs) { if (obs) {
nsresult rv;
#ifdef MOZ_B2G_RIL #ifdef MOZ_B2G_RIL
rv = obs->RemoveObserver(this, kNetworkConnStateChangedTopic); obs->RemoveObserver(this, kNetworkConnStateChangedTopic);
if (NS_FAILED(rv)) {
NS_WARNING("geo: Gonk GPS network state RemoveObserver failed");
}
#endif #endif
rv = obs->RemoveObserver(this, kMozSettingsChangedTopic); obs->RemoveObserver(this, kMozSettingsChangedTopic);
if (NS_FAILED(rv)) {
NS_WARNING("geo: Gonk GPS mozsettings RemoveObserver failed");
}
} }
mInitThread->Dispatch(NS_NewRunnableMethod(this, &GonkGPSGeolocationProvider::ShutdownGPS), mInitThread->Dispatch(NS_NewRunnableMethod(this, &GonkGPSGeolocationProvider::ShutdownGPS),
@ -1012,30 +991,8 @@ GonkGPSGeolocationProvider::Observe(nsISupports* aSubject,
#endif #endif
if (!strcmp(aTopic, kMozSettingsChangedTopic)) { if (!strcmp(aTopic, kMozSettingsChangedTopic)) {
// Read changed setting value RequestSettingValue(kSettingDebugEnabled);
AutoJSAPI jsapi; RequestSettingValue(kSettingDebugGpsIgnored);
jsapi.Init();
JSContext* cx = jsapi.cx();
RootedDictionary<SettingChangeNotification> setting(cx);
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
return NS_OK;
}
if (setting.mKey.EqualsASCII(kSettingDebugGpsIgnored)) {
nsContentUtils::LogMessageToConsole("geo: 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);
}
return NS_OK;
} else if (setting.mKey.EqualsASCII(kSettingDebugEnabled)) {
nsContentUtils::LogMessageToConsole("geo: received mozsettings-changed: logging\n");
gDebug_isLoggingEnabled =
setting.mValue.isBoolean() ? setting.mValue.toBoolean() : false;
return NS_OK;
}
} }
return NS_OK; return NS_OK;
@ -1063,8 +1020,18 @@ GonkGPSGeolocationProvider::Handle(const nsAString& aName,
SetAGpsDataConn(apn); SetAGpsDataConn(apn);
} }
} }
} } else
#endif // MOZ_B2G_RIL #endif // MOZ_B2G_RIL
if (aName.EqualsASCII(kSettingDebugGpsIgnored)) {
gDebug_isGPSLocationIgnored = aResult.isBoolean() ? aResult.toBoolean() : false;
if (gDebug_isLoggingEnabled) {
nsContentUtils::LogMessageToConsole("geo: Debug: GPS ignored %d\n", gDebug_isGPSLocationIgnored);
}
return NS_OK;
} else if (aName.EqualsASCII(kSettingDebugEnabled)) {
gDebug_isLoggingEnabled = aResult.isBoolean() ? aResult.toBoolean() : false;
return NS_OK;
}
return NS_OK; return NS_OK;
} }