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 "core/inspector/InspectorSession.h" | 5 #include "core/inspector/InspectorSession.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptController.h" | 7 #include "bindings/core/v8/ScriptController.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/frame/UseCounter.h" | 9 #include "core/frame/UseCounter.h" |
10 #include "core/inspector/InspectorBaseAgent.h" | 10 #include "core/inspector/InspectorBaseAgent.h" |
11 #include "core/inspector/InspectorInstrumentation.h" | 11 #include "core/inspector/InspectorInstrumentation.h" |
12 #include "platform/inspector_protocol/Parser.h" | 12 #include "platform/inspector_protocol/Parser.h" |
13 #include "platform/v8_inspector/public/V8Debugger.h" | 13 #include "platform/v8_inspector/public/V8Inspector.h" |
14 #include "platform/v8_inspector/public/V8InspectorSession.h" | 14 #include "platform/v8_inspector/public/V8InspectorSession.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 namespace { | 18 namespace { |
19 const char kV8StateKey[] = "v8"; | 19 const char kV8StateKey[] = "v8"; |
20 } | 20 } |
21 | 21 |
22 InspectorSession::InspectorSession(Client* client, InstrumentingAgents* instrume
ntingAgents, int sessionId, bool autoFlush, V8Debugger* debugger, int contextGro
upId, const String* savedState) | 22 InspectorSession::InspectorSession(Client* client, InstrumentingAgents* instrume
ntingAgents, int sessionId, bool autoFlush, V8Inspector* inspector, int contextG
roupId, const String* savedState) |
23 : m_client(client) | 23 : m_client(client) |
24 , m_v8Session(nullptr) | 24 , m_v8Session(nullptr) |
25 , m_sessionId(sessionId) | 25 , m_sessionId(sessionId) |
26 , m_autoFlush(autoFlush) | 26 , m_autoFlush(autoFlush) |
27 , m_disposed(false) | 27 , m_disposed(false) |
28 , m_instrumentingAgents(instrumentingAgents) | 28 , m_instrumentingAgents(instrumentingAgents) |
29 , m_inspectorBackendDispatcher(new protocol::UberDispatcher(this)) | 29 , m_inspectorBackendDispatcher(new protocol::UberDispatcher(this)) |
30 { | 30 { |
31 if (savedState) { | 31 if (savedState) { |
32 std::unique_ptr<protocol::Value> state = protocol::parseJSON(*savedState
); | 32 std::unique_ptr<protocol::Value> state = protocol::parseJSON(*savedState
); |
33 if (state) | 33 if (state) |
34 m_state = protocol::DictionaryValue::cast(std::move(state)); | 34 m_state = protocol::DictionaryValue::cast(std::move(state)); |
35 if (!m_state) | 35 if (!m_state) |
36 m_state = protocol::DictionaryValue::create(); | 36 m_state = protocol::DictionaryValue::create(); |
37 } else { | 37 } else { |
38 m_state = protocol::DictionaryValue::create(); | 38 m_state = protocol::DictionaryValue::create(); |
39 } | 39 } |
40 | 40 |
41 String16 v8State; | 41 String16 v8State; |
42 m_state->getString(kV8StateKey, &v8State); | 42 m_state->getString(kV8StateKey, &v8State); |
43 m_v8Session = debugger->connect(contextGroupId, this, this, savedState ? &v8
State : nullptr); | 43 m_v8Session = inspector->connect(contextGroupId, this, this, savedState ? &v
8State : nullptr); |
44 } | 44 } |
45 | 45 |
46 InspectorSession::~InspectorSession() | 46 InspectorSession::~InspectorSession() |
47 { | 47 { |
48 DCHECK(m_disposed); | 48 DCHECK(m_disposed); |
49 } | 49 } |
50 | 50 |
51 void InspectorSession::append(InspectorAgent* agent) | 51 void InspectorSession::append(InspectorAgent* agent) |
52 { | 52 { |
53 m_agents.append(agent); | 53 m_agents.append(agent); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 | 129 |
130 DEFINE_TRACE(InspectorSession) | 130 DEFINE_TRACE(InspectorSession) |
131 { | 131 { |
132 visitor->trace(m_instrumentingAgents); | 132 visitor->trace(m_instrumentingAgents); |
133 visitor->trace(m_agents); | 133 visitor->trace(m_agents); |
134 } | 134 } |
135 | 135 |
136 } // namespace blink | 136 } // namespace blink |
137 | 137 |
OLD | NEW |