OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 V8DebuggerImpl_h | 31 #ifndef V8DebuggerImpl_h |
32 #define V8DebuggerImpl_h | 32 #define V8DebuggerImpl_h |
33 | 33 |
| 34 #include "platform/inspector_protocol/Collections.h" |
34 #include "platform/inspector_protocol/Maybe.h" | 35 #include "platform/inspector_protocol/Maybe.h" |
35 #include "platform/inspector_protocol/Platform.h" | 36 #include "platform/inspector_protocol/Platform.h" |
36 #include "platform/v8_inspector/JavaScriptCallFrame.h" | 37 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
37 #include "platform/v8_inspector/V8DebuggerScript.h" | 38 #include "platform/v8_inspector/V8DebuggerScript.h" |
38 #include "platform/v8_inspector/protocol/Debugger.h" | 39 #include "platform/v8_inspector/protocol/Debugger.h" |
39 #include "platform/v8_inspector/public/V8Debugger.h" | 40 #include "platform/v8_inspector/public/V8Debugger.h" |
40 | 41 |
41 #include <v8-debug.h> | 42 #include <v8-debug.h> |
42 #include <v8.h> | 43 #include <v8.h> |
43 | 44 |
| 45 #include <vector> |
| 46 |
44 namespace blink { | 47 namespace blink { |
45 | 48 |
46 using protocol::Maybe; | 49 using protocol::Maybe; |
47 | 50 |
48 struct ScriptBreakpoint; | 51 struct ScriptBreakpoint; |
49 class InspectedContext; | 52 class InspectedContext; |
50 class V8DebuggerAgentImpl; | 53 class V8DebuggerAgentImpl; |
51 class V8InspectorSessionImpl; | 54 class V8InspectorSessionImpl; |
52 class V8RuntimeAgentImpl; | 55 class V8RuntimeAgentImpl; |
53 class V8StackTraceImpl; | 56 class V8StackTraceImpl; |
(...skipping 26 matching lines...) Expand all Loading... |
80 void stepOverStatement(); | 83 void stepOverStatement(); |
81 void stepOutOfFunction(); | 84 void stepOutOfFunction(); |
82 void clearStepping(); | 85 void clearStepping(); |
83 | 86 |
84 bool setScriptSource(const String16& sourceID, const String16& newContent, b
ool preview, ErrorString*, Maybe<protocol::Debugger::SetScriptSourceError>*, Jav
aScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged); | 87 bool setScriptSource(const String16& sourceID, const String16& newContent, b
ool preview, ErrorString*, Maybe<protocol::Debugger::SetScriptSourceError>*, Jav
aScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged); |
85 JavaScriptCallFrames currentCallFrames(int limit = 0); | 88 JavaScriptCallFrames currentCallFrames(int limit = 0); |
86 | 89 |
87 // Each script inherits debug data from v8::Context where it has been compil
ed. | 90 // Each script inherits debug data from v8::Context where it has been compil
ed. |
88 // Only scripts whose debug data matches |contextGroupId| will be reported. | 91 // Only scripts whose debug data matches |contextGroupId| will be reported. |
89 // Passing 0 will result in reporting all scripts. | 92 // Passing 0 will result in reporting all scripts. |
90 void getCompiledScripts(int contextGroupId, protocol::Vector<V8DebuggerParse
dScript>&); | 93 void getCompiledScripts(int contextGroupId, std::vector<V8DebuggerParsedScri
pt>&); |
91 void debuggerAgentEnabled(); | 94 void debuggerAgentEnabled(); |
92 void debuggerAgentDisabled(); | 95 void debuggerAgentDisabled(); |
93 | 96 |
94 bool isPaused() override; | 97 bool isPaused() override; |
95 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } | 98 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } |
96 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } | 99 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } |
97 V8StackTraceImpl* currentAsyncCallChain(); | 100 V8StackTraceImpl* currentAsyncCallChain(); |
98 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); | 101 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); |
99 | 102 |
100 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Function>); | 103 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Function>); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 151 |
149 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
; | 152 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
; |
150 void handleProgramBreak(v8::Local<v8::Context> pausedContext, v8::Local<v8::
Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hit
Breakpoints, bool isPromiseRejection = false); | 153 void handleProgramBreak(v8::Local<v8::Context> pausedContext, v8::Local<v8::
Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hit
Breakpoints, bool isPromiseRejection = false); |
151 static void v8DebugEventCallback(const v8::Debug::EventDetails&); | 154 static void v8DebugEventCallback(const v8::Debug::EventDetails&); |
152 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const
char* functionName); | 155 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const
char* functionName); |
153 void handleV8DebugEvent(const v8::Debug::EventDetails&); | 156 void handleV8DebugEvent(const v8::Debug::EventDetails&); |
154 | 157 |
155 v8::Local<v8::String> v8InternalizedString(const char*) const; | 158 v8::Local<v8::String> v8InternalizedString(const char*) const; |
156 | 159 |
157 void handleV8AsyncTaskEvent(v8::Local<v8::Context>, v8::Local<v8::Object> ex
ecutionState, v8::Local<v8::Object> eventData); | 160 void handleV8AsyncTaskEvent(v8::Local<v8::Context>, v8::Local<v8::Object> ex
ecutionState, v8::Local<v8::Object> eventData); |
| 161 InspectedContext* getContext(int groupId, int contextId) const; |
| 162 |
| 163 using ContextsByGroupMap = protocol::HashMap<int, std::unique_ptr<ContextByI
dMap>>; |
158 | 164 |
159 v8::Isolate* m_isolate; | 165 v8::Isolate* m_isolate; |
160 V8DebuggerClient* m_client; | 166 V8DebuggerClient* m_client; |
161 using ContextsByGroupMap = protocol::HashMap<int, std::unique_ptr<ContextByI
dMap>>; | |
162 ContextsByGroupMap m_contexts; | 167 ContextsByGroupMap m_contexts; |
163 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; | 168 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; |
164 SessionMap m_sessions; | 169 SessionMap m_sessions; |
165 int m_enabledAgentsCount; | 170 int m_enabledAgentsCount; |
166 bool m_breakpointsActivated; | 171 bool m_breakpointsActivated; |
167 v8::Global<v8::Object> m_debuggerScript; | 172 v8::Global<v8::Object> m_debuggerScript; |
168 v8::Global<v8::Context> m_debuggerContext; | 173 v8::Global<v8::Context> m_debuggerContext; |
169 v8::Local<v8::Object> m_executionState; | 174 v8::Local<v8::Object> m_executionState; |
170 v8::Local<v8::Context> m_pausedContext; | 175 v8::Local<v8::Context> m_pausedContext; |
171 bool m_runningNestedMessageLoop; | 176 bool m_runningNestedMessageLoop; |
172 v8::Global<v8::Context> m_regexContext; | 177 v8::Global<v8::Context> m_regexContext; |
173 | 178 |
174 using AsyncTaskToStackTrace = protocol::HashMap<void*, std::unique_ptr<V8Sta
ckTraceImpl>>; | 179 using AsyncTaskToStackTrace = protocol::HashMap<void*, std::unique_ptr<V8Sta
ckTraceImpl>>; |
175 AsyncTaskToStackTrace m_asyncTaskStacks; | 180 AsyncTaskToStackTrace m_asyncTaskStacks; |
176 protocol::HashSet<void*> m_recurringTasks; | 181 protocol::HashSet<void*> m_recurringTasks; |
177 int m_maxAsyncCallStackDepth; | 182 int m_maxAsyncCallStackDepth; |
178 protocol::Vector<void*> m_currentTasks; | 183 std::vector<void*> m_currentTasks; |
179 protocol::Vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; | 184 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; |
180 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; | 185 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; |
181 }; | 186 }; |
182 | 187 |
183 } // namespace blink | 188 } // namespace blink |
184 | 189 |
185 | 190 |
186 #endif // V8DebuggerImpl_h | 191 #endif // V8DebuggerImpl_h |
OLD | NEW |