Bug 1305271 - 2. Add and use jni::IsFennec() for Fennec-only code; r=snorp

Add jni::IsFennec() that returns whether we're in a Fennec environment
(defined as the presence of the GeckoApp class). Then, add
jni::IsFennec() checks to places where we use JNI for Fennec-only classes.
This commit is contained in:
Jim Chen
2016-09-28 23:49:25 -04:00
parent 6fa85ecba2
commit 31d505d8ba
12 changed files with 52 additions and 15 deletions

View File

@@ -374,16 +374,19 @@ nsAppShell::nsAppShell()
AndroidBridge::ConstructBridge();
GeckoAppShellSupport::Init();
GeckoThreadSupport::Init();
mozilla::ANRReporter::Init();
mozilla::GeckoBatteryManager::Init();
mozilla::GeckoNetworkManager::Init();
mozilla::GeckoScreenOrientation::Init();
mozilla::MemoryMonitor::Init();
mozilla::PrefsHelper::Init();
mozilla::widget::Telemetry::Init();
mozilla::ThumbnailHelper::Init();
nsWindow::InitNatives();
if (jni::IsFennec()) {
mozilla::ANRReporter::Init();
mozilla::MemoryMonitor::Init();
mozilla::widget::Telemetry::Init();
mozilla::ThumbnailHelper::Init();
}
java::GeckoThread::SetState(java::GeckoThread::State::JNI_READY());
}