Chromium Code Reviews| Index: Source/core/workers/WorkerThread.cpp |
| diff --git a/Source/core/workers/WorkerThread.cpp b/Source/core/workers/WorkerThread.cpp |
| index 7d6efc7e0b26cba91178b60b26e619b6bdb76e67..f71b83f90056f4710749a84ef343b99e1114581a 100644 |
| --- a/Source/core/workers/WorkerThread.cpp |
| +++ b/Source/core/workers/WorkerThread.cpp |
| @@ -137,23 +137,25 @@ void WorkerThread::workerThread() |
| ThreadIdentifier threadID = m_threadID; |
| + // We need to collect all garbage before checking that the WorkerThread has the last reference |
| + // to the WorkerGlobalScope. We don't need to call V8's GC because all wrappers of the worker thread |
| + // are stored in DOMWrapperMap (i.e., no wrappers of the worker thread are stored in ScriptWrappable) |
| + // and they are already cleared out in ~WorkerScriptController(). In short, we just need to call |
| + // oilpan's GC to collect all garbage. |
| + Heap::collectAllGarbage(ThreadState::NoHeapPointersOnStack); |
|
haraken
2014/03/05 05:08:35
Actually, I'll remove this code soon because the f
Mads Ager (chromium)
2014/03/05 07:40:34
We should just #ifdef out the ASSERT now so we don
haraken
2014/03/05 08:50:26
Done.
|
| ASSERT(m_workerGlobalScope->hasOneRef()); |
| // The below assignment will destroy the context, which will in turn notify messaging proxy. |
| // We cannot let any objects survive past thread exit, because no other thread will run GC or otherwise destroy them. |
| m_workerGlobalScope = nullptr; |
| - // Cleanup thread heap which causes all objects to be finalized. |
| - // After this call thread heap must be empty. |
| - ThreadState::current()->cleanup(); |
| + ThreadState::detach(); |
| // Clean up PlatformThreadData before WTF::WTFThreadData goes away! |
| PlatformThreadData::current().destroy(); |
| // The thread object may be already destroyed from notification now, don't try to access "this". |
| detachThread(threadID); |
| - |
| - ThreadState::detach(); |
| } |
| void WorkerThread::runEventLoop() |