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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 public: | 103 public: |
104 Response initialize(); | 104 Response initialize(); |
105 void installCommandLineAPI(); | 105 void installCommandLineAPI(); |
106 void ignoreExceptionsAndMuteConsole(); | 106 void ignoreExceptionsAndMuteConsole(); |
107 void pretendUserGesture(); | 107 void pretendUserGesture(); |
108 v8::Local<v8::Context> context() const { return m_context; } | 108 v8::Local<v8::Context> context() const { return m_context; } |
109 InjectedScript* injectedScript() const { return m_injectedScript; } | 109 InjectedScript* injectedScript() const { return m_injectedScript; } |
110 const v8::TryCatch& tryCatch() const { return m_tryCatch; } | 110 const v8::TryCatch& tryCatch() const { return m_tryCatch; } |
111 | 111 |
112 protected: | 112 protected: |
113 Scope(V8InspectorImpl*, int contextGroupId); | 113 explicit Scope(V8InspectorSessionImpl*); |
114 virtual ~Scope(); | 114 virtual ~Scope(); |
115 virtual Response findInjectedScript(V8InspectorSessionImpl*) = 0; | 115 virtual Response findInjectedScript(V8InspectorSessionImpl*) = 0; |
116 | 116 |
117 V8InspectorImpl* m_inspector; | 117 V8InspectorImpl* m_inspector; |
118 int m_contextGroupId; | |
119 InjectedScript* m_injectedScript; | 118 InjectedScript* m_injectedScript; |
120 | 119 |
121 private: | 120 private: |
122 void cleanup(); | 121 void cleanup(); |
123 v8::debug::ExceptionBreakState setPauseOnExceptionsState( | 122 v8::debug::ExceptionBreakState setPauseOnExceptionsState( |
124 v8::debug::ExceptionBreakState); | 123 v8::debug::ExceptionBreakState); |
125 | 124 |
126 v8::HandleScope m_handleScope; | 125 v8::HandleScope m_handleScope; |
127 v8::TryCatch m_tryCatch; | 126 v8::TryCatch m_tryCatch; |
128 v8::Local<v8::Context> m_context; | 127 v8::Local<v8::Context> m_context; |
129 std::unique_ptr<V8Console::CommandLineAPIScope> m_commandLineAPIScope; | 128 std::unique_ptr<V8Console::CommandLineAPIScope> m_commandLineAPIScope; |
130 bool m_ignoreExceptionsAndMuteConsole; | 129 bool m_ignoreExceptionsAndMuteConsole; |
131 v8::debug::ExceptionBreakState m_previousPauseOnExceptionsState; | 130 v8::debug::ExceptionBreakState m_previousPauseOnExceptionsState; |
132 bool m_userGesture; | 131 bool m_userGesture; |
| 132 int m_contextGroupId; |
| 133 int m_sessionId; |
133 }; | 134 }; |
134 | 135 |
135 class ContextScope : public Scope { | 136 class ContextScope : public Scope { |
136 public: | 137 public: |
137 ContextScope(V8InspectorImpl*, int contextGroupId, int executionContextId); | 138 ContextScope(V8InspectorSessionImpl*, int executionContextId); |
138 ~ContextScope(); | 139 ~ContextScope(); |
139 | 140 |
140 private: | 141 private: |
141 Response findInjectedScript(V8InspectorSessionImpl*) override; | 142 Response findInjectedScript(V8InspectorSessionImpl*) override; |
142 int m_executionContextId; | 143 int m_executionContextId; |
143 | 144 |
144 DISALLOW_COPY_AND_ASSIGN(ContextScope); | 145 DISALLOW_COPY_AND_ASSIGN(ContextScope); |
145 }; | 146 }; |
146 | 147 |
147 class ObjectScope : public Scope { | 148 class ObjectScope : public Scope { |
148 public: | 149 public: |
149 ObjectScope(V8InspectorImpl*, int contextGroupId, | 150 ObjectScope(V8InspectorSessionImpl*, const String16& remoteObjectId); |
150 const String16& remoteObjectId); | |
151 ~ObjectScope(); | 151 ~ObjectScope(); |
152 const String16& objectGroupName() const { return m_objectGroupName; } | 152 const String16& objectGroupName() const { return m_objectGroupName; } |
153 v8::Local<v8::Value> object() const { return m_object; } | 153 v8::Local<v8::Value> object() const { return m_object; } |
154 | 154 |
155 private: | 155 private: |
156 Response findInjectedScript(V8InspectorSessionImpl*) override; | 156 Response findInjectedScript(V8InspectorSessionImpl*) override; |
157 String16 m_remoteObjectId; | 157 String16 m_remoteObjectId; |
158 String16 m_objectGroupName; | 158 String16 m_objectGroupName; |
159 v8::Local<v8::Value> m_object; | 159 v8::Local<v8::Value> m_object; |
160 | 160 |
161 DISALLOW_COPY_AND_ASSIGN(ObjectScope); | 161 DISALLOW_COPY_AND_ASSIGN(ObjectScope); |
162 }; | 162 }; |
163 | 163 |
164 class CallFrameScope : public Scope { | 164 class CallFrameScope : public Scope { |
165 public: | 165 public: |
166 CallFrameScope(V8InspectorImpl*, int contextGroupId, | 166 CallFrameScope(V8InspectorSessionImpl*, const String16& remoteCallFrameId); |
167 const String16& remoteCallFrameId); | |
168 ~CallFrameScope(); | 167 ~CallFrameScope(); |
169 size_t frameOrdinal() const { return m_frameOrdinal; } | 168 size_t frameOrdinal() const { return m_frameOrdinal; } |
170 | 169 |
171 private: | 170 private: |
172 Response findInjectedScript(V8InspectorSessionImpl*) override; | 171 Response findInjectedScript(V8InspectorSessionImpl*) override; |
173 String16 m_remoteCallFrameId; | 172 String16 m_remoteCallFrameId; |
174 size_t m_frameOrdinal; | 173 size_t m_frameOrdinal; |
175 | 174 |
176 DISALLOW_COPY_AND_ASSIGN(CallFrameScope); | 175 DISALLOW_COPY_AND_ASSIGN(CallFrameScope); |
177 }; | 176 }; |
(...skipping 12 matching lines...) Expand all Loading... |
190 v8::Global<v8::Value> m_lastEvaluationResult; | 189 v8::Global<v8::Value> m_lastEvaluationResult; |
191 std::unique_ptr<InjectedScriptNative> m_native; | 190 std::unique_ptr<InjectedScriptNative> m_native; |
192 v8::Global<v8::Object> m_commandLineAPI; | 191 v8::Global<v8::Object> m_commandLineAPI; |
193 | 192 |
194 DISALLOW_COPY_AND_ASSIGN(InjectedScript); | 193 DISALLOW_COPY_AND_ASSIGN(InjectedScript); |
195 }; | 194 }; |
196 | 195 |
197 } // namespace v8_inspector | 196 } // namespace v8_inspector |
198 | 197 |
199 #endif // V8_INSPECTOR_INJECTEDSCRIPT_H_ | 198 #endif // V8_INSPECTOR_INJECTEDSCRIPT_H_ |
OLD | NEW |