Bug 981033 - Clear mActivelyCollecting before restarting CC. r=smaug
authorAndrew McCreight <continuation@gmail.com>
Tue, 11 Mar 2014 07:34:35 -0700
changeset 190149 07f6777305580cb65a8dba954dfd907fb4ed2c80
parent 190148 7311786f84770dcf234984e7c152f31adec0e6e4
child 190150 a2f674b6536c1a6b9f2d1c4b30177b3e55630294
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs981033
milestone30.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 981033 - Clear mActivelyCollecting before restarting CC. r=smaug
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -3193,17 +3193,16 @@ nsCycleCollector::Collect(ccType aCCType
                           nsICycleCollectorListener *aManualListener)
 {
     CheckThreadSafety();
 
     // This can legitimately happen in a few cases. See bug 383651.
     if (mActivelyCollecting || mFreeingSnowWhite) {
         return false;
     }
-    AutoRestore<bool> ar(mActivelyCollecting);
     mActivelyCollecting = true;
 
     bool startedIdle = (mIncrementalPhase == IdlePhase);
     bool collectedAny = false;
 
     // If the CC started idle, it will call BeginCollection, which
     // will do FreeSnowWhite, so it doesn't need to be done here.
     if (!startedIdle) {
@@ -3234,16 +3233,20 @@ nsCycleCollector::Collect(ccType aCCType
         case CleanupPhase:
             PrintPhase("CleanupAfterCollection");
             CleanupAfterCollection();
             finished = true;
             break;
         }
     } while (!aBudget.checkOverBudget() && !finished);
 
+    // Clear mActivelyCollecting here to ensure that a recursive call to
+    // Collect() does something.
+    mActivelyCollecting = false;
+
     if (aCCType != SliceCC && !startedIdle) {
         // We were in the middle of an incremental CC (using its own listener).
         // Somebody has forced a CC, so after having finished out the current CC,
         // run the CC again using the new listener.
         MOZ_ASSERT(mIncrementalPhase == IdlePhase);
         if (Collect(aCCType, aBudget, aManualListener)) {
             collectedAny = true;
         }