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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 class RemoteObjectId; | 46 class RemoteObjectId; |
47 class V8FunctionCall; | 47 class V8FunctionCall; |
48 class V8InspectorImpl; | 48 class V8InspectorImpl; |
49 class V8InspectorSessionImpl; | 49 class V8InspectorSessionImpl; |
50 | 50 |
51 using protocol::ErrorString; | 51 using protocol::ErrorString; |
52 using protocol::Maybe; | 52 using protocol::Maybe; |
53 | 53 |
54 class InjectedScript final { | 54 class InjectedScript final { |
55 DISALLOW_COPY_AND_ASSIGN(InjectedScript); | |
56 | |
57 public: | 55 public: |
58 static std::unique_ptr<InjectedScript> create(InspectedContext*); | 56 static std::unique_ptr<InjectedScript> create(InspectedContext*); |
59 ~InjectedScript(); | 57 ~InjectedScript(); |
60 | 58 |
61 InspectedContext* context() const { return m_context; } | 59 InspectedContext* context() const { return m_context; } |
62 | 60 |
63 void getProperties( | 61 void getProperties( |
64 ErrorString*, v8::Local<v8::Object>, const String16& groupName, | 62 ErrorString*, v8::Local<v8::Object>, const String16& groupName, |
65 bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, | 63 bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, |
66 std::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* | 64 std::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 v8::HandleScope m_handleScope; | 132 v8::HandleScope m_handleScope; |
135 v8::TryCatch m_tryCatch; | 133 v8::TryCatch m_tryCatch; |
136 v8::Local<v8::Context> m_context; | 134 v8::Local<v8::Context> m_context; |
137 std::unique_ptr<V8Console::CommandLineAPIScope> m_commandLineAPIScope; | 135 std::unique_ptr<V8Console::CommandLineAPIScope> m_commandLineAPIScope; |
138 bool m_ignoreExceptionsAndMuteConsole; | 136 bool m_ignoreExceptionsAndMuteConsole; |
139 V8Debugger::PauseOnExceptionsState m_previousPauseOnExceptionsState; | 137 V8Debugger::PauseOnExceptionsState m_previousPauseOnExceptionsState; |
140 bool m_userGesture; | 138 bool m_userGesture; |
141 }; | 139 }; |
142 | 140 |
143 class ContextScope : public Scope { | 141 class ContextScope : public Scope { |
144 DISALLOW_COPY_AND_ASSIGN(ContextScope); | |
145 | |
146 public: | 142 public: |
147 ContextScope(ErrorString*, V8InspectorImpl*, int contextGroupId, | 143 ContextScope(ErrorString*, V8InspectorImpl*, int contextGroupId, |
148 int executionContextId); | 144 int executionContextId); |
149 ~ContextScope(); | 145 ~ContextScope(); |
150 | 146 |
151 private: | 147 private: |
152 void findInjectedScript(V8InspectorSessionImpl*) override; | 148 void findInjectedScript(V8InspectorSessionImpl*) override; |
153 int m_executionContextId; | 149 int m_executionContextId; |
| 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(ContextScope); |
154 }; | 152 }; |
155 | 153 |
156 class ObjectScope : public Scope { | 154 class ObjectScope : public Scope { |
157 DISALLOW_COPY_AND_ASSIGN(ObjectScope); | |
158 | |
159 public: | 155 public: |
160 ObjectScope(ErrorString*, V8InspectorImpl*, int contextGroupId, | 156 ObjectScope(ErrorString*, V8InspectorImpl*, int contextGroupId, |
161 const String16& remoteObjectId); | 157 const String16& remoteObjectId); |
162 ~ObjectScope(); | 158 ~ObjectScope(); |
163 const String16& objectGroupName() const { return m_objectGroupName; } | 159 const String16& objectGroupName() const { return m_objectGroupName; } |
164 v8::Local<v8::Value> object() const { return m_object; } | 160 v8::Local<v8::Value> object() const { return m_object; } |
165 | 161 |
166 private: | 162 private: |
167 void findInjectedScript(V8InspectorSessionImpl*) override; | 163 void findInjectedScript(V8InspectorSessionImpl*) override; |
168 String16 m_remoteObjectId; | 164 String16 m_remoteObjectId; |
169 String16 m_objectGroupName; | 165 String16 m_objectGroupName; |
170 v8::Local<v8::Value> m_object; | 166 v8::Local<v8::Value> m_object; |
| 167 |
| 168 DISALLOW_COPY_AND_ASSIGN(ObjectScope); |
171 }; | 169 }; |
172 | 170 |
173 class CallFrameScope : public Scope { | 171 class CallFrameScope : public Scope { |
174 DISALLOW_COPY_AND_ASSIGN(CallFrameScope); | |
175 | |
176 public: | 172 public: |
177 CallFrameScope(ErrorString*, V8InspectorImpl*, int contextGroupId, | 173 CallFrameScope(ErrorString*, V8InspectorImpl*, int contextGroupId, |
178 const String16& remoteCallFrameId); | 174 const String16& remoteCallFrameId); |
179 ~CallFrameScope(); | 175 ~CallFrameScope(); |
180 size_t frameOrdinal() const { return m_frameOrdinal; } | 176 size_t frameOrdinal() const { return m_frameOrdinal; } |
181 | 177 |
182 private: | 178 private: |
183 void findInjectedScript(V8InspectorSessionImpl*) override; | 179 void findInjectedScript(V8InspectorSessionImpl*) override; |
184 String16 m_remoteCallFrameId; | 180 String16 m_remoteCallFrameId; |
185 size_t m_frameOrdinal; | 181 size_t m_frameOrdinal; |
| 182 |
| 183 DISALLOW_COPY_AND_ASSIGN(CallFrameScope); |
186 }; | 184 }; |
187 | 185 |
188 private: | 186 private: |
189 InjectedScript(InspectedContext*, v8::Local<v8::Object>, | 187 InjectedScript(InspectedContext*, v8::Local<v8::Object>, |
190 std::unique_ptr<InjectedScriptNative>); | 188 std::unique_ptr<InjectedScriptNative>); |
191 v8::Local<v8::Value> v8Value() const; | 189 v8::Local<v8::Value> v8Value() const; |
192 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, | 190 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, |
193 const String16& groupName, | 191 const String16& groupName, |
194 bool forceValueType, | 192 bool forceValueType, |
195 bool generatePreview) const; | 193 bool generatePreview) const; |
196 v8::Local<v8::Object> commandLineAPI(); | 194 v8::Local<v8::Object> commandLineAPI(); |
197 | 195 |
198 InspectedContext* m_context; | 196 InspectedContext* m_context; |
199 v8::Global<v8::Value> m_value; | 197 v8::Global<v8::Value> m_value; |
200 v8::Global<v8::Value> m_lastEvaluationResult; | 198 v8::Global<v8::Value> m_lastEvaluationResult; |
201 std::unique_ptr<InjectedScriptNative> m_native; | 199 std::unique_ptr<InjectedScriptNative> m_native; |
202 v8::Global<v8::Object> m_commandLineAPI; | 200 v8::Global<v8::Object> m_commandLineAPI; |
| 201 |
| 202 DISALLOW_COPY_AND_ASSIGN(InjectedScript); |
203 }; | 203 }; |
204 | 204 |
205 } // namespace v8_inspector | 205 } // namespace v8_inspector |
206 | 206 |
207 #endif // V8_INSPECTOR_INJECTEDSCRIPT_H_ | 207 #endif // V8_INSPECTOR_INJECTEDSCRIPT_H_ |
OLD | NEW |