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 18 matching lines...) Expand all Loading... |
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/Allocator.h" | 34 #include "platform/inspector_protocol/Allocator.h" |
35 #include "platform/inspector_protocol/Platform.h" | 35 #include "platform/inspector_protocol/Platform.h" |
36 #include "platform/v8_inspector/InjectedScriptNative.h" | 36 #include "platform/v8_inspector/InjectedScriptNative.h" |
37 #include "platform/v8_inspector/InspectedContext.h" | 37 #include "platform/v8_inspector/InspectedContext.h" |
38 #include "platform/v8_inspector/V8Console.h" | 38 #include "platform/v8_inspector/V8Console.h" |
39 #include "platform/v8_inspector/V8DebuggerImpl.h" | 39 #include "platform/v8_inspector/V8InspectorImpl.h" |
40 #include "platform/v8_inspector/protocol/Runtime.h" | 40 #include "platform/v8_inspector/protocol/Runtime.h" |
41 | 41 |
42 #include <v8.h> | 42 #include <v8.h> |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 class RemoteObjectId; | 46 class RemoteObjectId; |
47 class V8FunctionCall; | 47 class V8FunctionCall; |
48 class V8InspectorSessionImpl; | 48 class V8InspectorSessionImpl; |
49 | 49 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 public: | 92 public: |
93 bool initialize(); | 93 bool initialize(); |
94 bool installCommandLineAPI(); | 94 bool installCommandLineAPI(); |
95 void ignoreExceptionsAndMuteConsole(); | 95 void ignoreExceptionsAndMuteConsole(); |
96 void pretendUserGesture(); | 96 void pretendUserGesture(); |
97 v8::Local<v8::Context> context() const { return m_context; } | 97 v8::Local<v8::Context> context() const { return m_context; } |
98 InjectedScript* injectedScript() const { return m_injectedScript; } | 98 InjectedScript* injectedScript() const { return m_injectedScript; } |
99 const v8::TryCatch& tryCatch() const { return m_tryCatch; } | 99 const v8::TryCatch& tryCatch() const { return m_tryCatch; } |
100 | 100 |
101 protected: | 101 protected: |
102 Scope(ErrorString*, V8DebuggerImpl*, int contextGroupId); | 102 Scope(ErrorString*, V8InspectorImpl*, int contextGroupId); |
103 ~Scope(); | 103 ~Scope(); |
104 virtual void findInjectedScript(V8InspectorSessionImpl*) = 0; | 104 virtual void findInjectedScript(V8InspectorSessionImpl*) = 0; |
105 | 105 |
106 ErrorString* m_errorString; | 106 ErrorString* m_errorString; |
107 V8DebuggerImpl* m_debugger; | 107 V8InspectorImpl* m_inspector; |
108 int m_contextGroupId; | 108 int m_contextGroupId; |
109 InjectedScript* m_injectedScript; | 109 InjectedScript* m_injectedScript; |
110 | 110 |
111 private: | 111 private: |
112 void cleanup(); | 112 void cleanup(); |
113 V8DebuggerImpl::PauseOnExceptionsState setPauseOnExceptionsState(V8Debug
gerImpl::PauseOnExceptionsState); | 113 V8InspectorImpl::PauseOnExceptionsState setPauseOnExceptionsState(V8Insp
ectorImpl::PauseOnExceptionsState); |
114 | 114 |
115 v8::HandleScope m_handleScope; | 115 v8::HandleScope m_handleScope; |
116 v8::TryCatch m_tryCatch; | 116 v8::TryCatch m_tryCatch; |
117 v8::Local<v8::Context> m_context; | 117 v8::Local<v8::Context> m_context; |
118 std::unique_ptr<V8Console::CommandLineAPIScope> m_commandLineAPIScope; | 118 std::unique_ptr<V8Console::CommandLineAPIScope> m_commandLineAPIScope; |
119 bool m_ignoreExceptionsAndMuteConsole; | 119 bool m_ignoreExceptionsAndMuteConsole; |
120 V8DebuggerImpl::PauseOnExceptionsState m_previousPauseOnExceptionsState; | 120 V8InspectorImpl::PauseOnExceptionsState m_previousPauseOnExceptionsState
; |
121 bool m_userGesture; | 121 bool m_userGesture; |
122 }; | 122 }; |
123 | 123 |
124 class ContextScope: public Scope { | 124 class ContextScope: public Scope { |
125 PROTOCOL_DISALLOW_COPY(ContextScope); | 125 PROTOCOL_DISALLOW_COPY(ContextScope); |
126 public: | 126 public: |
127 ContextScope(ErrorString*, V8DebuggerImpl*, int contextGroupId, int exec
utionContextId); | 127 ContextScope(ErrorString*, V8InspectorImpl*, int contextGroupId, int exe
cutionContextId); |
128 ~ContextScope(); | 128 ~ContextScope(); |
129 private: | 129 private: |
130 void findInjectedScript(V8InspectorSessionImpl*) override; | 130 void findInjectedScript(V8InspectorSessionImpl*) override; |
131 int m_executionContextId; | 131 int m_executionContextId; |
132 }; | 132 }; |
133 | 133 |
134 class ObjectScope: public Scope { | 134 class ObjectScope: public Scope { |
135 PROTOCOL_DISALLOW_COPY(ObjectScope); | 135 PROTOCOL_DISALLOW_COPY(ObjectScope); |
136 public: | 136 public: |
137 ObjectScope(ErrorString*, V8DebuggerImpl*, int contextGroupId, const Str
ing16& remoteObjectId); | 137 ObjectScope(ErrorString*, V8InspectorImpl*, int contextGroupId, const St
ring16& remoteObjectId); |
138 ~ObjectScope(); | 138 ~ObjectScope(); |
139 const String16& objectGroupName() const { return m_objectGroupName; } | 139 const String16& objectGroupName() const { return m_objectGroupName; } |
140 v8::Local<v8::Value> object() const { return m_object; } | 140 v8::Local<v8::Value> object() const { return m_object; } |
141 private: | 141 private: |
142 void findInjectedScript(V8InspectorSessionImpl*) override; | 142 void findInjectedScript(V8InspectorSessionImpl*) override; |
143 String16 m_remoteObjectId; | 143 String16 m_remoteObjectId; |
144 String16 m_objectGroupName; | 144 String16 m_objectGroupName; |
145 v8::Local<v8::Value> m_object; | 145 v8::Local<v8::Value> m_object; |
146 }; | 146 }; |
147 | 147 |
148 class CallFrameScope: public Scope { | 148 class CallFrameScope: public Scope { |
149 PROTOCOL_DISALLOW_COPY(CallFrameScope); | 149 PROTOCOL_DISALLOW_COPY(CallFrameScope); |
150 public: | 150 public: |
151 CallFrameScope(ErrorString*, V8DebuggerImpl*, int contextGroupId, const
String16& remoteCallFrameId); | 151 CallFrameScope(ErrorString*, V8InspectorImpl*, int contextGroupId, const
String16& remoteCallFrameId); |
152 ~CallFrameScope(); | 152 ~CallFrameScope(); |
153 size_t frameOrdinal() const { return m_frameOrdinal; } | 153 size_t frameOrdinal() const { return m_frameOrdinal; } |
154 private: | 154 private: |
155 void findInjectedScript(V8InspectorSessionImpl*) override; | 155 void findInjectedScript(V8InspectorSessionImpl*) override; |
156 String16 m_remoteCallFrameId; | 156 String16 m_remoteCallFrameId; |
157 size_t m_frameOrdinal; | 157 size_t m_frameOrdinal; |
158 }; | 158 }; |
159 | 159 |
160 private: | 160 private: |
161 InjectedScript(InspectedContext*, v8::Local<v8::Object>, std::unique_ptr<Inj
ectedScriptNative>); | 161 InjectedScript(InspectedContext*, v8::Local<v8::Object>, std::unique_ptr<Inj
ectedScriptNative>); |
162 v8::Local<v8::Value> v8Value() const; | 162 v8::Local<v8::Value> v8Value() const; |
163 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, cons
t String16& groupName, bool forceValueType, bool generatePreview) const; | 163 v8::MaybeLocal<v8::Value> wrapValue(ErrorString*, v8::Local<v8::Value>, cons
t String16& groupName, bool forceValueType, bool generatePreview) const; |
164 v8::Local<v8::Object> commandLineAPI(); | 164 v8::Local<v8::Object> commandLineAPI(); |
165 | 165 |
166 InspectedContext* m_context; | 166 InspectedContext* m_context; |
167 v8::Global<v8::Value> m_value; | 167 v8::Global<v8::Value> m_value; |
168 v8::Global<v8::Value> m_lastEvaluationResult; | 168 v8::Global<v8::Value> m_lastEvaluationResult; |
169 std::unique_ptr<InjectedScriptNative> m_native; | 169 std::unique_ptr<InjectedScriptNative> m_native; |
170 v8::Global<v8::Object> m_commandLineAPI; | 170 v8::Global<v8::Object> m_commandLineAPI; |
171 }; | 171 }; |
172 | 172 |
173 } // namespace blink | 173 } // namespace blink |
174 | 174 |
175 #endif | 175 #endif |
OLD | NEW |