OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef InjectedScript_h | 31 #ifndef InjectedScript_h |
32 #define InjectedScript_h | 32 #define InjectedScript_h |
33 | 33 |
34 #include "platform/inspector_protocol/InspectorProtocol.h" | 34 #include "platform/v8_inspector/Allocator.h" |
35 #include "platform/v8_inspector/InjectedScriptNative.h" | 35 #include "platform/v8_inspector/InjectedScriptNative.h" |
36 #include "platform/v8_inspector/InspectedContext.h" | 36 #include "platform/v8_inspector/InspectedContext.h" |
37 #include "platform/v8_inspector/V8Console.h" | 37 #include "platform/v8_inspector/V8Console.h" |
38 #include "platform/v8_inspector/V8Debugger.h" | 38 #include "platform/v8_inspector/V8Debugger.h" |
| 39 #include "platform/v8_inspector/protocol/Forward.h" |
39 #include "platform/v8_inspector/protocol/Runtime.h" | 40 #include "platform/v8_inspector/protocol/Runtime.h" |
40 | 41 |
41 #include <v8.h> | 42 #include <v8.h> |
42 | 43 |
43 namespace v8_inspector { | 44 namespace v8_inspector { |
44 | 45 |
45 class RemoteObjectId; | 46 class RemoteObjectId; |
46 class V8FunctionCall; | 47 class V8FunctionCall; |
47 class V8InspectorImpl; | 48 class V8InspectorImpl; |
48 class V8InspectorSessionImpl; | 49 class V8InspectorSessionImpl; |
49 | 50 |
50 namespace protocol = blink::protocol; | 51 using protocol::ErrorString; |
51 using blink::protocol::Maybe; | 52 using protocol::Maybe; |
52 | 53 |
53 class InjectedScript final { | 54 class InjectedScript final { |
54 PROTOCOL_DISALLOW_COPY(InjectedScript); | 55 V8_INSPECTOR_DISALLOW_COPY(InjectedScript); |
55 public: | 56 public: |
56 static std::unique_ptr<InjectedScript> create(InspectedContext*); | 57 static std::unique_ptr<InjectedScript> create(InspectedContext*); |
57 ~InjectedScript(); | 58 ~InjectedScript(); |
58 | 59 |
59 InspectedContext* context() const { return m_context; } | 60 InspectedContext* context() const { return m_context; } |
60 | 61 |
61 void getProperties(ErrorString*, v8::Local<v8::Object>, const String16& grou
pName, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, st
d::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result, M
aybe<protocol::Runtime::ExceptionDetails>*); | 62 void getProperties(ErrorString*, v8::Local<v8::Object>, const String16& grou
pName, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, st
d::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result, M
aybe<protocol::Runtime::ExceptionDetails>*); |
62 void releaseObject(const String16& objectId); | 63 void releaseObject(const String16& objectId); |
63 | 64 |
64 std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(ErrorString*, v8
::Local<v8::Value>, const String16& groupName, bool forceValueType = false, bool
generatePreview = false) const; | 65 std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(ErrorString*, v8
::Local<v8::Value>, const String16& groupName, bool forceValueType = false, bool
generatePreview = false) const; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 v8::HandleScope m_handleScope; | 112 v8::HandleScope m_handleScope; |
112 v8::TryCatch m_tryCatch; | 113 v8::TryCatch m_tryCatch; |
113 v8::Local<v8::Context> m_context; | 114 v8::Local<v8::Context> m_context; |
114 std::unique_ptr<V8Console::CommandLineAPIScope> m_commandLineAPIScope; | 115 std::unique_ptr<V8Console::CommandLineAPIScope> m_commandLineAPIScope; |
115 bool m_ignoreExceptionsAndMuteConsole; | 116 bool m_ignoreExceptionsAndMuteConsole; |
116 V8Debugger::PauseOnExceptionsState m_previousPauseOnExceptionsState; | 117 V8Debugger::PauseOnExceptionsState m_previousPauseOnExceptionsState; |
117 bool m_userGesture; | 118 bool m_userGesture; |
118 }; | 119 }; |
119 | 120 |
120 class ContextScope: public Scope { | 121 class ContextScope: public Scope { |
121 PROTOCOL_DISALLOW_COPY(ContextScope); | 122 V8_INSPECTOR_DISALLOW_COPY(ContextScope); |
122 public: | 123 public: |
123 ContextScope(ErrorString*, V8InspectorImpl*, int contextGroupId, int exe
cutionContextId); | 124 ContextScope(ErrorString*, V8InspectorImpl*, int contextGroupId, int exe
cutionContextId); |
124 ~ContextScope(); | 125 ~ContextScope(); |
125 private: | 126 private: |
126 void findInjectedScript(V8InspectorSessionImpl*) override; | 127 void findInjectedScript(V8InspectorSessionImpl*) override; |
127 int m_executionContextId; | 128 int m_executionContextId; |
128 }; | 129 }; |
129 | 130 |
130 class ObjectScope: public Scope { | 131 class ObjectScope: public Scope { |
131 PROTOCOL_DISALLOW_COPY(ObjectScope); | 132 V8_INSPECTOR_DISALLOW_COPY(ObjectScope); |
132 public: | 133 public: |
133 ObjectScope(ErrorString*, V8InspectorImpl*, int contextGroupId, const St
ring16& remoteObjectId); | 134 ObjectScope(ErrorString*, V8InspectorImpl*, int contextGroupId, const St
ring16& remoteObjectId); |
134 ~ObjectScope(); | 135 ~ObjectScope(); |
135 const String16& objectGroupName() const { return m_objectGroupName; } | 136 const String16& objectGroupName() const { return m_objectGroupName; } |
136 v8::Local<v8::Value> object() const { return m_object; } | 137 v8::Local<v8::Value> object() const { return m_object; } |
137 private: | 138 private: |
138 void findInjectedScript(V8InspectorSessionImpl*) override; | 139 void findInjectedScript(V8InspectorSessionImpl*) override; |
139 String16 m_remoteObjectId; | 140 String16 m_remoteObjectId; |
140 String16 m_objectGroupName; | 141 String16 m_objectGroupName; |
141 v8::Local<v8::Value> m_object; | 142 v8::Local<v8::Value> m_object; |
142 }; | 143 }; |
143 | 144 |
144 class CallFrameScope: public Scope { | 145 class CallFrameScope: public Scope { |
145 PROTOCOL_DISALLOW_COPY(CallFrameScope); | 146 V8_INSPECTOR_DISALLOW_COPY(CallFrameScope); |
146 public: | 147 public: |
147 CallFrameScope(ErrorString*, V8InspectorImpl*, int contextGroupId, const
String16& remoteCallFrameId); | 148 CallFrameScope(ErrorString*, V8InspectorImpl*, int contextGroupId, const
String16& remoteCallFrameId); |
148 ~CallFrameScope(); | 149 ~CallFrameScope(); |
149 size_t frameOrdinal() const { return m_frameOrdinal; } | 150 size_t frameOrdinal() const { return m_frameOrdinal; } |
150 private: | 151 private: |
151 void findInjectedScript(V8InspectorSessionImpl*) override; | 152 void findInjectedScript(V8InspectorSessionImpl*) override; |
152 String16 m_remoteCallFrameId; | 153 String16 m_remoteCallFrameId; |
153 size_t m_frameOrdinal; | 154 size_t m_frameOrdinal; |
154 }; | 155 }; |
155 | 156 |
156 private: | 157 private: |
157 InjectedScript(InspectedContext*, v8::Local<v8::Object>, std::unique_ptr<Inj
ectedScriptNative>); | 158 InjectedScript(InspectedContext*, v8::Local<v8::Object>, std::unique_ptr<Inj
ectedScriptNative>); |
158 v8::Local<v8::Value> v8Value() const; | 159 v8::Local<v8::Value> v8Value() const; |
159 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, cons
t String16& groupName, bool forceValueType, bool generatePreview) const; | 160 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, cons
t String16& groupName, bool forceValueType, bool generatePreview) const; |
160 v8::Local<v8::Object> commandLineAPI(); | 161 v8::Local<v8::Object> commandLineAPI(); |
161 | 162 |
162 InspectedContext* m_context; | 163 InspectedContext* m_context; |
163 v8::Global<v8::Value> m_value; | 164 v8::Global<v8::Value> m_value; |
164 v8::Global<v8::Value> m_lastEvaluationResult; | 165 v8::Global<v8::Value> m_lastEvaluationResult; |
165 std::unique_ptr<InjectedScriptNative> m_native; | 166 std::unique_ptr<InjectedScriptNative> m_native; |
166 v8::Global<v8::Object> m_commandLineAPI; | 167 v8::Global<v8::Object> m_commandLineAPI; |
167 }; | 168 }; |
168 | 169 |
169 } // namespace v8_inspector | 170 } // namespace v8_inspector |
170 | 171 |
171 #endif | 172 #endif |
OLD | NEW |