Index: src/inspector/v8-debugger-script.cc |
diff --git a/src/inspector/v8-debugger-script.cc b/src/inspector/v8-debugger-script.cc |
index 200cdc71a26da41ae8bba76d30144ad5a2eca0f7..559347c55a9c5a23bdf1934889a65329c8cdd389 100644 |
--- a/src/inspector/v8-debugger-script.cc |
+++ b/src/inspector/v8-debugger-script.cc |
@@ -133,10 +133,9 @@ class ActualScript : public V8DebuggerScript { |
} |
if (script->Source().ToLocal(&tmp)) { |
- m_sourceObj.Reset(m_isolate, tmp); |
- String16 source = toProtocolString(tmp); |
+ m_source = toProtocolString(tmp); |
// V8 will not count last line if script source ends with \n. |
- if (source.length() > 1 && source[source.length() - 1] == '\n') { |
+ if (m_source.length() > 1 && m_source[m_source.length() - 1] == '\n') { |
m_endLine++; |
m_endColumn = 0; |
} |
@@ -154,22 +153,10 @@ class ActualScript : public V8DebuggerScript { |
return m_sourceMappingURL; |
} |
- String16 source(v8::Isolate* isolate) const override { |
- if (!m_sourceObj.IsEmpty()) |
- return toProtocolString(m_sourceObj.Get(isolate)); |
- return V8DebuggerScript::source(isolate); |
- } |
- |
void setSourceMappingURL(const String16& sourceMappingURL) override { |
m_sourceMappingURL = sourceMappingURL; |
} |
- void setSource(v8::Local<v8::String> source) override { |
- m_source = String16(); |
- m_sourceObj.Reset(m_isolate, source); |
- m_hash = String16(); |
- } |
- |
bool getPossibleBreakpoints( |
const v8::debug::Location& start, const v8::debug::Location& end, |
std::vector<v8::debug::Location>* locations) override { |
@@ -183,6 +170,17 @@ class ActualScript : public V8DebuggerScript { |
v8::debug::ResetBlackboxedStateCache(m_isolate, m_script.Get(m_isolate)); |
} |
+ int offset(int lineNumber, int columnNumber) const override { |
+ v8::HandleScope scope(m_isolate); |
+ return m_script.Get(m_isolate)->Offset( |
+ v8::debug::Location(lineNumber, columnNumber)); |
+ } |
+ |
+ v8::debug::Location position(int offset) const override { |
+ v8::HandleScope scope(m_isolate); |
+ return m_script.Get(m_isolate)->Position(offset); |
+ } |
+ |
private: |
String16 GetNameOrSourceUrl(v8::Local<v8::debug::Script> script) { |
v8::Local<v8::String> name; |
@@ -192,7 +190,6 @@ class ActualScript : public V8DebuggerScript { |
} |
String16 m_sourceMappingURL; |
- v8::Global<v8::String> m_sourceObj; |
bool m_isLiveEdit = false; |
bool m_isModule = false; |
v8::Global<v8::debug::Script> m_script; |
@@ -258,6 +255,14 @@ class WasmVirtualScript : public V8DebuggerScript { |
void resetBlackboxedStateCache() override {} |
+ int offset(int lineNumber, int columnNumber) const override { |
+ return kNoOffset; |
+ } |
+ |
+ v8::debug::Location position(int offset) const override { |
+ return v8::debug::Location(); |
+ } |
+ |
private: |
static const String16& emptyString() { |
static const String16 singleEmptyString; |
@@ -296,8 +301,8 @@ const String16& V8DebuggerScript::sourceURL() const { |
return m_sourceURL.isEmpty() ? m_url : m_sourceURL; |
} |
-const String16& V8DebuggerScript::hash(v8::Isolate* isolate) const { |
- if (m_hash.isEmpty()) m_hash = calculateHash(source(isolate)); |
+const String16& V8DebuggerScript::hash() const { |
+ if (m_hash.isEmpty()) m_hash = calculateHash(source()); |
DCHECK(!m_hash.isEmpty()); |
return m_hash; |
} |