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

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

Issue 203233004: Oilpan: Fix worker thread termination finalization order issues. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update comment. Created 6 years, 9 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 | « Source/core/workers/WorkerGlobalScope.cpp ('k') | no next file » | no next file with comments »
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 c60511544ab3c579e55ce404dcde5ef77705a1b8..a956a8221a1fa9e9086eca92b299f28ada1f3af7 100644
--- a/Source/core/workers/WorkerThread.cpp
+++ b/Source/core/workers/WorkerThread.cpp
@@ -145,8 +145,20 @@ void WorkerThread::workerThread()
#endif
m_workerGlobalScope = nullptr;
+ // Detach the ThreadState, cleaning out the thread's heap by
+ // performing a final GC. The cleanup operation will at the end
+ // assert that the heap is empty. If the heap does not become
+ // empty, there are still pointers into the heap and those
+ // pointers will be dangling after thread termination because we
+ // are destroying the heap. It is important to detach while the
+ // thread is still valid. In particular, finalizers for objects in
+ // the heap for this thread will need to access thread local data.
ThreadState::detach();
+ // Notify the proxy that the WorkerGlobalScope has been disposed of.
+ // 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();
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698