Index: Source/core/inspector/WorkerDebuggerAgent.cpp |
diff --git a/Source/core/inspector/WorkerDebuggerAgent.cpp b/Source/core/inspector/WorkerDebuggerAgent.cpp |
index 52d2b4d4f5c01e4badba956ba1125f152e94843d..ff902a64f0322ea694aafc26a665419f3bf48d76 100644 |
--- a/Source/core/inspector/WorkerDebuggerAgent.cpp |
+++ b/Source/core/inspector/WorkerDebuggerAgent.cpp |
@@ -32,6 +32,7 @@ |
#include "core/inspector/WorkerDebuggerAgent.h" |
#include "bindings/v8/ScriptDebugServer.h" |
+#include "core/inspector/WorkerInspectorController.h" |
#include "core/workers/WorkerGlobalScope.h" |
#include "core/workers/WorkerThread.h" |
#include "wtf/MessageQueue.h" |
@@ -40,21 +41,6 @@ namespace WebCore { |
namespace { |
-Mutex& workerDebuggerAgentsMutex() |
-{ |
- AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex); |
- return mutex; |
-} |
- |
-typedef HashMap<WorkerThread*, WorkerDebuggerAgent*> WorkerDebuggerAgents; |
- |
-WorkerDebuggerAgents& workerDebuggerAgents() |
-{ |
- DEFINE_STATIC_LOCAL(WorkerDebuggerAgents, agents, ()); |
- return agents; |
-} |
- |
- |
class RunInspectorCommandsTask FINAL : public ScriptDebugServer::Task { |
public: |
explicit RunInspectorCommandsTask(WorkerThread* thread) |
@@ -73,9 +59,9 @@ private: |
} // namespace |
-PassOwnPtr<WorkerDebuggerAgent> WorkerDebuggerAgent::create(WorkerScriptDebugServer* scriptDebugServer, WorkerGlobalScope* inspectedWorkerGlobalScope, InjectedScriptManager* injectedScriptManager) |
+PassOwnPtrWillBeRawPtr<WorkerDebuggerAgent> WorkerDebuggerAgent::create(WorkerScriptDebugServer* scriptDebugServer, WorkerGlobalScope* inspectedWorkerGlobalScope, InjectedScriptManager* injectedScriptManager) |
{ |
- return adoptPtr(new WorkerDebuggerAgent(scriptDebugServer, inspectedWorkerGlobalScope, injectedScriptManager)); |
+ return adoptPtrWillBeNoop(new WorkerDebuggerAgent(scriptDebugServer, inspectedWorkerGlobalScope, injectedScriptManager)); |
} |
WorkerDebuggerAgent::WorkerDebuggerAgent(WorkerScriptDebugServer* scriptDebugServer, WorkerGlobalScope* inspectedWorkerGlobalScope, InjectedScriptManager* injectedScriptManager) |
@@ -83,23 +69,28 @@ WorkerDebuggerAgent::WorkerDebuggerAgent(WorkerScriptDebugServer* scriptDebugSer |
, m_scriptDebugServer(scriptDebugServer) |
, m_inspectedWorkerGlobalScope(inspectedWorkerGlobalScope) |
{ |
- MutexLocker lock(workerDebuggerAgentsMutex()); |
- workerDebuggerAgents().set(inspectedWorkerGlobalScope->thread(), this); |
} |
WorkerDebuggerAgent::~WorkerDebuggerAgent() |
{ |
- MutexLocker lock(workerDebuggerAgentsMutex()); |
- ASSERT(workerDebuggerAgents().contains(m_inspectedWorkerGlobalScope->thread())); |
- workerDebuggerAgents().remove(m_inspectedWorkerGlobalScope->thread()); |
+} |
+ |
+void WorkerDebuggerAgent::trace(Visitor* visitor) |
+{ |
+ visitor->trace(m_inspectedWorkerGlobalScope); |
+ InspectorDebuggerAgent::trace(visitor); |
} |
void WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(WorkerThread* thread) |
{ |
- MutexLocker lock(workerDebuggerAgentsMutex()); |
- WorkerDebuggerAgent* agent = workerDebuggerAgents().get(thread); |
- if (agent) |
- agent->m_scriptDebugServer->interruptAndRunTask(adoptPtr(new RunInspectorCommandsTask(thread))); |
+ WorkerGlobalScope* workerGlobalScope = thread->workerGlobalScope(); |
+ if (!workerGlobalScope) |
yurys
2014/06/19 07:37:03
This method is called on the main thread while Wor
keishi
2014/06/19 12:52:07
I was able to make the map solution work in oilpan
|
+ return; |
+ WorkerInspectorController* workerInspectorController = workerGlobalScope->workerInspectorController(); |
+ ASSERT(workerInspectorController); |
+ WorkerDebuggerAgent* workerDebuggerAgent = workerInspectorController->workerDebuggerAgent(); |
+ ASSERT(workerDebuggerAgent); |
+ workerDebuggerAgent->scriptDebugServer().interruptAndRunTask(adoptPtr(new RunInspectorCommandsTask(thread))); |
} |
void WorkerDebuggerAgent::startListeningScriptDebugServer() |