OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/V8DebuggerAgentImpl.h" | 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
6 | 6 |
7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
9 #include "platform/v8_inspector/InjectedScript.h" | 9 #include "platform/v8_inspector/InjectedScript.h" |
10 #include "platform/v8_inspector/InspectedContext.h" | 10 #include "platform/v8_inspector/InspectedContext.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 m_state->setBoolean(DebuggerAgentState::debuggerEnabled, true); | 133 m_state->setBoolean(DebuggerAgentState::debuggerEnabled, true); |
134 debugger().debuggerAgentEnabled(); | 134 debugger().debuggerAgentEnabled(); |
135 | 135 |
136 std::vector<std::unique_ptr<V8DebuggerScript>> compiledScripts; | 136 std::vector<std::unique_ptr<V8DebuggerScript>> compiledScripts; |
137 debugger().getCompiledScripts(m_session->contextGroupId(), compiledScripts); | 137 debugger().getCompiledScripts(m_session->contextGroupId(), compiledScripts); |
138 for (size_t i = 0; i < compiledScripts.size(); i++) | 138 for (size_t i = 0; i < compiledScripts.size(); i++) |
139 didParseSource(std::move(compiledScripts[i]), true); | 139 didParseSource(std::move(compiledScripts[i]), true); |
140 | 140 |
141 // FIXME(WK44513): breakpoints activated flag should be synchronized between
all front-ends | 141 // FIXME(WK44513): breakpoints activated flag should be synchronized between
all front-ends |
142 debugger().setBreakpointsActivated(true); | 142 debugger().setBreakpointsActivated(true); |
143 m_session->changeInstrumentationCounter(+1); | |
144 } | 143 } |
145 | 144 |
146 bool V8DebuggerAgentImpl::enabled() | 145 bool V8DebuggerAgentImpl::enabled() |
147 { | 146 { |
148 return m_enabled; | 147 return m_enabled; |
149 } | 148 } |
150 | 149 |
151 void V8DebuggerAgentImpl::enable(ErrorString* errorString) | 150 void V8DebuggerAgentImpl::enable(ErrorString* errorString) |
152 { | 151 { |
153 if (enabled()) | 152 if (enabled()) |
154 return; | 153 return; |
155 | 154 |
156 if (!m_session->client()->canExecuteScripts()) { | 155 if (!m_session->client()->canExecuteScripts()) { |
157 *errorString = "Script execution is prohibited"; | 156 *errorString = "Script execution is prohibited"; |
158 return; | 157 return; |
159 } | 158 } |
160 | 159 |
161 enable(); | 160 enable(); |
162 } | 161 } |
163 | 162 |
164 void V8DebuggerAgentImpl::disable(ErrorString*) | 163 void V8DebuggerAgentImpl::disable(ErrorString*) |
165 { | 164 { |
166 if (!enabled()) | 165 if (!enabled()) |
167 return; | 166 return; |
168 m_session->changeInstrumentationCounter(-1); | |
169 | 167 |
170 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::Dict
ionaryValue::create()); | 168 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::Dict
ionaryValue::create()); |
171 m_state->setNumber(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImp
l::DontPauseOnExceptions); | 169 m_state->setNumber(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImp
l::DontPauseOnExceptions); |
172 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, 0); | 170 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, 0); |
173 | 171 |
174 if (!m_pausedContext.IsEmpty()) | 172 if (!m_pausedContext.IsEmpty()) |
175 debugger().continueProgram(); | 173 debugger().continueProgram(); |
176 debugger().debuggerAgentDisabled(); | 174 debugger().debuggerAgentDisabled(); |
177 m_pausedContext.Reset(); | 175 m_pausedContext.Reset(); |
178 JavaScriptCallFrames emptyCallFrames; | 176 JavaScriptCallFrames emptyCallFrames; |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 { | 1214 { |
1217 if (!enabled()) | 1215 if (!enabled()) |
1218 return; | 1216 return; |
1219 m_scheduledDebuggerStep = NoStep; | 1217 m_scheduledDebuggerStep = NoStep; |
1220 m_scripts.clear(); | 1218 m_scripts.clear(); |
1221 m_blackboxedPositions.clear(); | 1219 m_blackboxedPositions.clear(); |
1222 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1220 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1223 } | 1221 } |
1224 | 1222 |
1225 } // namespace blink | 1223 } // namespace blink |
OLD | NEW |