OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 5 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
6 | 6 |
7 #include "platform/inspector_protocol/Parser.h" | 7 #include "platform/inspector_protocol/Parser.h" |
8 #include "platform/v8_inspector/InjectedScript.h" | 8 #include "platform/v8_inspector/InjectedScript.h" |
9 #include "platform/v8_inspector/InspectedContext.h" | 9 #include "platform/v8_inspector/InspectedContext.h" |
10 #include "platform/v8_inspector/RemoteObjectId.h" | 10 #include "platform/v8_inspector/RemoteObjectId.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 std::unique_ptr<V8InspectorSessionImpl> V8InspectorSessionImpl::create(V8Debugge
rImpl* debugger, int contextGroupId, protocol::FrontendChannel* channel, V8Inspe
ctorSessionClient* client, const String16* state) | 30 std::unique_ptr<V8InspectorSessionImpl> V8InspectorSessionImpl::create(V8Debugge
rImpl* debugger, int contextGroupId, protocol::FrontendChannel* channel, V8Inspe
ctorSessionClient* client, const String16* state) |
31 { | 31 { |
32 return wrapUnique(new V8InspectorSessionImpl(debugger, contextGroupId, chann
el, client, state)); | 32 return wrapUnique(new V8InspectorSessionImpl(debugger, contextGroupId, chann
el, client, state)); |
33 } | 33 } |
34 | 34 |
35 V8InspectorSessionImpl::V8InspectorSessionImpl(V8DebuggerImpl* debugger, int con
textGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* clien
t, const String16* savedState) | 35 V8InspectorSessionImpl::V8InspectorSessionImpl(V8DebuggerImpl* debugger, int con
textGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* clien
t, const String16* savedState) |
36 : m_contextGroupId(contextGroupId) | 36 : m_contextGroupId(contextGroupId) |
37 , m_debugger(debugger) | 37 , m_debugger(debugger) |
38 , m_client(client) | 38 , m_client(client) |
39 , m_customObjectFormatterEnabled(false) | 39 , m_customObjectFormatterEnabled(false) |
40 , m_instrumentationCounter(0) | |
41 , m_dispatcher(channel) | 40 , m_dispatcher(channel) |
42 , m_state(nullptr) | 41 , m_state(nullptr) |
43 , m_runtimeAgent(nullptr) | 42 , m_runtimeAgent(nullptr) |
44 , m_debuggerAgent(nullptr) | 43 , m_debuggerAgent(nullptr) |
45 , m_heapProfilerAgent(nullptr) | 44 , m_heapProfilerAgent(nullptr) |
46 , m_profilerAgent(nullptr) | 45 , m_profilerAgent(nullptr) |
47 , m_consoleAgent(nullptr) | 46 , m_consoleAgent(nullptr) |
48 { | 47 { |
49 if (savedState) { | 48 if (savedState) { |
50 std::unique_ptr<protocol::Value> state = protocol::parseJSON(*savedState
); | 49 std::unique_ptr<protocol::Value> state = protocol::parseJSON(*savedState
); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 238 |
240 void V8InspectorSessionImpl::reportAllContexts(V8RuntimeAgentImpl* agent) | 239 void V8InspectorSessionImpl::reportAllContexts(V8RuntimeAgentImpl* agent) |
241 { | 240 { |
242 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); | 241 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); |
243 if (!contexts) | 242 if (!contexts) |
244 return; | 243 return; |
245 for (auto& idContext : *contexts) | 244 for (auto& idContext : *contexts) |
246 agent->reportExecutionContextCreated(idContext.second.get()); | 245 agent->reportExecutionContextCreated(idContext.second.get()); |
247 } | 246 } |
248 | 247 |
249 void V8InspectorSessionImpl::changeInstrumentationCounter(int delta) | |
250 { | |
251 DCHECK_GE(m_instrumentationCounter + delta, 0); | |
252 if (!m_instrumentationCounter) | |
253 m_client->startInstrumenting(); | |
254 m_instrumentationCounter += delta; | |
255 if (!m_instrumentationCounter) | |
256 m_client->stopInstrumenting(); | |
257 } | |
258 | |
259 void V8InspectorSessionImpl::dispatchProtocolMessage(const String16& message) | 248 void V8InspectorSessionImpl::dispatchProtocolMessage(const String16& message) |
260 { | 249 { |
261 m_dispatcher.dispatch(message); | 250 m_dispatcher.dispatch(message); |
262 } | 251 } |
263 | 252 |
264 String16 V8InspectorSessionImpl::stateJSON() | 253 String16 V8InspectorSessionImpl::stateJSON() |
265 { | 254 { |
266 return m_state->toJSONString(); | 255 return m_state->toJSONString(); |
267 } | 256 } |
268 | 257 |
(...skipping 19 matching lines...) Expand all Loading... |
288 void V8InspectorSessionImpl::cancelPauseOnNextStatement() | 277 void V8InspectorSessionImpl::cancelPauseOnNextStatement() |
289 { | 278 { |
290 m_debuggerAgent->cancelPauseOnNextStatement(); | 279 m_debuggerAgent->cancelPauseOnNextStatement(); |
291 } | 280 } |
292 | 281 |
293 void V8InspectorSessionImpl::breakProgram(const String16& breakReason, std::uniq
ue_ptr<protocol::DictionaryValue> data) | 282 void V8InspectorSessionImpl::breakProgram(const String16& breakReason, std::uniq
ue_ptr<protocol::DictionaryValue> data) |
294 { | 283 { |
295 m_debuggerAgent->breakProgram(breakReason, std::move(data)); | 284 m_debuggerAgent->breakProgram(breakReason, std::move(data)); |
296 } | 285 } |
297 | 286 |
298 void V8InspectorSessionImpl::breakProgramOnException(const String16& breakReason
, std::unique_ptr<protocol::DictionaryValue> data) | |
299 { | |
300 m_debuggerAgent->breakProgramOnException(breakReason, std::move(data)); | |
301 } | |
302 | |
303 void V8InspectorSessionImpl::setSkipAllPauses(bool skip) | 287 void V8InspectorSessionImpl::setSkipAllPauses(bool skip) |
304 { | 288 { |
305 ErrorString errorString; | 289 ErrorString errorString; |
306 m_debuggerAgent->setSkipAllPauses(&errorString, skip); | 290 m_debuggerAgent->setSkipAllPauses(&errorString, skip); |
307 } | 291 } |
308 | 292 |
309 void V8InspectorSessionImpl::resume() | 293 void V8InspectorSessionImpl::resume() |
310 { | 294 { |
311 ErrorString errorString; | 295 ErrorString errorString; |
312 m_debuggerAgent->resume(&errorString); | 296 m_debuggerAgent->resume(&errorString); |
313 } | 297 } |
314 | 298 |
315 void V8InspectorSessionImpl::stepOver() | 299 void V8InspectorSessionImpl::stepOver() |
316 { | 300 { |
317 ErrorString errorString; | 301 ErrorString errorString; |
318 m_debuggerAgent->stepOver(&errorString); | 302 m_debuggerAgent->stepOver(&errorString); |
319 } | 303 } |
320 | 304 |
321 } // namespace blink | 305 } // namespace blink |
OLD | NEW |