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

Unified Diff: Source/web/WebSharedWorkerImpl.cpp

Issue 424653002: Fix SharedWorker leak when script load has failed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: hasPendingActivity Created 6 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebSharedWorkerImpl.cpp
diff --git a/Source/web/WebSharedWorkerImpl.cpp b/Source/web/WebSharedWorkerImpl.cpp
index 1d7d6881361626e888c845e4315715faa8fb596a..af0cc99ccfb7bdb6e037df616f553c8c30e70963 100644
--- a/Source/web/WebSharedWorkerImpl.cpp
+++ b/Source/web/WebSharedWorkerImpl.cpp
@@ -178,12 +178,23 @@ void WebSharedWorkerImpl::stopWorkerThread()
if (m_askedToTerminate)
return;
m_askedToTerminate = true;
+
+ bool hasPendingActivity = false;
if (m_mainScriptLoader) {
m_mainScriptLoader->cancel();
m_mainScriptLoader.clear();
+ hasPendingActivity = true;
}
- if (m_workerThread)
+ if (m_workerThread) {
m_workerThread->stop();
+ hasPendingActivity = true;
+ }
+
+ if (!hasPendingActivity) {
+ // If there are no active WorkerThread, |workerGlobalScopeClosed()|
+ // callback to delete this is never called, so we should clean up here.
+ delete this;
+ }
}
void WebSharedWorkerImpl::initializeLoader(const WebURL& url)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698