Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: Source/core/workers/WorkerThread.cpp

Issue 187483002: Oilpan: We need to collect all garbage before shutting down the worker thread (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/heap/Heap.h » ('j') | Source/heap/ThreadState.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « no previous file | Source/heap/Heap.h » ('j') | Source/heap/ThreadState.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698