OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 14 matching lines...) Expand all Loading... |
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #ifndef V8_INSPECTOR_V8DEBUGGERSCRIPT_H_ | 30 #ifndef V8_INSPECTOR_V8DEBUGGERSCRIPT_H_ |
31 #define V8_INSPECTOR_V8DEBUGGERSCRIPT_H_ | 31 #define V8_INSPECTOR_V8DEBUGGERSCRIPT_H_ |
32 | 32 |
33 #include "src/base/macros.h" | 33 #include "src/base/macros.h" |
34 #include "src/inspector/string-16.h" | 34 #include "src/inspector/string-16.h" |
| 35 #include "src/inspector/string-util.h" |
35 | 36 |
36 #include "include/v8.h" | 37 #include "include/v8.h" |
37 #include "src/debug/debug-interface.h" | 38 #include "src/debug/debug-interface.h" |
38 | 39 |
39 namespace v8_inspector { | 40 namespace v8_inspector { |
40 | 41 |
41 class V8DebuggerScript { | 42 class V8DebuggerScript { |
42 public: | 43 public: |
43 V8DebuggerScript(v8::Isolate* isolate, v8::Local<v8::debug::Script> script, | 44 static std::unique_ptr<V8DebuggerScript> Create( |
44 bool isLiveEdit); | 45 v8::Isolate* isolate, v8::Local<v8::debug::Script> script, |
45 V8DebuggerScript(String16 id, String16 url, String16 source); | 46 bool isLiveEdit); |
46 ~V8DebuggerScript(); | 47 static std::unique_ptr<V8DebuggerScript> CreateWasm( |
| 48 v8::Isolate* isolate, v8::Local<v8::debug::WasmScript> underlyingScript, |
| 49 String16 id, String16 url, String16 source); |
| 50 |
| 51 virtual ~V8DebuggerScript(); |
47 | 52 |
48 const String16& scriptId() const { return m_id; } | 53 const String16& scriptId() const { return m_id; } |
49 const String16& url() const { return m_url; } | 54 const String16& url() const { return m_url; } |
50 bool hasSourceURL() const { return !m_sourceURL.isEmpty(); } | 55 bool hasSourceURL() const { return !m_sourceURL.isEmpty(); } |
51 const String16& sourceURL() const; | 56 const String16& sourceURL() const; |
52 const String16& sourceMappingURL() const { return m_sourceMappingURL; } | 57 virtual const String16& sourceMappingURL() const = 0; |
53 String16 source(v8::Isolate*) const; | 58 virtual String16 source(v8::Isolate*) const { return m_source; } |
54 const String16& hash(v8::Isolate*) const; | 59 const String16& hash(v8::Isolate*) const; |
55 int startLine() const { return m_startLine; } | 60 int startLine() const { return m_startLine; } |
56 int startColumn() const { return m_startColumn; } | 61 int startColumn() const { return m_startColumn; } |
57 int endLine() const { return m_endLine; } | 62 int endLine() const { return m_endLine; } |
58 int endColumn() const { return m_endColumn; } | 63 int endColumn() const { return m_endColumn; } |
59 int executionContextId() const { return m_executionContextId; } | 64 int executionContextId() const { return m_executionContextId; } |
60 const String16& executionContextAuxData() const { | 65 virtual const String16& executionContextAuxData() const = 0; |
61 return m_executionContextAuxData; | 66 virtual bool isLiveEdit() const = 0; |
62 } | |
63 bool isLiveEdit() const { return m_isLiveEdit; } | |
64 | 67 |
65 void setSourceURL(const String16&); | 68 void setSourceURL(const String16&); |
66 void setSourceMappingURL(const String16&); | 69 virtual void setSourceMappingURL(const String16&) = 0; |
67 void setSource(v8::Local<v8::String>); | 70 virtual void setSource(v8::Local<v8::String> source) { |
| 71 m_source = toProtocolString(source); |
| 72 } |
68 | 73 |
69 bool getPossibleBreakpoints(const v8::debug::Location& start, | 74 virtual bool getPossibleBreakpoints( |
70 const v8::debug::Location& end, | 75 const v8::debug::Location& start, const v8::debug::Location& end, |
71 std::vector<v8::debug::Location>* locations); | 76 std::vector<v8::debug::Location>* locations) = 0; |
72 | 77 |
73 private: | 78 protected: |
| 79 V8DebuggerScript(v8::Isolate*, String16 id, String16 url); |
| 80 |
74 String16 m_id; | 81 String16 m_id; |
75 String16 m_url; | 82 String16 m_url; |
76 String16 m_sourceURL; | 83 String16 m_sourceURL; |
77 String16 m_sourceMappingURL; | |
78 v8::Global<v8::String> m_sourceObj; | |
79 String16 m_source; | 84 String16 m_source; |
80 mutable String16 m_hash; | 85 mutable String16 m_hash; |
81 int m_startLine = 0; | 86 int m_startLine = 0; |
82 int m_startColumn = 0; | 87 int m_startColumn = 0; |
83 int m_endLine = 0; | 88 int m_endLine = 0; |
84 int m_endColumn = 0; | 89 int m_endColumn = 0; |
85 int m_executionContextId = 0; | 90 int m_executionContextId = 0; |
86 String16 m_executionContextAuxData; | |
87 bool m_isLiveEdit = false; | |
88 | 91 |
89 v8::Isolate* m_isolate; | 92 v8::Isolate* m_isolate; |
90 v8::Global<v8::debug::Script> m_script; | |
91 | 93 |
| 94 private: |
92 DISALLOW_COPY_AND_ASSIGN(V8DebuggerScript); | 95 DISALLOW_COPY_AND_ASSIGN(V8DebuggerScript); |
93 }; | 96 }; |
94 | 97 |
95 } // namespace v8_inspector | 98 } // namespace v8_inspector |
96 | 99 |
97 #endif // V8_INSPECTOR_V8DEBUGGERSCRIPT_H_ | 100 #endif // V8_INSPECTOR_V8DEBUGGERSCRIPT_H_ |
OLD | NEW |