| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 | 166 |
| 167 void setSource(v8::Local<v8::String> source) override { | 167 void setSource(v8::Local<v8::String> source) override { |
| 168 m_source = String16(); | 168 m_source = String16(); |
| 169 m_sourceObj.Reset(m_isolate, source); | 169 m_sourceObj.Reset(m_isolate, source); |
| 170 m_hash = String16(); | 170 m_hash = String16(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool getPossibleBreakpoints( | 173 bool getPossibleBreakpoints( |
| 174 const v8::debug::Location& start, const v8::debug::Location& end, | 174 const v8::debug::Location& start, const v8::debug::Location& end, |
| 175 bool restrictToFunction, |
| 175 std::vector<v8::debug::Location>* locations) override { | 176 std::vector<v8::debug::Location>* locations) override { |
| 176 v8::HandleScope scope(m_isolate); | 177 v8::HandleScope scope(m_isolate); |
| 177 v8::Local<v8::debug::Script> script = m_script.Get(m_isolate); | 178 v8::Local<v8::debug::Script> script = m_script.Get(m_isolate); |
| 178 return script->GetPossibleBreakpoints(start, end, locations); | 179 return script->GetPossibleBreakpoints(start, end, restrictToFunction, |
| 180 locations); |
| 179 } | 181 } |
| 180 | 182 |
| 181 void resetBlackboxedStateCache() override { | 183 void resetBlackboxedStateCache() override { |
| 182 v8::HandleScope scope(m_isolate); | 184 v8::HandleScope scope(m_isolate); |
| 183 v8::debug::ResetBlackboxedStateCache(m_isolate, m_script.Get(m_isolate)); | 185 v8::debug::ResetBlackboxedStateCache(m_isolate, m_script.Get(m_isolate)); |
| 184 } | 186 } |
| 185 | 187 |
| 186 private: | 188 private: |
| 187 String16 GetNameOrSourceUrl(v8::Local<v8::debug::Script> script) { | 189 String16 GetNameOrSourceUrl(v8::Local<v8::debug::Script> script) { |
| 188 v8::Local<v8::String> name; | 190 v8::Local<v8::String> name; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 m_source = std::move(source); | 223 m_source = std::move(source); |
| 222 } | 224 } |
| 223 | 225 |
| 224 const String16& sourceMappingURL() const override { return emptyString(); } | 226 const String16& sourceMappingURL() const override { return emptyString(); } |
| 225 bool isLiveEdit() const override { return false; } | 227 bool isLiveEdit() const override { return false; } |
| 226 bool isModule() const override { return false; } | 228 bool isModule() const override { return false; } |
| 227 void setSourceMappingURL(const String16&) override {} | 229 void setSourceMappingURL(const String16&) override {} |
| 228 | 230 |
| 229 bool getPossibleBreakpoints( | 231 bool getPossibleBreakpoints( |
| 230 const v8::debug::Location& start, const v8::debug::Location& end, | 232 const v8::debug::Location& start, const v8::debug::Location& end, |
| 233 bool restrictToFunction, |
| 231 std::vector<v8::debug::Location>* locations) override { | 234 std::vector<v8::debug::Location>* locations) override { |
| 232 v8::HandleScope scope(m_isolate); | 235 v8::HandleScope scope(m_isolate); |
| 233 v8::Local<v8::debug::Script> script = m_script.Get(m_isolate); | 236 v8::Local<v8::debug::Script> script = m_script.Get(m_isolate); |
| 234 String16 v8ScriptId = String16::fromInteger(script->Id()); | 237 String16 v8ScriptId = String16::fromInteger(script->Id()); |
| 235 | 238 |
| 236 v8::debug::Location translatedStart = start; | 239 v8::debug::Location translatedStart = start; |
| 237 TranslateProtocolLocationToV8Location(m_wasmTranslation, &translatedStart, | 240 TranslateProtocolLocationToV8Location(m_wasmTranslation, &translatedStart, |
| 238 scriptId(), v8ScriptId); | 241 scriptId(), v8ScriptId); |
| 239 | 242 |
| 240 v8::debug::Location translatedEnd = end; | 243 v8::debug::Location translatedEnd = end; |
| 241 if (translatedEnd.IsEmpty()) { | 244 if (translatedEnd.IsEmpty()) { |
| 242 // Stop before the start of the next function. | 245 // Stop before the start of the next function. |
| 243 translatedEnd = | 246 translatedEnd = |
| 244 v8::debug::Location(translatedStart.GetLineNumber() + 1, 0); | 247 v8::debug::Location(translatedStart.GetLineNumber() + 1, 0); |
| 245 } else { | 248 } else { |
| 246 TranslateProtocolLocationToV8Location(m_wasmTranslation, &translatedEnd, | 249 TranslateProtocolLocationToV8Location(m_wasmTranslation, &translatedEnd, |
| 247 scriptId(), v8ScriptId); | 250 scriptId(), v8ScriptId); |
| 248 } | 251 } |
| 249 | 252 |
| 250 bool success = script->GetPossibleBreakpoints(translatedStart, | 253 bool success = script->GetPossibleBreakpoints( |
| 251 translatedEnd, locations); | 254 translatedStart, translatedEnd, restrictToFunction, locations); |
| 252 for (v8::debug::Location& loc : *locations) { | 255 for (v8::debug::Location& loc : *locations) { |
| 253 TranslateV8LocationToProtocolLocation(m_wasmTranslation, &loc, v8ScriptId, | 256 TranslateV8LocationToProtocolLocation(m_wasmTranslation, &loc, v8ScriptId, |
| 254 scriptId()); | 257 scriptId()); |
| 255 } | 258 } |
| 256 return success; | 259 return success; |
| 257 } | 260 } |
| 258 | 261 |
| 259 void resetBlackboxedStateCache() override {} | 262 void resetBlackboxedStateCache() override {} |
| 260 | 263 |
| 261 private: | 264 private: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 if (m_hash.isEmpty()) m_hash = calculateHash(source(isolate)); | 303 if (m_hash.isEmpty()) m_hash = calculateHash(source(isolate)); |
| 301 DCHECK(!m_hash.isEmpty()); | 304 DCHECK(!m_hash.isEmpty()); |
| 302 return m_hash; | 305 return m_hash; |
| 303 } | 306 } |
| 304 | 307 |
| 305 void V8DebuggerScript::setSourceURL(const String16& sourceURL) { | 308 void V8DebuggerScript::setSourceURL(const String16& sourceURL) { |
| 306 m_sourceURL = sourceURL; | 309 m_sourceURL = sourceURL; |
| 307 } | 310 } |
| 308 | 311 |
| 309 } // namespace v8_inspector | 312 } // namespace v8_inspector |
| OLD | NEW |