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

Unified Diff: src/api.cc

Issue 2671193002: [inspector] restore provisional breakpoints smarter (Closed)
Patch Set: offset based approach 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 beefd61bdb6b9de9208436545dc347dff34b2cc9..5fc9b37cd3d22d617d5704591ea2d4f714b3356e 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -9257,12 +9257,12 @@ 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 start_offset = Offset(start);
int end_offset;
if (end.IsEmpty()) {
end_offset = GetSmiValue(line_ends, line_ends->length() - 1) + 1;
} else {
- end_offset = GetSourcePosition(end);
+ end_offset = Offset(end);
}
if (start_offset >= end_offset) return true;
@@ -9292,7 +9292,7 @@ bool debug::Script::GetPossibleBreakpoints(
return true;
}
-int debug::Script::GetSourcePosition(const debug::Location& location) const {
+int debug::Script::Offset(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 +9318,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::Position(int offset) const {
Yang 2017/02/27 13:07:45 Can we call these two functions GetSourceOffset an
kozy 2017/02/27 20:43:24 Done.
+ 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