Bug 887125 - Allow 0 for Memory GC Preferences. r=bent
authorGregor Wagner <anygregor@gmail.com>
Thu, 27 Jun 2013 14:40:17 +0800
changeset 136588 a37c6d91463ffc009593a2a9c0cdb1f1cf8616a9
parent 136587 8fab56a48c0cda67a499c4d3c141a02a1309544b
child 136589 2504528a8d83e7080e15afad0ed9bc23f5ce738c
push id24888
push useremorley@mozilla.com
push dateThu, 27 Jun 2013 10:25:51 +0000
treeherdermozilla-central@f2ed08233968 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs887125
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 887125 - Allow 0 for Memory GC Preferences. r=bent
dom/base/nsJSEnvironment.cpp
dom/workers/RuntimeService.cpp
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -3246,17 +3246,17 @@ SetMemoryGCSliceTimePrefChangedCallback(
   return 0;
 }
 
 static int
 SetMemoryGCPrefChangedCallback(const char* aPrefName, void* aClosure)
 {
   int32_t pref = Preferences::GetInt(aPrefName, -1);
   // handle overflow and negative pref values
-  if (pref > 0 && pref < 10000)
+  if (pref >= 0 && pref < 10000)
     JS_SetGCParameter(nsJSRuntime::sRuntime, (JSGCParamKey)(intptr_t)aClosure, pref);
   return 0;
 }
 
 static int
 SetMemoryGCDynamicHeapGrowthPrefChangedCallback(const char* aPrefName, void* aClosure)
 {
   bool pref = Preferences::GetBool(aPrefName);
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -372,17 +372,17 @@ void
 UpdateCommonJSGCMemoryOption(RuntimeService* aRuntimeService,
                              const nsACString& aPrefName, JSGCParamKey aKey)
 {
   AssertIsOnMainThread();
   NS_ASSERTION(!aPrefName.IsEmpty(), "Empty pref name!");
 
   int32_t prefValue = GetWorkerPref(aPrefName, -1);
   uint32_t value =
-    (prefValue <= 0 || prefValue >= 10000) ? 0 : uint32_t(prefValue);
+    (prefValue < 0 || prefValue >= 10000) ? 0 : uint32_t(prefValue);
 
   RuntimeService::SetDefaultJSGCSettings(aKey, value);
 
   if (aRuntimeService) {
     aRuntimeService->UpdateAllWorkerMemoryParameter(aKey, value);
   }
 }