OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8DebuggerAgent_h | 5 #ifndef V8DebuggerAgent_h |
6 #define V8DebuggerAgent_h | 6 #define V8DebuggerAgent_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 class JSONObject; | 32 class JSONObject; |
33 class RemoteCallFrameId; | 33 class RemoteCallFrameId; |
34 class ScriptAsyncCallStack; | 34 class ScriptAsyncCallStack; |
35 class ScriptRegexp; | 35 class ScriptRegexp; |
36 class V8AsyncCallTracker; | 36 class V8AsyncCallTracker; |
37 class V8Debugger; | 37 class V8Debugger; |
38 | 38 |
39 typedef String ErrorString; | 39 typedef String ErrorString; |
40 | 40 |
41 class CORE_EXPORT V8DebuggerAgent | 41 class CORE_EXPORT V8DebuggerAgent |
42 : public InspectorBaseAgent<V8DebuggerAgent, InspectorFrontend::Debugger> | 42 : public V8DebuggerListener |
43 , public V8DebuggerListener | |
44 , public InspectorBackendDispatcher::DebuggerCommandHandler | 43 , public InspectorBackendDispatcher::DebuggerCommandHandler |
45 , public PromiseTracker::Listener { | 44 , public PromiseTracker::Listener { |
46 WTF_MAKE_NONCOPYABLE(V8DebuggerAgent); | 45 WTF_MAKE_NONCOPYABLE(V8DebuggerAgent); |
47 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(V8DebuggerAgent); | 46 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(V8DebuggerAgent); |
48 public: | 47 public: |
49 enum BreakpointSource { | 48 enum BreakpointSource { |
50 UserBreakpointSource, | 49 UserBreakpointSource, |
51 DebugCommandBreakpointSource, | 50 DebugCommandBreakpointSource, |
52 MonitorCommandBreakpointSource | 51 MonitorCommandBreakpointSource |
53 }; | 52 }; |
54 | 53 |
55 static const char backtraceObjectGroup[]; | 54 static const char backtraceObjectGroup[]; |
56 | 55 |
57 class CORE_EXPORT Client { | 56 class CORE_EXPORT Client { |
58 public: | 57 public: |
59 virtual ~Client() { } | 58 virtual ~Client() { } |
60 virtual void debuggerAgentEnabled() = 0; | 59 virtual void debuggerAgentEnabled() = 0; |
61 virtual void debuggerAgentDisabled() = 0; | 60 virtual void debuggerAgentDisabled() = 0; |
62 virtual void muteConsole() = 0; | 61 virtual void muteConsole() = 0; |
63 virtual void unmuteConsole() = 0; | 62 virtual void unmuteConsole() = 0; |
64 virtual InjectedScript defaultInjectedScript() = 0; | 63 virtual InjectedScript defaultInjectedScript() = 0; |
65 }; | 64 }; |
66 | 65 |
67 V8DebuggerAgent(InjectedScriptManager*, V8Debugger*, Client*, int contextGro
upId); | 66 V8DebuggerAgent(InjectedScriptManager*, V8Debugger*, Client*, int contextGro
upId); |
68 ~V8DebuggerAgent() override; | 67 ~V8DebuggerAgent() override; |
69 DECLARE_VIRTUAL_TRACE(); | |
70 | 68 |
71 void restore() override; | 69 void setInspectorState(InspectorState* state) { m_state = state; } |
| 70 void setFrontend(InspectorFrontend::Debugger* frontend) { m_frontend = front
end; } |
| 71 void clearFrontend(); |
| 72 void restore(); |
72 void disable(ErrorString*) final; | 73 void disable(ErrorString*) final; |
73 | 74 |
74 bool isPaused(); | 75 bool isPaused(); |
75 | 76 |
76 // Part of the protocol. | 77 // Part of the protocol. |
77 void enable(ErrorString*) override; | 78 void enable(ErrorString*) override; |
78 void setBreakpointsActive(ErrorString*, bool active) final; | 79 void setBreakpointsActive(ErrorString*, bool active) final; |
79 void setSkipAllPauses(ErrorString*, bool skipped) final; | 80 void setSkipAllPauses(ErrorString*, bool skipped) final; |
80 | 81 |
81 void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optional
URL, const String* optionalURLRegex, const int* optionalColumnNumber, const Stri
ng* optionalCondition, TypeBuilder::Debugger::BreakpointId*, RefPtr<TypeBuilder:
:Array<TypeBuilder::Debugger::Location>>& locations) final; | 82 void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optional
URL, const String* optionalURLRegex, const int* optionalColumnNumber, const Stri
ng* optionalCondition, TypeBuilder::Debugger::BreakpointId*, RefPtr<TypeBuilder:
:Array<TypeBuilder::Debugger::Location>>& locations) final; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void skipStackFrames(ErrorString*, const String* pattern, const bool* skipCo
ntentScripts) final; | 117 void skipStackFrames(ErrorString*, const String* pattern, const bool* skipCo
ntentScripts) final; |
117 void setAsyncCallStackDepth(ErrorString*, int depth) final; | 118 void setAsyncCallStackDepth(ErrorString*, int depth) final; |
118 void enablePromiseTracker(ErrorString*, const bool* captureStacks) final; | 119 void enablePromiseTracker(ErrorString*, const bool* captureStacks) final; |
119 void disablePromiseTracker(ErrorString*) final; | 120 void disablePromiseTracker(ErrorString*) final; |
120 void getPromiseById(ErrorString*, int promiseId, const String* objectGroup,
RefPtr<TypeBuilder::Runtime::RemoteObject>& promise) final; | 121 void getPromiseById(ErrorString*, int promiseId, const String* objectGroup,
RefPtr<TypeBuilder::Runtime::RemoteObject>& promise) final; |
121 void flushAsyncOperationEvents(ErrorString*) final; | 122 void flushAsyncOperationEvents(ErrorString*) final; |
122 void setAsyncOperationBreakpoint(ErrorString*, int operationId) final; | 123 void setAsyncOperationBreakpoint(ErrorString*, int operationId) final; |
123 void removeAsyncOperationBreakpoint(ErrorString*, int operationId) final; | 124 void removeAsyncOperationBreakpoint(ErrorString*, int operationId) final; |
124 | 125 |
125 void schedulePauseOnNextStatement(InspectorFrontend::Debugger::Reason::Enum
breakReason, PassRefPtr<JSONObject> data); | 126 void schedulePauseOnNextStatement(InspectorFrontend::Debugger::Reason::Enum
breakReason, PassRefPtr<JSONObject> data); |
126 void didFireTimer(); | 127 void cancelPauseOnNextStatement(); |
127 void didHandleEvent(); | |
128 bool canBreakProgram(); | 128 bool canBreakProgram(); |
129 void breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, Pas
sRefPtr<JSONObject> data); | 129 void breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, Pas
sRefPtr<JSONObject> data); |
130 void scriptExecutionBlockedByCSP(const String& directiveText); | 130 void willCallFunction(int scriptId); |
131 void willCallFunction(ExecutionContext*, const DevToolsFunctionInfo&); | |
132 void didCallFunction(); | 131 void didCallFunction(); |
133 void willEvaluateScript(const String& url, int lineNumber); | 132 void willEvaluateScript(); |
134 void didEvaluateScript(); | 133 void didEvaluateScript(); |
135 | 134 |
136 bool enabled(); | 135 bool enabled(); |
137 V8Debugger& debugger() { return *m_debugger; } | 136 V8Debugger& debugger() { return *m_debugger; } |
138 | 137 |
139 void setBreakpoint(const String& scriptId, int lineNumber, int columnNumber,
BreakpointSource, const String& condition = String()); | 138 void setBreakpoint(const String& scriptId, int lineNumber, int columnNumber,
BreakpointSource, const String& condition = String()); |
140 void removeBreakpoint(const String& scriptId, int lineNumber, int columnNumb
er, BreakpointSource); | 139 void removeBreakpoint(const String& scriptId, int lineNumber, int columnNumb
er, BreakpointSource); |
141 | 140 |
142 // Async call stacks implementation | 141 // Async call stacks implementation |
143 PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> currentAsyncStackTraceForConsol
e(); | 142 PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> currentAsyncStackTraceForConsol
e(); |
(...skipping 26 matching lines...) Expand all Loading... |
170 void enable(); | 169 void enable(); |
171 void disable(); | 170 void disable(); |
172 | 171 |
173 SkipPauseRequest didPause(v8::Local<v8::Context>, v8::Local<v8::Object> call
Frames, v8::Local<v8::Value> exception, const Vector<String>& hitBreakpoints, bo
ol isPromiseRejection) final; | 172 SkipPauseRequest didPause(v8::Local<v8::Context>, v8::Local<v8::Object> call
Frames, v8::Local<v8::Value> exception, const Vector<String>& hitBreakpoints, bo
ol isPromiseRejection) final; |
174 void didContinue() final; | 173 void didContinue() final; |
175 | 174 |
176 SkipPauseRequest shouldSkipExceptionPause(); | 175 SkipPauseRequest shouldSkipExceptionPause(); |
177 SkipPauseRequest shouldSkipStepPause(); | 176 SkipPauseRequest shouldSkipStepPause(); |
178 | 177 |
179 void schedulePauseOnNextStatementIfSteppingInto(); | 178 void schedulePauseOnNextStatementIfSteppingInto(); |
180 void cancelPauseOnNextStatement(); | |
181 | 179 |
182 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame>> currentCall
Frames(); | 180 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame>> currentCall
Frames(); |
183 PassRefPtr<TypeBuilder::Debugger::StackTrace> currentAsyncStackTrace(); | 181 PassRefPtr<TypeBuilder::Debugger::StackTrace> currentAsyncStackTrace(); |
184 bool callStackForId(ErrorString*, const RemoteCallFrameId&, v8::Local<v8::Ob
ject>* callStack, bool* isAsync); | 182 bool callStackForId(ErrorString*, const RemoteCallFrameId&, v8::Local<v8::Ob
ject>* callStack, bool* isAsync); |
185 | 183 |
186 void clearCurrentAsyncOperation(); | 184 void clearCurrentAsyncOperation(); |
187 void resetAsyncCallTracker(); | 185 void resetAsyncCallTracker(); |
188 | 186 |
189 void changeJavaScriptRecursionLevel(int step); | 187 void changeJavaScriptRecursionLevel(int step); |
190 | 188 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 NoStep = 0, | 220 NoStep = 0, |
223 StepInto, | 221 StepInto, |
224 StepOver, | 222 StepOver, |
225 StepOut | 223 StepOut |
226 }; | 224 }; |
227 | 225 |
228 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; | 226 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; |
229 V8Debugger* m_debugger; | 227 V8Debugger* m_debugger; |
230 Client* m_client; | 228 Client* m_client; |
231 int m_contextGroupId; | 229 int m_contextGroupId; |
| 230 InspectorState* m_state; |
| 231 InspectorFrontend::Debugger* m_frontend; |
232 v8::Isolate* m_isolate; | 232 v8::Isolate* m_isolate; |
233 RefPtr<ScriptState> m_pausedScriptState; | 233 RefPtr<ScriptState> m_pausedScriptState; |
234 v8::Global<v8::Object> m_currentCallStack; | 234 v8::Global<v8::Object> m_currentCallStack; |
235 ScriptsMap m_scripts; | 235 ScriptsMap m_scripts; |
236 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds
; | 236 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds
; |
237 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints; | 237 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints; |
238 String m_continueToLocationBreakpointId; | 238 String m_continueToLocationBreakpointId; |
239 InspectorFrontend::Debugger::Reason::Enum m_breakReason; | 239 InspectorFrontend::Debugger::Reason::Enum m_breakReason; |
240 RefPtr<JSONObject> m_breakAuxData; | 240 RefPtr<JSONObject> m_breakAuxData; |
241 DebuggerStep m_scheduledDebuggerStep; | 241 DebuggerStep m_scheduledDebuggerStep; |
(...skipping 27 matching lines...) Expand all Loading... |
269 int m_currentAsyncOperationId; | 269 int m_currentAsyncOperationId; |
270 bool m_pendingTraceAsyncOperationCompleted; | 270 bool m_pendingTraceAsyncOperationCompleted; |
271 bool m_startingStepIntoAsync; | 271 bool m_startingStepIntoAsync; |
272 V8GlobalValueMap<String, v8::Script, v8::kNotWeak> m_compiledScripts; | 272 V8GlobalValueMap<String, v8::Script, v8::kNotWeak> m_compiledScripts; |
273 }; | 273 }; |
274 | 274 |
275 } // namespace blink | 275 } // namespace blink |
276 | 276 |
277 | 277 |
278 #endif // V8DebuggerAgent_h | 278 #endif // V8DebuggerAgent_h |
OLD | NEW |