mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1151646 - Spin the event loop one extra time to clean up all CC'd objects before worker shutdown, r=khuey.
This commit is contained in:
parent
a1dae92265
commit
f6cb233b56
@ -2762,15 +2762,18 @@ WorkerThreadPrimaryRunnable::Run()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy the main context. This will unroot the main worker global and
|
// Destroy the main context. This will unroot the main worker global and GC,
|
||||||
// GC. This is not the last JSContext (WorkerJSRuntime maintains an
|
// which should break all cycles that touch JS.
|
||||||
// internal JSContext).
|
|
||||||
JS_DestroyContext(cx);
|
JS_DestroyContext(cx);
|
||||||
|
|
||||||
|
// Before shutting down the cycle collector we need to do one more pass
|
||||||
|
// through the event loop to clean up any C++ objects that need deferred
|
||||||
|
// cleanup.
|
||||||
|
mWorkerPrivate->ClearMainEventQueue(WorkerPrivate::WorkerRan);
|
||||||
|
|
||||||
// Now WorkerJSRuntime goes out of scope and its destructor will shut
|
// Now WorkerJSRuntime goes out of scope and its destructor will shut
|
||||||
// down the cycle collector and destroy the final JSContext. This
|
// down the cycle collector. This breaks any remaining cycles and collects
|
||||||
// breaks any remaining cycles and collects the C++ and JS objects
|
// any remaining C++ objects.
|
||||||
// participating.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mWorkerPrivate->SetThread(nullptr);
|
mWorkerPrivate->SetThread(nullptr);
|
||||||
|
@ -1210,6 +1210,9 @@ public:
|
|||||||
return mCancelAllPendingRunnables;
|
return mCancelAllPendingRunnables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClearMainEventQueue(WorkerRanOrNot aRanOrNot);
|
||||||
|
|
||||||
void
|
void
|
||||||
OnProcessNextEvent(uint32_t aRecursionDepth);
|
OnProcessNextEvent(uint32_t aRecursionDepth);
|
||||||
|
|
||||||
@ -1252,9 +1255,6 @@ private:
|
|||||||
WorkerType aWorkerType, const nsACString& aSharedWorkerName,
|
WorkerType aWorkerType, const nsACString& aSharedWorkerName,
|
||||||
WorkerLoadInfo& aLoadInfo);
|
WorkerLoadInfo& aLoadInfo);
|
||||||
|
|
||||||
void
|
|
||||||
ClearMainEventQueue(WorkerRanOrNot aRanOrNot);
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MayContinueRunning()
|
MayContinueRunning()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user