Bug 1299934 - Run shutdown collection in workers in opt builds. r=froydnj,smaug

We skip running shutdown collection on the main thread, because we're
exiting right after, but the process still continues when we shut down
a worker, so we should always do collections there.

MozReview-Commit-ID: IQZItm1qWXW

--HG--
extra : rebase_source : 4fd89e36db124a524c240e806a885dee3b68979e
This commit is contained in:
Andrew McCreight 2016-09-08 13:04:30 -07:00
Родитель 99515b1b1a
Коммит f9e6d19361
3 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -1330,7 +1330,7 @@ public:
SliceBudget& aBudget,
nsICycleCollectorListener* aManualListener,
bool aPreferShorterSlices = false);
void Shutdown();
void Shutdown(bool aDoCollect);
bool IsIdle() const { return mIncrementalPhase == IdlePhase; }
@ -3876,17 +3876,14 @@ nsCycleCollector::SuspectedCount()
}
void
nsCycleCollector::Shutdown()
nsCycleCollector::Shutdown(bool aDoCollect)
{
CheckThreadSafety();
// Always delete snow white objects.
FreeSnowWhite(true);
#ifndef NS_FREE_PERMANENT_DATA
if (PR_GetEnv("MOZ_CC_RUN_DURING_SHUTDOWN"))
#endif
{
if (aDoCollect) {
ShutdownCollect();
}
}
@ -4196,7 +4193,7 @@ nsCycleCollector_finishAnyCurrentCollection()
}
void
nsCycleCollector_shutdown()
nsCycleCollector_shutdown(bool aDoCollect)
{
CollectorData* data = sCollectorData.get();
@ -4205,7 +4202,7 @@ nsCycleCollector_shutdown()
PROFILER_LABEL("nsCycleCollector", "shutdown",
js::ProfileEntry::Category::CC);
data->mCollector->Shutdown();
data->mCollector->Shutdown(aDoCollect);
data->mCollector = nullptr;
if (data->mRuntime) {
// Run any remaining tasks that may have been enqueued via

Просмотреть файл

@ -51,7 +51,10 @@ void nsCycleCollector_collectSlice(js::SliceBudget& budget,
bool aPreferShorterSlices = false);
uint32_t nsCycleCollector_suspectedCount();
void nsCycleCollector_shutdown();
// If aDoCollect is true, then run the GC and CC a few times before
// shutting down the CC completely.
void nsCycleCollector_shutdown(bool aDoCollect = true);
// Helpers for interacting with JS
void nsCycleCollector_registerJSRuntime(mozilla::CycleCollectedJSRuntime* aRt);

Просмотреть файл

@ -984,7 +984,13 @@ ShutdownXPCOM(nsIServiceManager* aServMgr)
moduleLoaders = nullptr;
}
nsCycleCollector_shutdown();
bool shutdownCollect;
#ifdef NS_FREE_PERMANENT_DATA
shutdownCollect = true;
#else
shutdownCollect = !!PR_GetEnv("MOZ_CC_RUN_DURING_SHUTDOWN");
#endif
nsCycleCollector_shutdown(shutdownCollect);
PROFILER_MARKER("Shutdown xpcom");
// If we are doing any shutdown checks, poison writes.