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

Unified Diff: src/api.cc

Issue 2671193002: [inspector] restore provisional breakpoints smarter (Closed)
Patch Set: addressed comments Created 3 years, 10 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 | « no previous file | src/debug/debug-interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 16dad1d2a6dbeaa182c3637faed7690b6ca48a74..13b6e7b42486bf5963175b678746b4d22ae99efe 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -9257,13 +9257,10 @@ bool debug::Script::GetPossibleBreakpoints(
i::Handle<i::FixedArray>::cast(i::handle(script->line_ends(), isolate));
CHECK(line_ends->length());
- int start_offset = GetSourcePosition(start);
- int end_offset;
- if (end.IsEmpty()) {
- end_offset = GetSmiValue(line_ends, line_ends->length() - 1) + 1;
- } else {
- end_offset = GetSourcePosition(end);
- }
+ int start_offset = GetSourceOffset(start);
+ int end_offset = end.IsEmpty()
+ ? GetSmiValue(line_ends, line_ends->length() - 1) + 1
+ : GetSourceOffset(end);
if (start_offset >= end_offset) return true;
std::set<int> offsets;
@@ -9292,7 +9289,7 @@ bool debug::Script::GetPossibleBreakpoints(
return true;
}
-int debug::Script::GetSourcePosition(const debug::Location& location) const {
+int debug::Script::GetSourceOffset(const debug::Location& location) const {
i::Handle<i::Script> script = Utils::OpenHandle(this);
if (script->type() == i::Script::TYPE_WASM) {
// TODO(clemensh): Return the proper thing for wasm.
@@ -9318,6 +9315,17 @@ int debug::Script::GetSourcePosition(const debug::Location& location) const {
return std::min(prev_line_offset + column + 1, line_offset);
}
+v8::debug::Location debug::Script::GetSourceLocation(int offset) const {
+ i::Handle<i::Script> script = Utils::OpenHandle(this);
+ if (script->type() == i::Script::TYPE_WASM) {
+ // TODO(clemensh): Return the proper thing for wasm.
+ return v8::debug::Location();
+ }
+ i::Script::PositionInfo info;
+ i::Script::GetPositionInfo(script, offset, &info, i::Script::WITH_OFFSET);
+ return debug::Location(info.line, info.column);
+}
+
debug::WasmScript* debug::WasmScript::Cast(debug::Script* script) {
CHECK(script->IsWasm());
return static_cast<WasmScript*>(script);
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698