| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // FIXME(WK44513): breakpoints activated flag should be synchronized between
all front-ends | 203 // FIXME(WK44513): breakpoints activated flag should be synchronized between
all front-ends |
| 204 debugger().setBreakpointsActivated(true); | 204 debugger().setBreakpointsActivated(true); |
| 205 m_session->changeInstrumentationCounter(+1); | 205 m_session->changeInstrumentationCounter(+1); |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool V8DebuggerAgentImpl::enabled() | 208 bool V8DebuggerAgentImpl::enabled() |
| 209 { | 209 { |
| 210 return m_enabled; | 210 return m_enabled; |
| 211 } | 211 } |
| 212 | 212 |
| 213 void V8DebuggerAgentImpl::enable(ErrorString*) | 213 void V8DebuggerAgentImpl::enable(ErrorString* errorString) |
| 214 { | 214 { |
| 215 if (enabled()) | 215 if (enabled()) |
| 216 return; | 216 return; |
| 217 | 217 |
| 218 if (!m_session->client()->canExecuteScripts()) { |
| 219 *errorString = "Script execution is prohibited"; |
| 220 return; |
| 221 } |
| 222 |
| 218 enable(); | 223 enable(); |
| 219 | |
| 220 ASSERT(m_frontend); | 224 ASSERT(m_frontend); |
| 221 } | 225 } |
| 222 | 226 |
| 223 void V8DebuggerAgentImpl::disable(ErrorString*) | 227 void V8DebuggerAgentImpl::disable(ErrorString*) |
| 224 { | 228 { |
| 225 if (!enabled()) | 229 if (!enabled()) |
| 226 return; | 230 return; |
| 227 m_session->changeInstrumentationCounter(-1); | 231 m_session->changeInstrumentationCounter(-1); |
| 228 | 232 |
| 229 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::Dict
ionaryValue::create()); | 233 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::Dict
ionaryValue::create()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 { | 278 { |
| 275 ErrorString error; | 279 ErrorString error; |
| 276 disable(&error); | 280 disable(&error); |
| 277 ASSERT(m_frontend); | 281 ASSERT(m_frontend); |
| 278 m_frontend = nullptr; | 282 m_frontend = nullptr; |
| 279 } | 283 } |
| 280 | 284 |
| 281 void V8DebuggerAgentImpl::restore() | 285 void V8DebuggerAgentImpl::restore() |
| 282 { | 286 { |
| 283 ASSERT(!m_enabled); | 287 ASSERT(!m_enabled); |
| 288 if (!m_session->client()->canExecuteScripts()) |
| 289 return; |
| 290 |
| 284 enable(); | 291 enable(); |
| 285 ErrorString error; | 292 ErrorString error; |
| 286 | 293 |
| 287 int pauseState = V8DebuggerImpl::DontPauseOnExceptions; | 294 int pauseState = V8DebuggerImpl::DontPauseOnExceptions; |
| 288 m_state->getNumber(DebuggerAgentState::pauseOnExceptionsState, &pauseState); | 295 m_state->getNumber(DebuggerAgentState::pauseOnExceptionsState, &pauseState); |
| 289 setPauseOnExceptionsImpl(&error, pauseState); | 296 setPauseOnExceptionsImpl(&error, pauseState); |
| 290 ASSERT(error.isEmpty()); | 297 ASSERT(error.isEmpty()); |
| 291 | 298 |
| 292 m_skipAllPauses = m_state->booleanProperty(DebuggerAgentState::skipAllPauses
, false); | 299 m_skipAllPauses = m_state->booleanProperty(DebuggerAgentState::skipAllPauses
, false); |
| 293 | 300 |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 if (!enabled()) | 1454 if (!enabled()) |
| 1448 return; | 1455 return; |
| 1449 m_scheduledDebuggerStep = NoStep; | 1456 m_scheduledDebuggerStep = NoStep; |
| 1450 m_scripts.clear(); | 1457 m_scripts.clear(); |
| 1451 m_blackboxedPositions.clear(); | 1458 m_blackboxedPositions.clear(); |
| 1452 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1459 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1453 allAsyncTasksCanceled(); | 1460 allAsyncTasksCanceled(); |
| 1454 } | 1461 } |
| 1455 | 1462 |
| 1456 } // namespace blink | 1463 } // namespace blink |
| OLD | NEW |