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/InspectedFrames.h" | |
11 #include "core/inspector/InspectorBaseAgent.h" | 10 #include "core/inspector/InspectorBaseAgent.h" |
12 #include "core/inspector/InspectorInstrumentation.h" | 11 #include "core/inspector/InspectorInstrumentation.h" |
13 #include "platform/inspector_protocol/Parser.h" | 12 #include "platform/inspector_protocol/Parser.h" |
14 #include "platform/v8_inspector/public/V8Debugger.h" | 13 #include "platform/v8_inspector/public/V8Debugger.h" |
15 #include "platform/v8_inspector/public/V8InspectorSession.h" | 14 #include "platform/v8_inspector/public/V8InspectorSession.h" |
16 | 15 |
17 namespace blink { | 16 namespace blink { |
18 | 17 |
19 namespace { | 18 namespace { |
20 const char kV8StateKey[] = "v8"; | 19 const char kV8StateKey[] = "v8"; |
21 } | 20 } |
22 | 21 |
23 InspectorSession::InspectorSession(Client* client, InspectedFrames* inspectedFra
mes, InstrumentingAgents* instrumentingAgents, int sessionId, bool autoFlush, V8
Debugger* debugger, int contextGroupId, const String* savedState) | 22 InspectorSession::InspectorSession(Client* client, InstrumentingAgents* instrume
ntingAgents, int sessionId, bool autoFlush, V8Debugger* debugger, int contextGro
upId, const String* savedState) |
24 : m_client(client) | 23 : m_client(client) |
25 , m_v8Session(nullptr) | 24 , m_v8Session(nullptr) |
26 , m_sessionId(sessionId) | 25 , m_sessionId(sessionId) |
27 , m_autoFlush(autoFlush) | 26 , m_autoFlush(autoFlush) |
28 , m_disposed(false) | 27 , m_disposed(false) |
29 , m_inspectedFrames(inspectedFrames) | |
30 , m_instrumentingAgents(instrumentingAgents) | 28 , m_instrumentingAgents(instrumentingAgents) |
31 , m_inspectorBackendDispatcher(new protocol::UberDispatcher(this)) | 29 , m_inspectorBackendDispatcher(new protocol::UberDispatcher(this)) |
32 { | 30 { |
33 if (savedState) { | 31 if (savedState) { |
34 std::unique_ptr<protocol::Value> state = protocol::parseJSON(*savedState
); | 32 std::unique_ptr<protocol::Value> state = protocol::parseJSON(*savedState
); |
35 if (state) | 33 if (state) |
36 m_state = protocol::DictionaryValue::cast(std::move(state)); | 34 m_state = protocol::DictionaryValue::cast(std::move(state)); |
37 if (!m_state) | 35 if (!m_state) |
38 m_state = protocol::DictionaryValue::create(); | 36 m_state = protocol::DictionaryValue::create(); |
39 } else { | 37 } else { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 for (size_t i = 0; i < m_notificationQueue.size(); ++i) | 120 for (size_t i = 0; i < m_notificationQueue.size(); ++i) |
123 m_client->sendProtocolMessage(m_sessionId, 0, m_notificationQueue[i], St
ring()); | 121 m_client->sendProtocolMessage(m_sessionId, 0, m_notificationQueue[i], St
ring()); |
124 m_notificationQueue.clear(); | 122 m_notificationQueue.clear(); |
125 } | 123 } |
126 | 124 |
127 void InspectorSession::resumeStartup() | 125 void InspectorSession::resumeStartup() |
128 { | 126 { |
129 m_client->resumeStartup(); | 127 m_client->resumeStartup(); |
130 } | 128 } |
131 | 129 |
132 bool InspectorSession::canExecuteScripts() | |
133 { | |
134 return m_inspectedFrames ? m_inspectedFrames->root()->script().canExecuteScr
ipts(NotAboutToExecuteScript) : true; | |
135 } | |
136 | |
137 DEFINE_TRACE(InspectorSession) | 130 DEFINE_TRACE(InspectorSession) |
138 { | 131 { |
139 visitor->trace(m_instrumentingAgents); | 132 visitor->trace(m_instrumentingAgents); |
140 visitor->trace(m_inspectedFrames); | |
141 visitor->trace(m_agents); | 133 visitor->trace(m_agents); |
142 } | 134 } |
143 | 135 |
144 } // namespace blink | 136 } // namespace blink |
145 | 137 |
OLD | NEW |