Landing graydon's fix for bug 366578. Make the cycle collector run at shutdown.
git-svn-id: svn://10.0.0.236/trunk@218869 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
a564e3522c
commit
493b3c4f17
@ -488,6 +488,7 @@ struct nsCycleCollector
|
||||
void Allocated(void *n, size_t sz);
|
||||
void Freed(void *n);
|
||||
void Collect();
|
||||
void Shutdown();
|
||||
};
|
||||
|
||||
|
||||
@ -1666,6 +1667,19 @@ nsCycleCollector::Collect()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsCycleCollector::Shutdown()
|
||||
{
|
||||
// Here we want to run a final collection on everything we've seen
|
||||
// buffered, irrespective of age; then permanently disable
|
||||
// the collector because the program is shutting down.
|
||||
|
||||
mPurpleBuf.BumpGeneration();
|
||||
mParams.mScanDelay = 0;
|
||||
Collect();
|
||||
mParams.mDoNothing = PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Module public API (exported in nsCycleCollector.h)
|
||||
@ -1722,6 +1736,15 @@ nsCycleCollector_collect()
|
||||
sCollector.Collect();
|
||||
}
|
||||
|
||||
void
|
||||
nsCycleCollector_shutdown()
|
||||
{
|
||||
if (sCollectorConstructed == 0)
|
||||
return;
|
||||
|
||||
sCollector.Shutdown();
|
||||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsCycleCollector_isScanSafe(nsISupports *s)
|
||||
|
||||
@ -58,6 +58,7 @@ NS_COM PRBool nsCycleCollector_isScanSafe(nsISupports *n);
|
||||
NS_COM void nsCycleCollector_suspect(nsISupports *n);
|
||||
NS_COM void nsCycleCollector_forget(nsISupports *n);
|
||||
NS_COM void nsCycleCollector_collect();
|
||||
NS_COM void nsCycleCollector_shutdown();
|
||||
|
||||
// Helpers for interacting with language-identified scripts
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user