Index: Source/core/inspector/WorkerDebuggerAgent.cpp |
diff --git a/Source/core/inspector/WorkerDebuggerAgent.cpp b/Source/core/inspector/WorkerDebuggerAgent.cpp |
index 52d2b4d4f5c01e4badba956ba1125f152e94843d..2a4da722a09555c8320b55406c0366adb154c510 100644 |
--- a/Source/core/inspector/WorkerDebuggerAgent.cpp |
+++ b/Source/core/inspector/WorkerDebuggerAgent.cpp |
@@ -54,6 +54,31 @@ WorkerDebuggerAgents& workerDebuggerAgents() |
return agents; |
} |
+#if ENABLE(OILPAN) |
+class WorkerDebuggerAgentRemover { |
+public: |
+ WorkerDebuggerAgentRemover(WorkerThread* thread) |
+ { |
+ m_thread = thread; |
+ } |
+ ~WorkerDebuggerAgentRemover() |
+ { |
+ MutexLocker lock(workerDebuggerAgentsMutex()); |
+ workerDebuggerAgents().remove(m_thread); |
haraken
2014/05/30 03:24:12
If you insert printf to ~WorkerDebuggerAgentRemove
|
+ } |
+ |
+private: |
+ WorkerThread* m_thread; |
+}; |
+ |
+typedef WillBePersistentHeapHashMap<WeakMember<WorkerDebuggerAgent>, OwnPtr<WorkerDebuggerAgentRemover> > WorkerDebuggerAgentRemovers; |
haraken
2014/06/02 04:51:14
mads@, erik@: I'm guessing that this issue might b
Mads Ager (chromium)
2014/06/02 09:00:59
That does not work, no. If you need to do somethin
|
+ |
+WorkerDebuggerAgentRemovers& workerDebuggerAgentRemovers() |
+{ |
+ DEFINE_STATIC_LOCAL(WorkerDebuggerAgentRemovers, removers, ()); |
haraken
2014/05/30 03:24:12
I don't think it's related, but what happens if yo
|
+ return removers; |
+} |
+#endif |
class RunInspectorCommandsTask FINAL : public ScriptDebugServer::Task { |
public: |
@@ -73,9 +98,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) |
@@ -84,14 +109,26 @@ WorkerDebuggerAgent::WorkerDebuggerAgent(WorkerScriptDebugServer* scriptDebugSer |
, m_inspectedWorkerGlobalScope(inspectedWorkerGlobalScope) |
{ |
MutexLocker lock(workerDebuggerAgentsMutex()); |
- workerDebuggerAgents().set(inspectedWorkerGlobalScope->thread(), this); |
+ WorkerThread* thread = inspectedWorkerGlobalScope->thread(); |
+ ASSERT(!workerDebuggerAgents().contains(thread)); |
+ ASSERT(!workerDebuggerAgentRemovers().contains(this)); |
+ workerDebuggerAgents().set(thread, this); |
+ workerDebuggerAgentRemovers().set(this, adoptPtr(new WorkerDebuggerAgentRemover(thread))); |
haraken
2014/05/30 01:13:20
The line 113 and 115 need to be removed in oilpan
keishi
2014/05/30 02:01:07
Won't line 79 in ~WorkerDebuggerAgentRemover work
haraken
2014/05/30 03:24:12
oh, line 67 should work.
|
} |
WorkerDebuggerAgent::~WorkerDebuggerAgent() |
{ |
+#if !ENABLE(OILPAN) |
MutexLocker lock(workerDebuggerAgentsMutex()); |
ASSERT(workerDebuggerAgents().contains(m_inspectedWorkerGlobalScope->thread())); |
workerDebuggerAgents().remove(m_inspectedWorkerGlobalScope->thread()); |
+#endif |
+} |
+ |
+void WorkerDebuggerAgent::trace(Visitor* visitor) |
+{ |
+ visitor->trace(m_inspectedWorkerGlobalScope); |
+ InspectorDebuggerAgent::trace(visitor); |
} |
void WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(WorkerThread* thread) |