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/Parser.h" | 7 #include "platform/inspector_protocol/Parser.h" |
8 #include "platform/inspector_protocol/String16.h" | 8 #include "platform/inspector_protocol/String16.h" |
9 #include "platform/inspector_protocol/Values.h" | 9 #include "platform/inspector_protocol/Values.h" |
10 #include "platform/v8_inspector/InjectedScript.h" | 10 #include "platform/v8_inspector/InjectedScript.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 const std::vector<String16>& ids = debuggerBreakpointIdsIterator->second; | 369 const std::vector<String16>& ids = debuggerBreakpointIdsIterator->second; |
370 for (size_t i = 0; i < ids.size(); ++i) { | 370 for (size_t i = 0; i < ids.size(); ++i) { |
371 const String16& debuggerBreakpointId = ids[i]; | 371 const String16& debuggerBreakpointId = ids[i]; |
372 | 372 |
373 m_debugger->removeBreakpoint(debuggerBreakpointId); | 373 m_debugger->removeBreakpoint(debuggerBreakpointId); |
374 m_serverBreakpoints.erase(debuggerBreakpointId); | 374 m_serverBreakpoints.erase(debuggerBreakpointId); |
375 } | 375 } |
376 m_breakpointIdToDebuggerBreakpointIds.erase(breakpointId); | 376 m_breakpointIdToDebuggerBreakpointIds.erase(breakpointId); |
377 } | 377 } |
378 | 378 |
379 void V8DebuggerAgentImpl::continueToLocation(ErrorString* errorString, | 379 void V8DebuggerAgentImpl::continueToLocation(ErrorString* errorString, std::uniq
ue_ptr<protocol::Debugger::Location> location) |
380 std::unique_ptr<protocol::Debugger::Location> location, | |
381 const protocol::Maybe<bool>& interstateLocationOpt) | |
382 { | 380 { |
383 if (!checkEnabled(errorString)) | 381 if (!checkEnabled(errorString)) |
384 return; | 382 return; |
385 if (!m_continueToLocationBreakpointId.isEmpty()) { | 383 if (!m_continueToLocationBreakpointId.isEmpty()) { |
386 m_debugger->removeBreakpoint(m_continueToLocationBreakpointId); | 384 m_debugger->removeBreakpoint(m_continueToLocationBreakpointId); |
387 m_continueToLocationBreakpointId = ""; | 385 m_continueToLocationBreakpointId = ""; |
388 } | 386 } |
389 | 387 |
390 String16 scriptId; | 388 String16 scriptId; |
391 int lineNumber; | 389 int lineNumber; |
392 int columnNumber; | 390 int columnNumber; |
393 | 391 |
394 if (!parseLocation(errorString, std::move(location), &scriptId, &lineNumber,
&columnNumber)) | 392 if (!parseLocation(errorString, std::move(location), &scriptId, &lineNumber,
&columnNumber)) |
395 return; | 393 return; |
396 | 394 |
397 ScriptBreakpoint breakpoint(lineNumber, columnNumber, ""); | 395 ScriptBreakpoint breakpoint(lineNumber, columnNumber, ""); |
398 m_continueToLocationBreakpointId = m_debugger->setBreakpoint(scriptId, break
point, &lineNumber, &columnNumber, interstateLocationOpt.fromMaybe(false)); | 396 m_continueToLocationBreakpointId = m_debugger->setBreakpoint(scriptId, break
point, &lineNumber, &columnNumber); |
399 resume(errorString); | 397 resume(errorString); |
400 } | 398 } |
401 | 399 |
402 void V8DebuggerAgentImpl::getBacktrace(ErrorString* errorString, std::unique_ptr
<Array<CallFrame>>* callFrames, Maybe<StackTrace>* asyncStackTrace) | 400 void V8DebuggerAgentImpl::getBacktrace(ErrorString* errorString, std::unique_ptr
<Array<CallFrame>>* callFrames, Maybe<StackTrace>* asyncStackTrace) |
403 { | 401 { |
404 if (!assertPaused(errorString)) | 402 if (!assertPaused(errorString)) |
405 return; | 403 return; |
406 JavaScriptCallFrames frames = m_debugger->currentCallFrames(); | 404 JavaScriptCallFrames frames = m_debugger->currentCallFrames(); |
407 m_pausedCallFrames.swap(frames); | 405 m_pausedCallFrames.swap(frames); |
408 *callFrames = currentCallFrames(errorString); | 406 *callFrames = currentCallFrames(errorString); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 CHECK(!breakpointId.isEmpty()); | 493 CHECK(!breakpointId.isEmpty()); |
496 CHECK(!scriptId.isEmpty()); | 494 CHECK(!scriptId.isEmpty()); |
497 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); | 495 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); |
498 if (scriptIterator == m_scripts.end()) | 496 if (scriptIterator == m_scripts.end()) |
499 return nullptr; | 497 return nullptr; |
500 if (breakpoint.lineNumber < scriptIterator->second->startLine() || scriptIte
rator->second->endLine() < breakpoint.lineNumber) | 498 if (breakpoint.lineNumber < scriptIterator->second->startLine() || scriptIte
rator->second->endLine() < breakpoint.lineNumber) |
501 return nullptr; | 499 return nullptr; |
502 | 500 |
503 int actualLineNumber; | 501 int actualLineNumber; |
504 int actualColumnNumber; | 502 int actualColumnNumber; |
505 String16 debuggerBreakpointId = m_debugger->setBreakpoint(scriptId, breakpoi
nt, &actualLineNumber, &actualColumnNumber, false); | 503 String16 debuggerBreakpointId = m_debugger->setBreakpoint(scriptId, breakpoi
nt, &actualLineNumber, &actualColumnNumber); |
506 if (debuggerBreakpointId.isEmpty()) | 504 if (debuggerBreakpointId.isEmpty()) |
507 return nullptr; | 505 return nullptr; |
508 | 506 |
509 m_serverBreakpoints[debuggerBreakpointId] = std::make_pair(breakpointId, sou
rce); | 507 m_serverBreakpoints[debuggerBreakpointId] = std::make_pair(breakpointId, sou
rce); |
510 CHECK(!breakpointId.isEmpty()); | 508 CHECK(!breakpointId.isEmpty()); |
511 | 509 |
512 m_breakpointIdToDebuggerBreakpointIds[breakpointId].push_back(debuggerBreakp
ointId); | 510 m_breakpointIdToDebuggerBreakpointIds[breakpointId].push_back(debuggerBreakp
ointId); |
513 return buildProtocolLocation(scriptId, actualLineNumber, actualColumnNumber)
; | 511 return buildProtocolLocation(scriptId, actualLineNumber, actualColumnNumber)
; |
514 } | 512 } |
515 | 513 |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 { | 1193 { |
1196 if (!enabled()) | 1194 if (!enabled()) |
1197 return; | 1195 return; |
1198 m_scheduledDebuggerStep = NoStep; | 1196 m_scheduledDebuggerStep = NoStep; |
1199 m_scripts.clear(); | 1197 m_scripts.clear(); |
1200 m_blackboxedPositions.clear(); | 1198 m_blackboxedPositions.clear(); |
1201 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1199 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1202 } | 1200 } |
1203 | 1201 |
1204 } // namespace blink | 1202 } // namespace blink |
OLD | NEW |