Bug 1427525, try to not leak IdleTaskRunners related to GC/CC during shutdow, r=mccr8

This commit is contained in:
Olli Pettay 2018-01-05 01:56:46 +02:00
Родитель 0d1852004e
Коммит 496d14fe4e
1 изменённых файлов: 9 добавлений и 0 удалений

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

@ -1636,6 +1636,10 @@ nsJSContext::BeginCycleCollectionCallback()
MOZ_ASSERT(!sICCRunner, "Tried to create a new ICC timer when one already existed.");
if (sShuttingDown) {
return;
}
// Create an ICC timer even if ICC is globally disabled, because we could be manually triggering
// an incremental collection, and we want to be sure to finish it.
sICCRunner = IdleTaskRunner::Create(ICCRunnerFired,
@ -1863,6 +1867,11 @@ void
GCTimerFired(nsITimer *aTimer, void *aClosure)
{
nsJSContext::KillGCTimer();
nsJSContext::KillInterSliceGCRunner();
if (sShuttingDown) {
return;
}
// Now start the actual GC after initial timer has fired.
sInterSliceGCRunner = IdleTaskRunner::Create([aClosure](TimeStamp aDeadline) {
return InterSliceGCRunnerFired(aDeadline, aClosure);