Index: Source/web/WebSharedWorkerImpl.cpp |
diff --git a/Source/web/WebSharedWorkerImpl.cpp b/Source/web/WebSharedWorkerImpl.cpp |
index 1d7d6881361626e888c845e4315715faa8fb596a..cc5b15d46cc030f06fd46551d3e37b24a114e026 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 noPendingActivity = true; |
tkent
2014/07/28 06:47:44
Negative variable is not good for code readability
|
if (m_mainScriptLoader) { |
m_mainScriptLoader->cancel(); |
m_mainScriptLoader.clear(); |
+ noPendingActivity = false; |
} |
- if (m_workerThread) |
+ if (m_workerThread) { |
m_workerThread->stop(); |
+ noPendingActivity = false; |
+ } |
+ |
+ if (noPendingActivity) { |
+ // If there are no active WorkerThread, |workerGlobalScopeClosed()| |
+ // call back to delete this is never called, so we should clean up here. |
+ delete this; |
+ } |
} |
void WebSharedWorkerImpl::initializeLoader(const WebURL& url) |