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

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

Issue 2728563002: [inspector] added type of break location into getPossibleBreakpoints output (Closed)
Patch Set: added DCHECK Created 3 years, 9 months 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
« no previous file with comments | « src/inspector/v8-debugger-agent-impl.h ('k') | src/inspector/v8-debugger-script.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bf7ddb46a57b6720a1da492513d808a9885c43d6..01e36eae9a36c0cad7e142247ff8a0b614e9f7bc 100644
--- a/src/inspector/v8-debugger-agent-impl.cc
+++ b/src/inspector/v8-debugger-agent-impl.cc
@@ -171,6 +171,21 @@ void adjustBreakpointLocation(const V8DebuggerScript& script,
breakpoint->line_number = hintPosition.GetLineNumber();
breakpoint->column_number = hintPosition.GetColumnNumber();
}
+
+String16 breakLocationType(v8::debug::BreakLocationType type) {
+ switch (type) {
+ case v8::debug::kCallBreakLocation:
+ return protocol::Debugger::BreakLocation::TypeEnum::Call;
+ case v8::debug::kReturnBreakLocation:
+ return protocol::Debugger::BreakLocation::TypeEnum::Return;
+ case v8::debug::kDebuggerStatementBreakLocation:
+ return protocol::Debugger::BreakLocation::TypeEnum::DebuggerStatement;
+ case v8::debug::kCommonBreakLocation:
+ return String16();
+ }
+ return String16();
+}
+
} // namespace
V8DebuggerAgentImpl::V8DebuggerAgentImpl(
@@ -420,7 +435,8 @@ void V8DebuggerAgentImpl::removeBreakpointImpl(const String16& breakpointId) {
Response V8DebuggerAgentImpl::getPossibleBreakpoints(
std::unique_ptr<protocol::Debugger::Location> start,
Maybe<protocol::Debugger::Location> end, Maybe<bool> restrictToFunction,
- std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* locations) {
+ std::unique_ptr<protocol::Array<protocol::Debugger::BreakLocation>>*
+ locations) {
String16 scriptId = start->getScriptId();
if (start->getLineNumber() < 0 || start->getColumnNumber(0) < 0)
@@ -443,19 +459,24 @@ Response V8DebuggerAgentImpl::getPossibleBreakpoints(
auto it = m_scripts.find(scriptId);
if (it == m_scripts.end()) return Response::Error("Script not found");
- std::vector<v8::debug::Location> v8Locations;
+ std::vector<v8::debug::BreakLocation> v8Locations;
if (!it->second->getPossibleBreakpoints(
- v8Start, v8End, restrictToFunction.fromMaybe(false), &v8Locations))
+ v8Start, v8End, restrictToFunction.fromMaybe(false), &v8Locations)) {
return Response::InternalError();
+ }
- *locations = protocol::Array<protocol::Debugger::Location>::create();
+ *locations = protocol::Array<protocol::Debugger::BreakLocation>::create();
for (size_t i = 0; i < v8Locations.size(); ++i) {
- (*locations)
- ->addItem(protocol::Debugger::Location::create()
- .setScriptId(scriptId)
- .setLineNumber(v8Locations[i].GetLineNumber())
- .setColumnNumber(v8Locations[i].GetColumnNumber())
- .build());
+ std::unique_ptr<protocol::Debugger::BreakLocation> breakLocation =
+ protocol::Debugger::BreakLocation::create()
+ .setScriptId(scriptId)
+ .setLineNumber(v8Locations[i].GetLineNumber())
+ .setColumnNumber(v8Locations[i].GetColumnNumber())
+ .build();
+ if (v8Locations[i].type() != v8::debug::kCommonBreakLocation) {
+ breakLocation->setType(breakLocationType(v8Locations[i].type()));
+ }
+ (*locations)->addItem(std::move(breakLocation));
}
return Response::OK();
}
« no previous file with comments | « src/inspector/v8-debugger-agent-impl.h ('k') | src/inspector/v8-debugger-script.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698