| 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" |
| 11 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 11 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 12 #include "platform/v8_inspector/V8DebuggerImpl.h" | 12 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 13 #include "platform/v8_inspector/V8HeapProfilerAgentImpl.h" | 13 #include "platform/v8_inspector/V8HeapProfilerAgentImpl.h" |
| 14 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" | 14 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" |
| 15 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 15 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
| 16 #include "platform/v8_inspector/public/V8ContextInfo.h" | 16 #include "platform/v8_inspector/public/V8ContextInfo.h" |
| 17 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 17 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 const char V8InspectorSession::backtraceObjectGroup[] = "backtrace"; | 21 const char V8InspectorSession::backtraceObjectGroup[] = "backtrace"; |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 bool V8InspectorSession::isV8ProtocolMethod(const String16& method) | 24 bool V8InspectorSession::isV8ProtocolMethod(const String16& method) |
| 25 { | 25 { |
| 26 return method.startWith("Debugger.") || method.startWith("HeapProfiler.") ||
method.startWith("Profiler.") || method.startWith("Runtime."); | 26 return method.startWith("Debugger.") || method.startWith("HeapProfiler.") ||
method.startWith("Profiler.") || method.startWith("Runtime."); |
| 27 } | 27 } |
| 28 | 28 |
| 29 std::unique_ptr<V8InspectorSessionImpl> V8InspectorSessionImpl::create(V8Debugge
rImpl* debugger, int contextGroupId, V8InspectorSessionClient* client, const Str
ing16* state) | 29 std::unique_ptr<V8InspectorSessionImpl> V8InspectorSessionImpl::create(V8Debugge
rImpl* debugger, int contextGroupId, protocol::FrontendChannel* channel, V8Inspe
ctorSessionClient* client, const String16* state) |
| 30 { | 30 { |
| 31 return wrapUnique(new V8InspectorSessionImpl(debugger, contextGroupId, clien
t, state)); | 31 return wrapUnique(new V8InspectorSessionImpl(debugger, contextGroupId, chann
el, client, state)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 V8InspectorSessionImpl::V8InspectorSessionImpl(V8DebuggerImpl* debugger, int con
textGroupId, V8InspectorSessionClient* client, const String16* savedState) | 34 V8InspectorSessionImpl::V8InspectorSessionImpl(V8DebuggerImpl* debugger, int con
textGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* clien
t, const String16* savedState) |
| 35 : m_contextGroupId(contextGroupId) | 35 : m_contextGroupId(contextGroupId) |
| 36 , m_debugger(debugger) | 36 , m_debugger(debugger) |
| 37 , m_client(client) | 37 , m_client(client) |
| 38 , m_customObjectFormatterEnabled(false) | 38 , m_customObjectFormatterEnabled(false) |
| 39 , m_instrumentationCounter(0) | 39 , m_instrumentationCounter(0) |
| 40 , m_dispatcher(client) | 40 , m_dispatcher(channel) |
| 41 , m_state(nullptr) | 41 , m_state(nullptr) |
| 42 , m_runtimeAgent(nullptr) | 42 , m_runtimeAgent(nullptr) |
| 43 , m_debuggerAgent(nullptr) | 43 , m_debuggerAgent(nullptr) |
| 44 , m_heapProfilerAgent(nullptr) | 44 , m_heapProfilerAgent(nullptr) |
| 45 , m_profilerAgent(nullptr) | 45 , m_profilerAgent(nullptr) |
| 46 { | 46 { |
| 47 if (savedState) { | 47 if (savedState) { |
| 48 std::unique_ptr<protocol::Value> state = protocol::parseJSON(*savedState
); | 48 std::unique_ptr<protocol::Value> state = protocol::parseJSON(*savedState
); |
| 49 if (state) | 49 if (state) |
| 50 m_state = protocol::DictionaryValue::cast(std::move(state)); | 50 m_state = protocol::DictionaryValue::cast(std::move(state)); |
| 51 if (!m_state) | 51 if (!m_state) |
| 52 m_state = protocol::DictionaryValue::create(); | 52 m_state = protocol::DictionaryValue::create(); |
| 53 } else { | 53 } else { |
| 54 m_state = protocol::DictionaryValue::create(); | 54 m_state = protocol::DictionaryValue::create(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 m_runtimeAgent = wrapUnique(new V8RuntimeAgentImpl(this, client, agentState(
protocol::Runtime::Metainfo::domainName))); | 57 m_runtimeAgent = wrapUnique(new V8RuntimeAgentImpl(this, channel, agentState
(protocol::Runtime::Metainfo::domainName))); |
| 58 protocol::Runtime::Dispatcher::wire(&m_dispatcher, m_runtimeAgent.get()); | 58 protocol::Runtime::Dispatcher::wire(&m_dispatcher, m_runtimeAgent.get()); |
| 59 | 59 |
| 60 m_debuggerAgent = wrapUnique(new V8DebuggerAgentImpl(this, client, agentStat
e(protocol::Debugger::Metainfo::domainName))); | 60 m_debuggerAgent = wrapUnique(new V8DebuggerAgentImpl(this, channel, agentSta
te(protocol::Debugger::Metainfo::domainName))); |
| 61 protocol::Debugger::Dispatcher::wire(&m_dispatcher, m_debuggerAgent.get()); | 61 protocol::Debugger::Dispatcher::wire(&m_dispatcher, m_debuggerAgent.get()); |
| 62 | 62 |
| 63 m_profilerAgent = wrapUnique(new V8ProfilerAgentImpl(this, client, agentStat
e(protocol::Profiler::Metainfo::domainName))); | 63 m_profilerAgent = wrapUnique(new V8ProfilerAgentImpl(this, channel, agentSta
te(protocol::Profiler::Metainfo::domainName))); |
| 64 protocol::Profiler::Dispatcher::wire(&m_dispatcher, m_profilerAgent.get()); | 64 protocol::Profiler::Dispatcher::wire(&m_dispatcher, m_profilerAgent.get()); |
| 65 | 65 |
| 66 m_heapProfilerAgent = wrapUnique(new V8HeapProfilerAgentImpl(this, client, a
gentState(protocol::HeapProfiler::Metainfo::domainName))); | 66 m_heapProfilerAgent = wrapUnique(new V8HeapProfilerAgentImpl(this, channel,
agentState(protocol::HeapProfiler::Metainfo::domainName))); |
| 67 protocol::HeapProfiler::Dispatcher::wire(&m_dispatcher, m_heapProfilerAgent.
get()); | 67 protocol::HeapProfiler::Dispatcher::wire(&m_dispatcher, m_heapProfilerAgent.
get()); |
| 68 | 68 |
| 69 if (savedState) { | 69 if (savedState) { |
| 70 m_runtimeAgent->restore(); | 70 m_runtimeAgent->restore(); |
| 71 m_debuggerAgent->restore(); | 71 m_debuggerAgent->restore(); |
| 72 m_heapProfilerAgent->restore(); | 72 m_heapProfilerAgent->restore(); |
| 73 m_profilerAgent->restore(); | 73 m_profilerAgent->restore(); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 { | 321 { |
| 322 m_debuggerAgent->asyncTaskFinished(task); | 322 m_debuggerAgent->asyncTaskFinished(task); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void V8InspectorSessionImpl::allAsyncTasksCanceled() | 325 void V8InspectorSessionImpl::allAsyncTasksCanceled() |
| 326 { | 326 { |
| 327 m_debuggerAgent->allAsyncTasksCanceled(); | 327 m_debuggerAgent->allAsyncTasksCanceled(); |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace blink | 330 } // namespace blink |
| OLD | NEW |