Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Unified Diff: src/inspector/v8-debugger-agent-impl.cc

Issue 2465553003: [inspector] added Debugger.getPossibleBreakpoints method (Closed)
Patch Set: it works Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/inspector/v8-debugger-agent-impl.cc
diff --git a/src/inspector/v8-debugger-agent-impl.cc b/src/inspector/v8-debugger-agent-impl.cc
index f318619b35bf2b37a0696f9af59bef791840af77..24b13f1a5e23a59f108c5aab942a3faa7cd6a4de 100644
--- a/src/inspector/v8-debugger-agent-impl.cc
+++ b/src/inspector/v8-debugger-agent-impl.cc
@@ -380,6 +380,49 @@ void V8DebuggerAgentImpl::removeBreakpoint(const String16& breakpointId) {
m_breakpointIdToDebuggerBreakpointIds.erase(breakpointId);
}
+void V8DebuggerAgentImpl::getPossibleBreakpoints(
+ ErrorString* errorString,
+ std::unique_ptr<protocol::Debugger::Location> start,
+ const Maybe<protocol::Debugger::Location>& end,
+ std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* locations) {
+ String16 scriptId = start->getScriptId();
+ int startLine = start->getLineNumber();
+ int startColumn = start->getColumnNumber(0);
+ int endLine = end.isJust() ? end.fromJust()->getLineNumber() : -1;
+ int endColumn = end.isJust() ? end.fromJust()->getColumnNumber(0) : -1;
+
+ if (end.isJust()) {
+ if (end.fromJust()->getScriptId() != scriptId) {
+ *errorString = "Locations should contain the same scriptId";
+ return;
+ }
+ }
+ auto it = m_scripts.find(scriptId);
+ if (it == m_scripts.end()) {
+ *errorString = "Script not found";
+ return;
+ }
+
+ std::vector<int> positions;
+ if (!it->second->getPossibleBreakpoints(startLine, startColumn, endLine,
+ endColumn, positions) ||
+ positions.size() % 2) {
+ *errorString = "Internal error";
+ return;
+ }
+
+ using protocol::Debugger::Location;
+ *locations = protocol::Array<Location>::create();
+ for (size_t i = 0; i < positions.size(); i += 2) {
+ (*locations)
+ ->addItem(Location::create()
+ .setScriptId(scriptId)
+ .setLineNumber(positions[i])
+ .setColumnNumber(positions[i + 1])
+ .build());
+ }
+}
+
void V8DebuggerAgentImpl::continueToLocation(
ErrorString* errorString,
std::unique_ptr<protocol::Debugger::Location> location) {
@@ -547,7 +590,7 @@ void V8DebuggerAgentImpl::setScriptSource(
return;
ScriptsMap::iterator it = m_scripts.find(scriptId);
- if (it != m_scripts.end()) it->second->setSource(m_isolate, newSource);
+ if (it != m_scripts.end()) it->second->setSource(newSource);
std::unique_ptr<Array<CallFrame>> callFrames = currentCallFrames(errorString);
if (!callFrames) return;

Powered by Google App Engine
This is Rietveld 408576698