Bug 1174796 - Make sure ReleaseNow releases everything. r=smaug
authorAndrew McCreight <continuation@gmail.com>
Tue, 16 Jun 2015 14:19:07 -0700
changeset 280016 df2676f8ee8b5e07f8a6d58bd1de4a2023c36a9e
parent 280015 c82ca63f7310f96151368fb7d3c023934f2e5a37
child 280017 3fe20c75349b9918ed0f80bd51fd034fabad2dea
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1174796
milestone41.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 1174796 - Make sure ReleaseNow releases everything. r=smaug
xpcom/base/CycleCollectedJSRuntime.cpp
xpcom/base/DeferredFinalize.h
--- a/xpcom/base/CycleCollectedJSRuntime.cpp
+++ b/xpcom/base/CycleCollectedJSRuntime.cpp
@@ -1108,17 +1108,17 @@ IncrementalFinalizeRunnable::ReleaseNow(
         }
         if (done) {
           ++mFinalizeFunctionToRun;
         }
         if (timeout) {
           break;
         }
       } else {
-        function.run(UINT32_MAX, function.data);
+        while (!function.run(UINT32_MAX, function.data));
         ++mFinalizeFunctionToRun;
       }
     } while (mFinalizeFunctionToRun < mDeferredFinalizeFunctions.Length());
   }
 
   if (mFinalizeFunctionToRun == mDeferredFinalizeFunctions.Length()) {
     MOZ_ASSERT(mRuntime->mFinalizeRunnable == this);
     mDeferredFinalizeFunctions.Clear();
--- a/xpcom/base/DeferredFinalize.h
+++ b/xpcom/base/DeferredFinalize.h
@@ -11,19 +11,20 @@ class nsISupports;
 
 namespace mozilla {
 
 // Called back from DeferredFinalize.  Should add 'thing' to the array of smart
 // pointers in 'pointers', creating the array if 'pointers' is null, and return
 // the array.
 typedef void* (*DeferredFinalizeAppendFunction)(void* aPointers, void* aThing);
 
-// Called to finalize a number of objects. Slice is the number of objects
-// to finalize, or if it's UINT32_MAX, all objects should be finalized.
-// Return value indicates whether it finalized all objects in the buffer.
+// Called to finalize a number of objects. Slice is the number of objects to
+// finalize. The return value indicates whether it finalized all objects in the
+// buffer. If it returns true, the function will not be called again, so the
+// function should free aData.
 typedef bool (*DeferredFinalizeFunction)(uint32_t aSlice, void* aData);
 
 void DeferredFinalize(DeferredFinalizeAppendFunction aAppendFunc,
                       DeferredFinalizeFunction aFunc,
                       void* aThing);
 
 void DeferredFinalize(nsISupports* aSupports);