From 884c626161941c1c3c360b6ccbc5b7b72970f25b Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Tue, 16 Jun 2015 14:19:07 -0700 Subject: [PATCH] Bug 1174796 - Make sure ReleaseNow releases everything. r=smaug --- xpcom/base/CycleCollectedJSRuntime.cpp | 2 +- xpcom/base/DeferredFinalize.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index 00d8f10b52b..ae936400627 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -1113,7 +1113,7 @@ IncrementalFinalizeRunnable::ReleaseNow(bool aLimited) break; } } else { - function.run(UINT32_MAX, function.data); + while (!function.run(UINT32_MAX, function.data)); ++mFinalizeFunctionToRun; } } while (mFinalizeFunctionToRun < mDeferredFinalizeFunctions.Length()); diff --git a/xpcom/base/DeferredFinalize.h b/xpcom/base/DeferredFinalize.h index 28e170d7f60..7d9c5888117 100644 --- a/xpcom/base/DeferredFinalize.h +++ b/xpcom/base/DeferredFinalize.h @@ -16,9 +16,10 @@ namespace mozilla { // 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,