| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/inspector/v8-debugger-script.h" | 5 #include "src/inspector/v8-debugger-script.h" |
| 6 | 6 |
| 7 #include "src/inspector/inspected-context.h" | 7 #include "src/inspector/inspected-context.h" |
| 8 #include "src/inspector/string-util.h" | 8 #include "src/inspector/string-util.h" |
| 9 #include "src/inspector/wasm-translation.h" | 9 #include "src/inspector/wasm-translation.h" |
| 10 | 10 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 return m_sourceMappingURL; | 153 return m_sourceMappingURL; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void setSourceMappingURL(const String16& sourceMappingURL) override { | 156 void setSourceMappingURL(const String16& sourceMappingURL) override { |
| 157 m_sourceMappingURL = sourceMappingURL; | 157 m_sourceMappingURL = sourceMappingURL; |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool getPossibleBreakpoints( | 160 bool getPossibleBreakpoints( |
| 161 const v8::debug::Location& start, const v8::debug::Location& end, | 161 const v8::debug::Location& start, const v8::debug::Location& end, |
| 162 bool restrictToFunction, | 162 bool restrictToFunction, |
| 163 std::vector<v8::debug::Location>* locations) override { | 163 std::vector<v8::debug::BreakLocation>* locations) override { |
| 164 v8::HandleScope scope(m_isolate); | 164 v8::HandleScope scope(m_isolate); |
| 165 v8::Local<v8::debug::Script> script = m_script.Get(m_isolate); | 165 v8::Local<v8::debug::Script> script = m_script.Get(m_isolate); |
| 166 return script->GetPossibleBreakpoints(start, end, restrictToFunction, | 166 return script->GetPossibleBreakpoints(start, end, restrictToFunction, |
| 167 locations); | 167 locations); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void resetBlackboxedStateCache() override { | 170 void resetBlackboxedStateCache() override { |
| 171 v8::HandleScope scope(m_isolate); | 171 v8::HandleScope scope(m_isolate); |
| 172 v8::debug::ResetBlackboxedStateCache(m_isolate, m_script.Get(m_isolate)); | 172 v8::debug::ResetBlackboxedStateCache(m_isolate, m_script.Get(m_isolate)); |
| 173 } | 173 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 | 222 |
| 223 const String16& sourceMappingURL() const override { return emptyString(); } | 223 const String16& sourceMappingURL() const override { return emptyString(); } |
| 224 bool isLiveEdit() const override { return false; } | 224 bool isLiveEdit() const override { return false; } |
| 225 bool isModule() const override { return false; } | 225 bool isModule() const override { return false; } |
| 226 void setSourceMappingURL(const String16&) override {} | 226 void setSourceMappingURL(const String16&) override {} |
| 227 | 227 |
| 228 bool getPossibleBreakpoints( | 228 bool getPossibleBreakpoints( |
| 229 const v8::debug::Location& start, const v8::debug::Location& end, | 229 const v8::debug::Location& start, const v8::debug::Location& end, |
| 230 bool restrictToFunction, | 230 bool restrictToFunction, |
| 231 std::vector<v8::debug::Location>* locations) override { | 231 std::vector<v8::debug::BreakLocation>* locations) override { |
| 232 v8::HandleScope scope(m_isolate); | 232 v8::HandleScope scope(m_isolate); |
| 233 v8::Local<v8::debug::Script> script = m_script.Get(m_isolate); | 233 v8::Local<v8::debug::Script> script = m_script.Get(m_isolate); |
| 234 String16 v8ScriptId = String16::fromInteger(script->Id()); | 234 String16 v8ScriptId = String16::fromInteger(script->Id()); |
| 235 | 235 |
| 236 v8::debug::Location translatedStart = start; | 236 v8::debug::Location translatedStart = start; |
| 237 TranslateProtocolLocationToV8Location(m_wasmTranslation, &translatedStart, | 237 TranslateProtocolLocationToV8Location(m_wasmTranslation, &translatedStart, |
| 238 scriptId(), v8ScriptId); | 238 scriptId(), v8ScriptId); |
| 239 | 239 |
| 240 v8::debug::Location translatedEnd = end; | 240 v8::debug::Location translatedEnd = end; |
| 241 if (translatedEnd.IsEmpty()) { | 241 if (translatedEnd.IsEmpty()) { |
| 242 // Stop before the start of the next function. | 242 // Stop before the start of the next function. |
| 243 translatedEnd = | 243 translatedEnd = |
| 244 v8::debug::Location(translatedStart.GetLineNumber() + 1, 0); | 244 v8::debug::Location(translatedStart.GetLineNumber() + 1, 0); |
| 245 } else { | 245 } else { |
| 246 TranslateProtocolLocationToV8Location(m_wasmTranslation, &translatedEnd, | 246 TranslateProtocolLocationToV8Location(m_wasmTranslation, &translatedEnd, |
| 247 scriptId(), v8ScriptId); | 247 scriptId(), v8ScriptId); |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool success = script->GetPossibleBreakpoints( | 250 bool success = script->GetPossibleBreakpoints( |
| 251 translatedStart, translatedEnd, restrictToFunction, locations); | 251 translatedStart, translatedEnd, restrictToFunction, locations); |
| 252 for (v8::debug::Location& loc : *locations) { | 252 for (v8::debug::BreakLocation& loc : *locations) { |
| 253 TranslateV8LocationToProtocolLocation(m_wasmTranslation, &loc, v8ScriptId, | 253 TranslateV8LocationToProtocolLocation( |
| 254 scriptId()); | 254 m_wasmTranslation, &loc.GetLocation(), v8ScriptId, scriptId()); |
| 255 } | 255 } |
| 256 return success; | 256 return success; |
| 257 } | 257 } |
| 258 | 258 |
| 259 void resetBlackboxedStateCache() override {} | 259 void resetBlackboxedStateCache() override {} |
| 260 | 260 |
| 261 int offset(int lineNumber, int columnNumber) const override { | 261 int offset(int lineNumber, int columnNumber) const override { |
| 262 return kNoOffset; | 262 return kNoOffset; |
| 263 } | 263 } |
| 264 | 264 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 if (m_hash.isEmpty()) m_hash = calculateHash(source()); | 308 if (m_hash.isEmpty()) m_hash = calculateHash(source()); |
| 309 DCHECK(!m_hash.isEmpty()); | 309 DCHECK(!m_hash.isEmpty()); |
| 310 return m_hash; | 310 return m_hash; |
| 311 } | 311 } |
| 312 | 312 |
| 313 void V8DebuggerScript::setSourceURL(const String16& sourceURL) { | 313 void V8DebuggerScript::setSourceURL(const String16& sourceURL) { |
| 314 m_sourceURL = sourceURL; | 314 m_sourceURL = sourceURL; |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace v8_inspector | 317 } // namespace v8_inspector |
| OLD | NEW |