mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 20:22:00 +00:00
Bug 913527, part 3 - Check for collection in progress in Collect. r=smaug
Moving this to the top level simplifies dealing with PrepareForCollection a bit.
This commit is contained in:
parent
7dfdd8f01d
commit
35872c70ab
@ -981,7 +981,7 @@ public:
|
||||
nsCycleCollectorResults *aResults,
|
||||
nsICycleCollectorListener *aListener);
|
||||
|
||||
bool PrepareForCollection(nsCycleCollectorResults *aResults,
|
||||
void PrepareForCollection(nsCycleCollectorResults *aResults,
|
||||
nsTArray<PtrInfo*> *aWhiteNodes);
|
||||
void FixGrayBits(bool aForceGC);
|
||||
bool ShouldMergeZones(ccType aCCType);
|
||||
@ -2599,14 +2599,10 @@ nsCycleCollector::FixGrayBits(bool aForceGC)
|
||||
timeLog.Checkpoint("GC()");
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
nsCycleCollector::PrepareForCollection(nsCycleCollectorResults *aResults,
|
||||
nsTArray<PtrInfo*> *aWhiteNodes)
|
||||
{
|
||||
// This can legitimately happen in a few cases. See bug 383651.
|
||||
if (mCollectionInProgress)
|
||||
return false;
|
||||
|
||||
TimeLog timeLog;
|
||||
|
||||
mCollectionStart = TimeStamp::Now();
|
||||
@ -2623,8 +2619,6 @@ nsCycleCollector::PrepareForCollection(nsCycleCollectorResults *aResults,
|
||||
mWhiteNodes = aWhiteNodes;
|
||||
|
||||
timeLog.Checkpoint("PrepareForCollection()");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
@ -2687,10 +2681,13 @@ nsCycleCollector::Collect(ccType aCCType,
|
||||
{
|
||||
CheckThreadSafety();
|
||||
|
||||
if (!PrepareForCollection(aResults, aWhiteNodes)) {
|
||||
// This can legitimately happen in a few cases. See bug 383651.
|
||||
if (mCollectionInProgress) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PrepareForCollection(aResults, aWhiteNodes);
|
||||
|
||||
bool forceGC = (aCCType == ShutdownCC);
|
||||
if (!forceGC && aListener) {
|
||||
// On a WantAllTraces CC, force a synchronous global GC to prevent
|
||||
|
Loading…
x
Reference in New Issue
Block a user