Bug 1080017 - Don't send Geolocation messages during shutdown. r=jdm
authorFelipe César <felipe.cesar00@gmail.com>
Mon, 13 Oct 2014 17:28:00 -0400
changeset 210314 0dcb210f36bc1dc0baedbe671eea00445b9b1f4d
parent 210313 16706b686cecf4456286765d1719998df7f05676
child 210315 80e3b53870488d5c8a8bfc52f347806c8efa6830
push id50400
push userryanvm@gmail.com
push dateTue, 14 Oct 2014 14:31:24 +0000
treeherdermozilla-inbound@80e3b5387048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1080017
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1080017 - Don't send Geolocation messages during shutdown. r=jdm
dom/geolocation/nsGeolocation.cpp
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
--- a/dom/geolocation/nsGeolocation.cpp
+++ b/dom/geolocation/nsGeolocation.cpp
@@ -913,17 +913,19 @@ nsGeolocationService::HighAccuracyReques
 
 void
 nsGeolocationService::UpdateAccuracy(bool aForceHigh)
 {
   bool highRequired = aForceHigh || HighAccuracyRequested();
 
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     ContentChild* cpc = ContentChild::GetSingleton();
-    cpc->SendSetGeolocationHigherAccuracy(highRequired);
+    if (cpc->IsAlive()) {
+      cpc->SendSetGeolocationHigherAccuracy(highRequired);
+    }
     return;
   }
 
   if (!mHigherAccuracy && highRequired) {
       mProvider->SetHighAccuracy(true);
   }
 
   if (mHigherAccuracy && !highRequired) {
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -525,16 +525,17 @@ ReinitTaskTracer(void* /*aUnused*/)
 #endif
 
 ContentChild::ContentChild()
  : mID(uint64_t(-1))
 #ifdef ANDROID
    ,mScreenSize(0, 0)
 #endif
    , mCanOverrideProcessName(true)
+   , mIsAlive(true)
 {
     // This process is a content process, so it's clearly running in
     // multiprocess mode!
     nsDebugImpl::SetMultiprocessMode("Child");
 }
 
 ContentChild::~ContentChild()
 {
@@ -663,16 +664,22 @@ ContentChild::SetProcessName(const nsASt
 }
 
 void
 ContentChild::GetProcessName(nsAString& aName)
 {
     aName.Assign(mProcessName);
 }
 
+bool
+ContentChild::IsAlive()
+{
+    return mIsAlive;
+}
+
 void
 ContentChild::GetProcessName(nsACString& aName)
 {
     aName.Assign(NS_ConvertUTF16toUTF8(mProcessName));
 }
 
 /* static */ void
 ContentChild::AppendProcessId(nsACString& aName)
@@ -1635,16 +1642,17 @@ ContentChild::ActorDestroy(ActorDestroyR
 
     mIdleObservers.Clear();
 
     nsCOMPtr<nsIConsoleService> svc(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
     if (svc) {
         svc->UnregisterListener(mConsoleListener);
         mConsoleListener->mChild = nullptr;
     }
+    mIsAlive = false;
 
     XRE_ShutdownChildProcess();
 }
 
 void
 ContentChild::ProcessingError(Result what)
 {
     switch (what) {
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -82,20 +82,20 @@ public:
 
     static ContentChild* GetSingleton() {
         return sSingleton;
     }
 
     const AppInfo& GetAppInfo() {
         return mAppInfo;
     }
-
     void SetProcessName(const nsAString& aName, bool aDontOverride = false);
     void GetProcessName(nsAString& aName);
     void GetProcessName(nsACString& aName);
+    bool IsAlive();
     static void AppendProcessId(nsACString& aName);
 
     ContentBridgeParent* GetLastBridge() {
         MOZ_ASSERT(mLastBridge);
         ContentBridgeParent* parent = mLastBridge;
         mLastBridge = nullptr;
         return parent;
     }
@@ -416,16 +416,17 @@ private:
 
 #ifdef ANDROID
     gfxIntSize mScreenSize;
 #endif
 
     bool mIsForApp;
     bool mIsForBrowser;
     bool mCanOverrideProcessName;
+    bool mIsAlive;
     nsString mProcessName;
 
     static ContentChild* sSingleton;
 
     DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
 };
 
 } // namespace dom