Index: Source/core/workers/WorkerThread.cpp |
diff --git a/Source/core/workers/WorkerThread.cpp b/Source/core/workers/WorkerThread.cpp |
index b04391a18c04666cd2b1d94e7c2d2366d1203f90..f241feeb952e910d3daa3bc0397adbdccd415862 100644 |
--- a/Source/core/workers/WorkerThread.cpp |
+++ b/Source/core/workers/WorkerThread.cpp |
@@ -30,6 +30,8 @@ |
#include "bindings/v8/ScriptSourceCode.h" |
#include "core/inspector/InspectorInstrumentation.h" |
+#include "core/inspector/WorkerDebuggerAgent.h" |
+#include "core/inspector/WorkerInspectorController.h" |
#include "core/workers/DedicatedWorkerGlobalScope.h" |
#include "core/workers/WorkerClients.h" |
#include "core/workers/WorkerReportingProxy.h" |
@@ -102,12 +104,23 @@ void WorkerThread::workerThreadStart(void* thread) |
static_cast<WorkerThread*>(thread)->workerThread(); |
} |
+void WorkerThread::interruptAndDispatchInspectorCommands() |
+{ |
+ MutexLocker locker(m_threadShutdownMutex); |
+ if (!m_workerGlobalScope) |
+ return; |
+ WorkerInspectorController* inspectorController = m_workerGlobalScope->workerInspectorController(); |
+ if (!inspectorController) |
+ return; |
+ if (WorkerDebuggerAgent* debuggerAgent = inspectorController->workerDebuggerAgent()) |
yurys
2014/06/25 06:11:23
This check should always be true as the agent is c
|
+ debuggerAgent->interruptAndDispatchInspectorCommands(this); |
+} |
+ |
void WorkerThread::workerThread() |
{ |
KURL scriptURL = m_startupData->m_scriptURL; |
String sourceCode = m_startupData->m_sourceCode; |
WorkerThreadStartMode startMode = m_startupData->m_startMode; |
- |
{ |
MutexLocker lock(m_threadCreationMutex); |
ThreadState::attach(); |
@@ -140,14 +153,17 @@ void WorkerThread::workerThread() |
ThreadIdentifier threadID = m_threadID; |
- // 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. |
+ { |
+ MutexLocker locker(m_threadShutdownMutex); |
+ // 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) |
- ASSERT(m_workerGlobalScope->hasOneRef()); |
+ ASSERT(m_workerGlobalScope->hasOneRef()); |
#endif |
- m_workerGlobalScope->dispose(); |
- m_workerGlobalScope = nullptr; |
+ m_workerGlobalScope->dispose(); |
+ m_workerGlobalScope = nullptr; |
+ } |
// Detach the ThreadState, cleaning out the thread's heap by |
// performing a final GC. The cleanup operation will at the end |