Bug 1313978 - Don't use Preferences in MainThreadIdlePeriod until they are available r=smaug
authorRyan Hunt <rhunt@eqrion.net>
Mon, 31 Oct 2016 14:24:28 -0500
changeset 347229 e4460a5913c3e325d79ff3eb35a719d14b6e0d15
parent 347069 4b00f0d87c029a4f971b5b7ba71bf550ac449645
child 347230 c6df219786483e009d46d6fd506924698a5a458f
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1313978
milestone52.0a1
Bug 1313978 - Don't use Preferences in MainThreadIdlePeriod until they are available r=smaug
xpcom/threads/MainThreadIdlePeriod.cpp
--- a/xpcom/threads/MainThreadIdlePeriod.cpp
+++ b/xpcom/threads/MainThreadIdlePeriod.cpp
@@ -32,17 +32,17 @@ MainThreadIdlePeriod::GetIdlePeriodHint(
 }
 
 /* static */ float
 MainThreadIdlePeriod::GetLongIdlePeriod()
 {
   static float sLongIdlePeriod = DEFAULT_LONG_IDLE_PERIOD;
   static bool sInitialized = false;
 
-  if (!sInitialized) {
+  if (!sInitialized && Preferences::IsServiceAvailable()) {
     sInitialized = true;
     Preferences::AddFloatVarCache(&sLongIdlePeriod, "idle_queue.long_period",
                                   DEFAULT_LONG_IDLE_PERIOD);
   }
 
   return sLongIdlePeriod;
 }