Bug 874258 - Warn if we run shutdown CC more than twice. r=smaug

This commit is contained in:
Andrew McCreight 2013-05-24 11:26:09 -07:00
parent 6ca2dfc7bd
commit c87e5231b9

View File

@ -160,6 +160,9 @@ using namespace mozilla;
#define DEFAULT_SHUTDOWN_COLLECTIONS 5 #define DEFAULT_SHUTDOWN_COLLECTIONS 5
// One to do the freeing, then another to detect there is no more work to do.
#define NORMAL_SHUTDOWN_COLLECTIONS 2
#if defined(XP_WIN) #if defined(XP_WIN)
// Defined in nsThreadManager.cpp. // Defined in nsThreadManager.cpp.
extern DWORD gTLSThreadIDIndex; extern DWORD gTLSThreadIDIndex;
@ -2754,6 +2757,8 @@ nsCycleCollector::ShutdownCollect(nsICycleCollectorListener *aListener)
return; return;
for (uint32_t i = 0; i < DEFAULT_SHUTDOWN_COLLECTIONS; ++i) { for (uint32_t i = 0; i < DEFAULT_SHUTDOWN_COLLECTIONS; ++i) {
NS_WARN_IF_FALSE(i < NORMAL_SHUTDOWN_COLLECTIONS, "Extra shutdown CC");
// Synchronous cycle collection. Always force a JS GC beforehand. // Synchronous cycle collection. Always force a JS GC beforehand.
FixGrayBits(true); FixGrayBits(true);
if (aListener && NS_FAILED(aListener->Begin())) if (aListener && NS_FAILED(aListener->Begin()))