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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 v8::Local<v8::debug::Script> script = m_script.Get(m_isolate); | 177 v8::Local<v8::debug::Script> script = m_script.Get(m_isolate); |
178 return script->GetPossibleBreakpoints(start, end, locations); | 178 return script->GetPossibleBreakpoints(start, end, locations); |
179 } | 179 } |
180 | 180 |
181 void resetBlackboxedStateCache() override { | 181 void resetBlackboxedStateCache() override { |
182 v8::HandleScope scope(m_isolate); | 182 v8::HandleScope scope(m_isolate); |
183 v8::debug::ResetBlackboxedStateCache(m_isolate, m_script.Get(m_isolate)); | 183 v8::debug::ResetBlackboxedStateCache(m_isolate, m_script.Get(m_isolate)); |
184 } | 184 } |
185 | 185 |
186 private: | 186 private: |
| 187 v8::Local<v8::debug::Script> script() override { |
| 188 return m_script.Get(m_isolate); |
| 189 } |
| 190 |
187 String16 GetNameOrSourceUrl(v8::Local<v8::debug::Script> script) { | 191 String16 GetNameOrSourceUrl(v8::Local<v8::debug::Script> script) { |
188 v8::Local<v8::String> name; | 192 v8::Local<v8::String> name; |
189 if (script->Name().ToLocal(&name) || script->SourceURL().ToLocal(&name)) | 193 if (script->Name().ToLocal(&name) || script->SourceURL().ToLocal(&name)) |
190 return toProtocolString(name); | 194 return toProtocolString(name); |
191 return String16(); | 195 return String16(); |
192 } | 196 } |
193 | 197 |
194 String16 m_sourceMappingURL; | 198 String16 m_sourceMappingURL; |
195 v8::Global<v8::String> m_sourceObj; | 199 v8::Global<v8::String> m_sourceObj; |
196 bool m_isLiveEdit = false; | 200 bool m_isLiveEdit = false; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 for (v8::debug::Location& loc : *locations) { | 256 for (v8::debug::Location& loc : *locations) { |
253 TranslateV8LocationToProtocolLocation(m_wasmTranslation, &loc, v8ScriptId, | 257 TranslateV8LocationToProtocolLocation(m_wasmTranslation, &loc, v8ScriptId, |
254 scriptId()); | 258 scriptId()); |
255 } | 259 } |
256 return success; | 260 return success; |
257 } | 261 } |
258 | 262 |
259 void resetBlackboxedStateCache() override {} | 263 void resetBlackboxedStateCache() override {} |
260 | 264 |
261 private: | 265 private: |
| 266 v8::Local<v8::debug::Script> script() override { |
| 267 return m_script.Get(m_isolate); |
| 268 } |
| 269 |
262 static const String16& emptyString() { | 270 static const String16& emptyString() { |
263 static const String16 singleEmptyString; | 271 static const String16 singleEmptyString; |
264 return singleEmptyString; | 272 return singleEmptyString; |
265 } | 273 } |
266 | 274 |
267 v8::Global<v8::debug::WasmScript> m_script; | 275 v8::Global<v8::debug::WasmScript> m_script; |
268 WasmTranslation* m_wasmTranslation; | 276 WasmTranslation* m_wasmTranslation; |
269 }; | 277 }; |
270 | 278 |
271 } // namespace | 279 } // namespace |
(...skipping 27 matching lines...) Expand all Loading... |
299 const String16& V8DebuggerScript::hash(v8::Isolate* isolate) const { | 307 const String16& V8DebuggerScript::hash(v8::Isolate* isolate) const { |
300 if (m_hash.isEmpty()) m_hash = calculateHash(source(isolate)); | 308 if (m_hash.isEmpty()) m_hash = calculateHash(source(isolate)); |
301 DCHECK(!m_hash.isEmpty()); | 309 DCHECK(!m_hash.isEmpty()); |
302 return m_hash; | 310 return m_hash; |
303 } | 311 } |
304 | 312 |
305 void V8DebuggerScript::setSourceURL(const String16& sourceURL) { | 313 void V8DebuggerScript::setSourceURL(const String16& sourceURL) { |
306 m_sourceURL = sourceURL; | 314 m_sourceURL = sourceURL; |
307 } | 315 } |
308 | 316 |
| 317 v8::debug::Location V8DebuggerScript::setBreakpoint( |
| 318 const v8::debug::Location& location, |
| 319 v8::Local<v8::debug::BreakPoint> breakPoint) { |
| 320 return script()->SetBreakPoint(location, breakPoint); |
| 321 } |
| 322 |
309 } // namespace v8_inspector | 323 } // namespace v8_inspector |
OLD | NEW |