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

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

Issue 194923007: Explicit notification and removal of lifecycle observers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Delay proxy notification 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
Index: Source/core/workers/WorkerThread.cpp
diff --git a/Source/core/workers/WorkerThread.cpp b/Source/core/workers/WorkerThread.cpp
index c60511544ab3c579e55ce404dcde5ef77705a1b8..e711501aca3a51f6245ac520296fdf3dfdd0b2f1 100644
--- a/Source/core/workers/WorkerThread.cpp
+++ b/Source/core/workers/WorkerThread.cpp
@@ -135,18 +135,20 @@ 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.
// 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();
haraken 2014/03/17 01:22:56 Shall we move ThreadState::detach() at the very en
haraken 2014/03/17 01:25:45 As far as I read your comment in https://coderevie
sof 2014/03/17 07:46:41 Added a comment, which might address this? (not su
+ // Notify proxy that WorkerGlobalScope is now gone. This can free the WorkerThread object, so do not access it after this.
+ workerReportingProxy().workerGlobalScopeDestroyed();
+
// Clean up PlatformThreadData before WTF::WTFThreadData goes away!
PlatformThreadData::current().destroy();

Powered by Google App Engine
This is Rietveld 408576698