Bug 1356695 - Ensure gfxPrefs is initialized if gfxPlatform::AsyncPanZoomEnabled is called early in startup. r=milan, a=gchang
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 17 Apr 2017 11:56:26 -0400
changeset 395948 1d567ed511606f6117144252237463eb3ccd5e3e
parent 395947 6073f26ea1db85264cc1eaa5923de7bef6c14257
child 395949 1a74650efe112263c6f65a90bb22ca66ac65d97e
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan, gchang
bugs1356695
milestone54.0
Bug 1356695 - Ensure gfxPrefs is initialized if gfxPlatform::AsyncPanZoomEnabled is called early in startup. r=milan, a=gchang MozReview-Commit-ID: CnHHcuZRPTc
gfx/thebes/gfxPlatform.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2524,16 +2524,21 @@ gfxPlatform::AsyncPanZoomEnabled()
   // this requirement.
   if (!BrowserTabsRemoteAutostart()) {
     return false;
   }
 #endif
 #ifdef MOZ_WIDGET_ANDROID
   return true;
 #else
+  if (!gfxPrefs::SingletonExists()) {
+    // Make sure the gfxPrefs has been initialized before reading from it.
+    MOZ_ASSERT(NS_IsMainThread());
+    gfxPrefs::GetSingleton();
+  }
   return gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly();
 #endif
 }
 
 /*static*/ bool
 gfxPlatform::PerfWarnings()
 {
   return gfxPrefs::PerfWarnings();