Bug 1344347 - Construct the AndroidBridge in child (sibling) processes r=jchen
MozReview-Commit-ID: 6ifSkMbxfuO
--- 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 {