mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 6797040a2034 (bug 1089619) for breaking non-unified b2g builds
This commit is contained in:
parent
01aa56dc05
commit
6801a38500
@ -32,7 +32,6 @@
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "prtime.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "nsIIccInfo.h"
|
||||
@ -401,21 +400,9 @@ GonkGPSGeolocationProvider::RequestSettingValue(const char* aKey)
|
||||
MOZ_ASSERT(ss);
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
rv = lock->Get(aKey, this);
|
||||
if (NS_FAILED(rv)) {
|
||||
nsContentUtils::LogMessageToConsole(
|
||||
"geo: error while get setting '%s': %d\n", aKey, rv);
|
||||
return;
|
||||
}
|
||||
ss->CreateLock(nullptr, getter_AddRefs(lock));
|
||||
lock->Get(aKey, this);
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
@ -827,10 +814,6 @@ GonkGPSGeolocationProvider::Startup()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mStarted) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RequestSettingValue(kSettingDebugEnabled);
|
||||
RequestSettingValue(kSettingDebugGpsIgnored);
|
||||
|
||||
@ -843,6 +826,10 @@ GonkGPSGeolocationProvider::Startup()
|
||||
}
|
||||
}
|
||||
|
||||
if (mStarted) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!mInitThread) {
|
||||
nsresult rv = NS_NewThread(getter_AddRefs(mInitThread));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -881,7 +868,6 @@ GonkGPSGeolocationProvider::Shutdown()
|
||||
if (!mStarted) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mStarted = false;
|
||||
if (mNetworkLocationProvider) {
|
||||
mNetworkLocationProvider->Shutdown();
|
||||
@ -890,17 +876,10 @@ GonkGPSGeolocationProvider::Shutdown()
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
if (obs) {
|
||||
nsresult rv;
|
||||
#ifdef MOZ_B2G_RIL
|
||||
rv = obs->RemoveObserver(this, kNetworkConnStateChangedTopic);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("geo: Gonk GPS network state RemoveObserver failed");
|
||||
}
|
||||
obs->RemoveObserver(this, kNetworkConnStateChangedTopic);
|
||||
#endif
|
||||
rv = obs->RemoveObserver(this, kMozSettingsChangedTopic);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("geo: Gonk GPS mozsettings RemoveObserver failed");
|
||||
}
|
||||
obs->RemoveObserver(this, kMozSettingsChangedTopic);
|
||||
}
|
||||
|
||||
mInitThread->Dispatch(NS_NewRunnableMethod(this, &GonkGPSGeolocationProvider::ShutdownGPS),
|
||||
@ -1012,30 +991,8 @@ GonkGPSGeolocationProvider::Observe(nsISupports* aSubject,
|
||||
#endif
|
||||
|
||||
if (!strcmp(aTopic, kMozSettingsChangedTopic)) {
|
||||
// Read changed setting value
|
||||
AutoJSAPI jsapi;
|
||||
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;
|
||||
}
|
||||
RequestSettingValue(kSettingDebugEnabled);
|
||||
RequestSettingValue(kSettingDebugGpsIgnored);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -1063,8 +1020,18 @@ GonkGPSGeolocationProvider::Handle(const nsAString& aName,
|
||||
SetAGpsDataConn(apn);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
#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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user