Bug 1344347 - Construct the AndroidBridge in child (sibling) processes r=jchen draft
authorJames Willcox <snorp@snorp.net>
Fri, 03 Mar 2017 15:19:48 -0600
changeset 552487 711bc8753ef688cff14d3f73c370d445382e8067
parent 552486 6d7f2f66e1ce68a3cb3ab15579caf1f66dda6875
child 552488 b431c1c452a3613d85c17000ecb16cd6f324e97b
push id51353
push userbmo:snorp@snorp.net
push dateTue, 28 Mar 2017 13:31:07 +0000
reviewersjchen
bugs1344347
milestone55.0a1
Bug 1344347 - Construct the AndroidBridge in child (sibling) processes r=jchen MozReview-Commit-ID: 6ifSkMbxfuO
widget/android/nsAppShell.cpp
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -380,26 +380,18 @@ nsAppShell::nsAppShell()
                        "nsAppShell.SyncRun")
     , mSyncRunQuit(false)
 {
     {
         MutexAutoLock lock(*sAppShellLock);
         sAppShell = this;
     }
 
-    if (!XRE_IsParentProcess()) {
-        if (jni::IsAvailable()) {
-            // Set the corresponding state in GeckoThread.
-            java::GeckoThread::SetState(java::GeckoThread::State::RUNNING());
-        }
-        return;
-    }
-
     if (jni::IsAvailable()) {
-        // Initialize JNI.
+        // Initialize JNI and Set the corresponding state in GeckoThread
         AndroidBridge::ConstructBridge();
         GeckoAppShellSupport::Init();
         GeckoThreadSupport::Init();
         mozilla::GeckoBatteryManager::Init();
         mozilla::GeckoNetworkManager::Init();
         mozilla::GeckoProcessManager::Init();
         mozilla::GeckoScreenOrientation::Init();
         mozilla::PrefsHelper::Init();
@@ -407,25 +399,25 @@ nsAppShell::nsAppShell()
 
         if (jni::IsFennec()) {
             mozilla::ANRReporter::Init();
             mozilla::MemoryMonitor::Init();
             mozilla::widget::Telemetry::Init();
             mozilla::ThumbnailHelper::Init();
         }
 
+        if (XRE_IsParentProcess()) {
+            java::GeckoThread::SetState(java::GeckoThread::State::JNI_READY());
+        }
+
         CreateAndroidUiThread();
     }
 
-    if (jni::IsAvailable()) {
-        // Set the corresponding state in GeckoThread.
-        java::GeckoThread::SetState(java::GeckoThread::State::JNI_READY());
-    }
-
     if (!XRE_IsParentProcess()) {
+        java::GeckoThread::SetState(java::GeckoThread::State::RUNNING());
         return;
     }
 
     sPowerManagerService = do_GetService(POWERMANAGERSERVICE_CONTRACTID);
 
     if (sPowerManagerService) {
         sWakeLockListener = new WakeLockListener();
     } else {