зеркало из https://github.com/mozilla/gecko-dev.git
Bug 913130, part 1 - Modify nsCycleCollector::Collect to allow it to be used at shutdown. r=smaug
This commit is contained in:
Родитель
bb260232f5
Коммит
a20bc41d54
|
@ -967,7 +967,8 @@ private:
|
|||
void ShutdownCollect(nsICycleCollectorListener *aListener);
|
||||
|
||||
public:
|
||||
void Collect(ccType aCCType,
|
||||
bool Collect(ccType aCCType,
|
||||
nsTArray<PtrInfo*> *aWhiteNodes,
|
||||
nsCycleCollectorResults *aResults,
|
||||
nsICycleCollectorListener *aListener);
|
||||
|
||||
|
@ -2682,25 +2683,24 @@ nsCycleCollector::ShutdownCollect(nsICycleCollectorListener *aListener)
|
|||
CleanupAfterCollection();
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
nsCycleCollector::Collect(ccType aCCType,
|
||||
nsTArray<PtrInfo*> *aWhiteNodes,
|
||||
nsCycleCollectorResults *aResults,
|
||||
nsICycleCollectorListener *aListener)
|
||||
{
|
||||
CheckThreadSafety();
|
||||
|
||||
// On a WantAllTraces CC, force a synchronous global GC to prevent
|
||||
// hijinks from ForgetSkippable and compartmental GCs.
|
||||
bool wantAllTraces = false;
|
||||
if (aListener) {
|
||||
aListener->GetWantAllTraces(&wantAllTraces);
|
||||
bool forceGC = (aCCType == ShutdownCC);
|
||||
if (!forceGC && aListener) {
|
||||
// On a WantAllTraces CC, force a synchronous global GC to prevent
|
||||
// hijinks from ForgetSkippable and compartmental GCs.
|
||||
aListener->GetWantAllTraces(&forceGC);
|
||||
}
|
||||
FixGrayBits(forceGC);
|
||||
|
||||
FixGrayBits(wantAllTraces);
|
||||
|
||||
nsAutoTArray<PtrInfo*, 4000> whiteNodes;
|
||||
if (!PrepareForCollection(aResults, &whiteNodes)) {
|
||||
return;
|
||||
if (!PrepareForCollection(aResults, aWhiteNodes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FreeSnowWhite(true);
|
||||
|
@ -2710,8 +2710,9 @@ nsCycleCollector::Collect(ccType aCCType,
|
|||
}
|
||||
|
||||
BeginCollection(aCCType, aListener);
|
||||
FinishCollection(aListener);
|
||||
bool collectedAny = FinishCollection(aListener);
|
||||
CleanupAfterCollection();
|
||||
return collectedAny;
|
||||
}
|
||||
|
||||
// Don't merge too many times in a row, and do at least a minimum
|
||||
|
@ -3184,7 +3185,9 @@ nsCycleCollector_collect(bool aManuallyTriggered,
|
|||
listener = new nsCycleCollectorLogger();
|
||||
}
|
||||
|
||||
data->mCollector->Collect(aManuallyTriggered ? ManualCC : ScheduledCC, aResults, listener);
|
||||
nsAutoTArray<PtrInfo*, 4000> whiteNodes;
|
||||
data->mCollector->Collect(aManuallyTriggered ? ManualCC : ScheduledCC,
|
||||
&whiteNodes, aResults, listener);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче