OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project 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 "src/inspector/v8-debugger-agent-impl.h" | 5 #include "src/inspector/v8-debugger-agent-impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/debug/debug-interface.h" | 9 #include "src/debug/debug-interface.h" |
10 #include "src/inspector/injected-script.h" | 10 #include "src/inspector/injected-script.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 Response V8DebuggerAgentImpl::getPossibleBreakpoints( | 378 Response V8DebuggerAgentImpl::getPossibleBreakpoints( |
379 std::unique_ptr<protocol::Debugger::Location> start, | 379 std::unique_ptr<protocol::Debugger::Location> start, |
380 Maybe<protocol::Debugger::Location> end, | 380 Maybe<protocol::Debugger::Location> end, |
381 std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* locations) { | 381 std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* locations) { |
382 String16 scriptId = start->getScriptId(); | 382 String16 scriptId = start->getScriptId(); |
383 | 383 |
384 if (start->getLineNumber() < 0 || start->getColumnNumber(0) < 0) | 384 if (start->getLineNumber() < 0 || start->getColumnNumber(0) < 0) |
385 return Response::Error( | 385 return Response::Error( |
386 "start.lineNumber and start.columnNumber should be >= 0"); | 386 "start.lineNumber and start.columnNumber should be >= 0"); |
387 | 387 |
388 v8::DebugInterface::Location v8Start(start->getLineNumber(), | 388 v8::debug::Location v8Start(start->getLineNumber(), |
389 start->getColumnNumber(0)); | 389 start->getColumnNumber(0)); |
390 v8::DebugInterface::Location v8End; | 390 v8::debug::Location v8End; |
391 if (end.isJust()) { | 391 if (end.isJust()) { |
392 if (end.fromJust()->getScriptId() != scriptId) | 392 if (end.fromJust()->getScriptId() != scriptId) |
393 return Response::Error("Locations should contain the same scriptId"); | 393 return Response::Error("Locations should contain the same scriptId"); |
394 int line = end.fromJust()->getLineNumber(); | 394 int line = end.fromJust()->getLineNumber(); |
395 int column = end.fromJust()->getColumnNumber(0); | 395 int column = end.fromJust()->getColumnNumber(0); |
396 if (line < 0 || column < 0) | 396 if (line < 0 || column < 0) |
397 return Response::Error( | 397 return Response::Error( |
398 "end.lineNumber and end.columnNumber should be >= 0"); | 398 "end.lineNumber and end.columnNumber should be >= 0"); |
399 v8End = v8::DebugInterface::Location(line, column); | 399 v8End = v8::debug::Location(line, column); |
400 } | 400 } |
401 auto it = m_scripts.find(scriptId); | 401 auto it = m_scripts.find(scriptId); |
402 if (it == m_scripts.end()) return Response::Error("Script not found"); | 402 if (it == m_scripts.end()) return Response::Error("Script not found"); |
403 | 403 |
404 std::vector<v8::DebugInterface::Location> v8Locations; | 404 std::vector<v8::debug::Location> v8Locations; |
405 if (!it->second->getPossibleBreakpoints(v8Start, v8End, &v8Locations)) | 405 if (!it->second->getPossibleBreakpoints(v8Start, v8End, &v8Locations)) |
406 return Response::InternalError(); | 406 return Response::InternalError(); |
407 | 407 |
408 *locations = protocol::Array<protocol::Debugger::Location>::create(); | 408 *locations = protocol::Array<protocol::Debugger::Location>::create(); |
409 for (size_t i = 0; i < v8Locations.size(); ++i) { | 409 for (size_t i = 0; i < v8Locations.size(); ++i) { |
410 (*locations) | 410 (*locations) |
411 ->addItem(protocol::Debugger::Location::create() | 411 ->addItem(protocol::Debugger::Location::create() |
412 .setScriptId(scriptId) | 412 .setScriptId(scriptId) |
413 .setLineNumber(v8Locations[i].GetLineNumber()) | 413 .setLineNumber(v8Locations[i].GetLineNumber()) |
414 .setColumnNumber(v8Locations[i].GetColumnNumber()) | 414 .setColumnNumber(v8Locations[i].GetColumnNumber()) |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 | 1266 |
1267 void V8DebuggerAgentImpl::reset() { | 1267 void V8DebuggerAgentImpl::reset() { |
1268 if (!enabled()) return; | 1268 if (!enabled()) return; |
1269 m_scheduledDebuggerStep = NoStep; | 1269 m_scheduledDebuggerStep = NoStep; |
1270 m_scripts.clear(); | 1270 m_scripts.clear(); |
1271 m_blackboxedPositions.clear(); | 1271 m_blackboxedPositions.clear(); |
1272 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1272 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1273 } | 1273 } |
1274 | 1274 |
1275 } // namespace v8_inspector | 1275 } // namespace v8_inspector |
OLD | NEW |