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

Side by Side Diff: Source/core/inspector/WorkerInspectorController.cpp

Issue 1163923005: Fix crash in inspector-protocol/debugger/debugger-pause-dedicated-worker.html (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed printf Created 5 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/WorkerInspectorController.h ('k') | Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 32
33 #include "core/inspector/WorkerInspectorController.h" 33 #include "core/inspector/WorkerInspectorController.h"
34 34
35 #include "bindings/core/v8/WorkerThreadDebugger.h"
35 #include "core/InspectorBackendDispatcher.h" 36 #include "core/InspectorBackendDispatcher.h"
36 #include "core/InspectorFrontend.h" 37 #include "core/InspectorFrontend.h"
37 #include "core/inspector/AsyncCallTracker.h" 38 #include "core/inspector/AsyncCallTracker.h"
38 #include "core/inspector/InjectedScriptHost.h" 39 #include "core/inspector/InjectedScriptHost.h"
39 #include "core/inspector/InjectedScriptManager.h" 40 #include "core/inspector/InjectedScriptManager.h"
40 #include "core/inspector/InspectorConsoleAgent.h" 41 #include "core/inspector/InspectorConsoleAgent.h"
41 #include "core/inspector/InspectorFrontendChannel.h" 42 #include "core/inspector/InspectorFrontendChannel.h"
42 #include "core/inspector/InspectorHeapProfilerAgent.h" 43 #include "core/inspector/InspectorHeapProfilerAgent.h"
43 #include "core/inspector/InspectorInstrumentation.h" 44 #include "core/inspector/InspectorInstrumentation.h"
44 #include "core/inspector/InspectorProfilerAgent.h" 45 #include "core/inspector/InspectorProfilerAgent.h"
45 #include "core/inspector/InspectorState.h" 46 #include "core/inspector/InspectorState.h"
46 #include "core/inspector/InspectorStateClient.h" 47 #include "core/inspector/InspectorStateClient.h"
48 #include "core/inspector/InspectorTaskRunner.h"
47 #include "core/inspector/InspectorTimelineAgent.h" 49 #include "core/inspector/InspectorTimelineAgent.h"
48 #include "core/inspector/InstrumentingAgents.h" 50 #include "core/inspector/InstrumentingAgents.h"
49 #include "core/inspector/WorkerConsoleAgent.h" 51 #include "core/inspector/WorkerConsoleAgent.h"
50 #include "core/inspector/WorkerDebuggerAgent.h" 52 #include "core/inspector/WorkerDebuggerAgent.h"
51 #include "core/inspector/WorkerRuntimeAgent.h" 53 #include "core/inspector/WorkerRuntimeAgent.h"
52 #include "core/workers/WorkerGlobalScope.h" 54 #include "core/workers/WorkerGlobalScope.h"
53 #include "core/workers/WorkerReportingProxy.h" 55 #include "core/workers/WorkerReportingProxy.h"
54 #include "core/workers/WorkerThread.h" 56 #include "core/workers/WorkerThread.h"
55 #include "wtf/PassOwnPtr.h" 57 #include "wtf/PassOwnPtr.h"
56 58
(...skipping 23 matching lines...) Expand all
80 class WorkerStateClient final : public InspectorStateClient { 82 class WorkerStateClient final : public InspectorStateClient {
81 WTF_MAKE_FAST_ALLOCATED(WorkerStateClient); 83 WTF_MAKE_FAST_ALLOCATED(WorkerStateClient);
82 public: 84 public:
83 WorkerStateClient(WorkerGlobalScope* context) { } 85 WorkerStateClient(WorkerGlobalScope* context) { }
84 virtual ~WorkerStateClient() { } 86 virtual ~WorkerStateClient() { }
85 87
86 private: 88 private:
87 virtual void updateInspectorStateCookie(const String& cookie) override { } 89 virtual void updateInspectorStateCookie(const String& cookie) override { }
88 }; 90 };
89 91
92 class RunInspectorCommandsTask final : public InspectorTaskRunner::Task {
93 public:
94 explicit RunInspectorCommandsTask(WorkerThread* thread)
95 : m_thread(thread) { }
96 virtual ~RunInspectorCommandsTask() { }
97 virtual void run() override
98 {
99 // Process all queued debugger commands. WorkerThread is certainly
100 // alive if this task is being executed.
101 m_thread->willEnterNestedLoop();
102 while (MessageQueueMessageReceived == m_thread->runDebuggerTask(WorkerTh read::DontWaitForMessage)) { }
103 m_thread->didLeaveNestedLoop();
104 }
105
106 private:
107 WorkerThread* m_thread;
108 };
109
90 } 110 }
91 111
92 class WorkerInjectedScriptHostClient: public InjectedScriptHostClient { 112 class WorkerInjectedScriptHostClient: public InjectedScriptHostClient {
93 public: 113 public:
94 WorkerInjectedScriptHostClient() { } 114 WorkerInjectedScriptHostClient() { }
95 115
96 ~WorkerInjectedScriptHostClient() override { } 116 ~WorkerInjectedScriptHostClient() override { }
97 }; 117 };
98 118
99 WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGl obalScope) 119 WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGl obalScope)
100 : m_workerGlobalScope(workerGlobalScope) 120 : m_workerGlobalScope(workerGlobalScope)
101 , m_stateClient(adoptPtr(new WorkerStateClient(workerGlobalScope))) 121 , m_stateClient(adoptPtr(new WorkerStateClient(workerGlobalScope)))
102 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(m_stateClient.get() ))) 122 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(m_stateClient.get() )))
103 , m_instrumentingAgents(InstrumentingAgents::create()) 123 , m_instrumentingAgents(InstrumentingAgents::create())
104 , m_injectedScriptManager(InjectedScriptManager::createForWorker()) 124 , m_injectedScriptManager(InjectedScriptManager::createForWorker())
105 , m_workerThreadDebugger(WorkerThreadDebugger::create(workerGlobalScope)) 125 , m_workerThreadDebugger(WorkerThreadDebugger::create(workerGlobalScope))
106 , m_agents(m_instrumentingAgents.get(), m_state.get()) 126 , m_agents(m_instrumentingAgents.get(), m_state.get())
127 , m_inspectorTaskRunner(adoptPtr(new InspectorTaskRunner(v8::Isolate::GetCur rent())))
107 , m_paused(false) 128 , m_paused(false)
108 { 129 {
109 OwnPtrWillBeRawPtr<WorkerRuntimeAgent> workerRuntimeAgent = WorkerRuntimeAge nt::create(m_injectedScriptManager.get(), m_workerThreadDebugger->debugger(), wo rkerGlobalScope, this); 130 OwnPtrWillBeRawPtr<WorkerRuntimeAgent> workerRuntimeAgent = WorkerRuntimeAge nt::create(m_injectedScriptManager.get(), m_workerThreadDebugger->debugger(), wo rkerGlobalScope, this);
110 m_workerRuntimeAgent = workerRuntimeAgent.get(); 131 m_workerRuntimeAgent = workerRuntimeAgent.get();
111 m_agents.append(workerRuntimeAgent.release()); 132 m_agents.append(workerRuntimeAgent.release());
112 133
113 OwnPtrWillBeRawPtr<WorkerDebuggerAgent> workerDebuggerAgent = WorkerDebugger Agent::create(m_workerThreadDebugger.get(), workerGlobalScope, m_injectedScriptM anager.get()); 134 OwnPtrWillBeRawPtr<WorkerDebuggerAgent> workerDebuggerAgent = WorkerDebugger Agent::create(m_workerThreadDebugger.get(), workerGlobalScope, m_injectedScriptM anager.get());
114 m_workerDebuggerAgent = workerDebuggerAgent.get(); 135 m_workerDebuggerAgent = workerDebuggerAgent.get();
115 m_agents.append(workerDebuggerAgent.release()); 136 m_agents.append(workerDebuggerAgent.release());
116 m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(m_workerDebugge rAgent, m_instrumentingAgents.get())); 137 m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(m_workerDebugge rAgent, m_instrumentingAgents.get()));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 { 188 {
168 ASSERT(!m_frontend); 189 ASSERT(!m_frontend);
169 connectFrontend(); 190 connectFrontend();
170 m_state->loadFromCookie(inspectorCookie); 191 m_state->loadFromCookie(inspectorCookie);
171 192
172 m_agents.restore(); 193 m_agents.restore();
173 } 194 }
174 195
175 void WorkerInspectorController::dispatchMessageFromFrontend(const String& messag e) 196 void WorkerInspectorController::dispatchMessageFromFrontend(const String& messag e)
176 { 197 {
198 m_inspectorTaskRunner->setIgnoreInterrupts(true);
177 if (m_backendDispatcher) 199 if (m_backendDispatcher)
178 m_backendDispatcher->dispatch(message); 200 m_backendDispatcher->dispatch(message);
201 m_inspectorTaskRunner->setIgnoreInterrupts(false);
179 } 202 }
180 203
181 void WorkerInspectorController::dispose() 204 void WorkerInspectorController::dispose()
182 { 205 {
183 m_instrumentingAgents->reset(); 206 m_instrumentingAgents->reset();
184 disconnectFrontend(); 207 disconnectFrontend();
185 } 208 }
186 209
187 void WorkerInspectorController::interruptAndDispatchInspectorCommands() 210 void WorkerInspectorController::interruptAndDispatchInspectorCommands()
188 { 211 {
189 m_workerDebuggerAgent->interruptAndDispatchInspectorCommands(); 212 m_inspectorTaskRunner->interruptAndRun(adoptPtr(new RunInspectorCommandsTask (m_workerGlobalScope->thread())));
190 } 213 }
191 214
192 void WorkerInspectorController::resumeStartup() 215 void WorkerInspectorController::resumeStartup()
193 { 216 {
194 m_paused = false; 217 m_paused = false;
195 } 218 }
196 219
197 bool WorkerInspectorController::isRunRequired() 220 bool WorkerInspectorController::isRunRequired()
198 { 221 {
199 return m_paused; 222 return m_paused;
(...skipping 19 matching lines...) Expand all
219 visitor->trace(m_injectedScriptManager); 242 visitor->trace(m_injectedScriptManager);
220 visitor->trace(m_workerThreadDebugger); 243 visitor->trace(m_workerThreadDebugger);
221 visitor->trace(m_backendDispatcher); 244 visitor->trace(m_backendDispatcher);
222 visitor->trace(m_agents); 245 visitor->trace(m_agents);
223 visitor->trace(m_workerDebuggerAgent); 246 visitor->trace(m_workerDebuggerAgent);
224 visitor->trace(m_asyncCallTracker); 247 visitor->trace(m_asyncCallTracker);
225 visitor->trace(m_workerRuntimeAgent); 248 visitor->trace(m_workerRuntimeAgent);
226 } 249 }
227 250
228 } // namespace blink 251 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/WorkerInspectorController.h ('k') | Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698