Index: Source/core/workers/WorkerThread.cpp |
diff --git a/Source/core/workers/WorkerThread.cpp b/Source/core/workers/WorkerThread.cpp |
index c60511544ab3c579e55ce404dcde5ef77705a1b8..2fcd2ff52d892a26a7b8b8027ec4fbb94264c255 100644 |
--- a/Source/core/workers/WorkerThread.cpp |
+++ b/Source/core/workers/WorkerThread.cpp |
@@ -135,18 +135,21 @@ void WorkerThread::workerThread() |
ThreadIdentifier threadID = m_threadID; |
+#if !ENABLE(OILPAN) |
+ ASSERT(m_workerGlobalScope->hasOneRef()); |
+#endif |
// The below assignment will destroy the context, which will in turn notify messaging proxy. |
Mads Ager (chromium)
2014/03/17 08:20:52
This comment should be updated now that the notifi
|
// We cannot let any objects survive past thread exit, because no other thread will run GC or otherwise destroy them. |
// If Oilpan is enabled, we detach of the context/global scope, with the final heap cleanup below sweeping it out. |
-#if ENABLE(OILPAN) |
m_workerGlobalScope->dispose(); |
-#else |
- ASSERT(m_workerGlobalScope->hasOneRef()); |
-#endif |
m_workerGlobalScope = nullptr; |
ThreadState::detach(); |
+ // Notify the proxy that WorkerGlobalScope has now been garbage collected and destructed. |
+ // This can free this thread object, hence it must not be touched afterwards. |
+ workerReportingProxy().workerGlobalScopeDestroyed(); |
+ |
// Clean up PlatformThreadData before WTF::WTFThreadData goes away! |
PlatformThreadData::current().destroy(); |