| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(V8DebuggerAgent); | 47 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(V8DebuggerAgent); |
| 48 public: | 48 public: |
| 49 enum BreakpointSource { | 49 enum BreakpointSource { |
| 50 UserBreakpointSource, | 50 UserBreakpointSource, |
| 51 DebugCommandBreakpointSource, | 51 DebugCommandBreakpointSource, |
| 52 MonitorCommandBreakpointSource | 52 MonitorCommandBreakpointSource |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 static const char backtraceObjectGroup[]; | 55 static const char backtraceObjectGroup[]; |
| 56 | 56 |
| 57 class CORE_EXPORT Client { |
| 58 public: |
| 59 virtual ~Client() { } |
| 60 virtual void startListeningV8Debugger() = 0; |
| 61 virtual void stopListeningV8Debugger() = 0; |
| 62 virtual void muteConsole() = 0; |
| 63 virtual void unmuteConsole() = 0; |
| 64 virtual InjectedScript defaultInjectedScript() = 0; |
| 65 |
| 66 virtual bool canPauseOnPromiseEvent() = 0; |
| 67 virtual void didCreatePromise() = 0; |
| 68 virtual void didResolvePromise() = 0; |
| 69 virtual void didRejectPromise() = 0; |
| 70 }; |
| 71 |
| 57 ~V8DebuggerAgent() override; | 72 ~V8DebuggerAgent() override; |
| 58 DECLARE_VIRTUAL_TRACE(); | 73 DECLARE_VIRTUAL_TRACE(); |
| 59 | 74 |
| 60 void canSetScriptSource(ErrorString*, bool* result) final { *result = true;
} | 75 void canSetScriptSource(ErrorString*, bool* result) final { *result = true;
} |
| 61 | 76 |
| 62 void init() final; | 77 void init() final; |
| 63 void restore() override; | 78 void restore() override; |
| 64 void disable(ErrorString*) final; | 79 void disable(ErrorString*) final; |
| 65 | 80 |
| 66 bool isPaused(); | 81 bool isPaused(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 void didHandleEvent(); | 133 void didHandleEvent(); |
| 119 bool canBreakProgram(); | 134 bool canBreakProgram(); |
| 120 void breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, Pas
sRefPtr<JSONObject> data); | 135 void breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, Pas
sRefPtr<JSONObject> data); |
| 121 void scriptExecutionBlockedByCSP(const String& directiveText); | 136 void scriptExecutionBlockedByCSP(const String& directiveText); |
| 122 void willCallFunction(ExecutionContext*, const DevToolsFunctionInfo&); | 137 void willCallFunction(ExecutionContext*, const DevToolsFunctionInfo&); |
| 123 void didCallFunction(); | 138 void didCallFunction(); |
| 124 void willEvaluateScript(const String& url, int lineNumber); | 139 void willEvaluateScript(const String& url, int lineNumber); |
| 125 void didEvaluateScript(); | 140 void didEvaluateScript(); |
| 126 bool getEditedScript(const String& url, String* content); | 141 bool getEditedScript(const String& url, String* content); |
| 127 | 142 |
| 128 class CORE_EXPORT Listener : public WillBeGarbageCollectedMixin { | |
| 129 public: | |
| 130 virtual ~Listener() { } | |
| 131 virtual void debuggerWasEnabled() = 0; | |
| 132 virtual void debuggerWasDisabled() = 0; | |
| 133 virtual bool canPauseOnPromiseEvent() = 0; | |
| 134 virtual void didCreatePromise() = 0; | |
| 135 virtual void didResolvePromise() = 0; | |
| 136 virtual void didRejectPromise() = 0; | |
| 137 }; | |
| 138 void setListener(Listener* listener) { m_listener = listener; } | |
| 139 | |
| 140 bool enabled(); | 143 bool enabled(); |
| 141 V8Debugger& debugger() { return *m_debugger; } | 144 V8Debugger& debugger() { return *m_debugger; } |
| 142 | 145 |
| 143 void setBreakpoint(const String& scriptId, int lineNumber, int columnNumber,
BreakpointSource, const String& condition = String()); | 146 void setBreakpoint(const String& scriptId, int lineNumber, int columnNumber,
BreakpointSource, const String& condition = String()); |
| 144 void removeBreakpoint(const String& scriptId, int lineNumber, int columnNumb
er, BreakpointSource); | 147 void removeBreakpoint(const String& scriptId, int lineNumber, int columnNumb
er, BreakpointSource); |
| 145 | 148 |
| 146 // Async call stacks implementation | 149 // Async call stacks implementation |
| 147 PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> currentAsyncStackTraceForConsol
e(); | 150 PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> currentAsyncStackTraceForConsol
e(); |
| 148 static const int unknownAsyncOperationId; | 151 static const int unknownAsyncOperationId; |
| 149 int traceAsyncOperationStarting(const String& description); | 152 int traceAsyncOperationStarting(const String& description); |
| 150 void traceAsyncCallbackStarting(int operationId); | 153 void traceAsyncCallbackStarting(int operationId); |
| 151 void traceAsyncCallbackCompleted(); | 154 void traceAsyncCallbackCompleted(); |
| 152 void traceAsyncOperationCompleted(int operationId); | 155 void traceAsyncOperationCompleted(int operationId); |
| 153 bool trackingAsyncCalls() const { return m_maxAsyncCallStackDepth; } | 156 bool trackingAsyncCalls() const { return m_maxAsyncCallStackDepth; } |
| 154 | 157 |
| 155 class CORE_EXPORT AsyncCallTrackingListener : public WillBeGarbageCollectedM
ixin { | 158 class CORE_EXPORT AsyncCallTrackingListener : public WillBeGarbageCollectedM
ixin { |
| 156 public: | 159 public: |
| 157 virtual ~AsyncCallTrackingListener() { } | 160 virtual ~AsyncCallTrackingListener() { } |
| 158 DEFINE_INLINE_VIRTUAL_TRACE() { } | 161 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 159 virtual void asyncCallTrackingStateChanged(bool tracking) = 0; | 162 virtual void asyncCallTrackingStateChanged(bool tracking) = 0; |
| 160 virtual void resetAsyncOperations() = 0; | 163 virtual void resetAsyncOperations() = 0; |
| 161 }; | 164 }; |
| 162 void addAsyncCallTrackingListener(AsyncCallTrackingListener*); | 165 void addAsyncCallTrackingListener(AsyncCallTrackingListener*); |
| 163 void removeAsyncCallTrackingListener(AsyncCallTrackingListener*); | 166 void removeAsyncCallTrackingListener(AsyncCallTrackingListener*); |
| 164 | 167 |
| 165 // PromiseTracker::Listener | 168 // PromiseTracker::Listener |
| 166 void didUpdatePromise(InspectorFrontend::Debugger::EventType::Enum, PassRefP
tr<TypeBuilder::Debugger::PromiseDetails>) final; | 169 void didUpdatePromise(InspectorFrontend::Debugger::EventType::Enum, PassRefP
tr<TypeBuilder::Debugger::PromiseDetails>) final; |
| 167 | 170 |
| 171 InjectedScript injectedScriptForEval(ErrorString*, const int* executionConte
xtId); |
| 172 |
| 168 protected: | 173 protected: |
| 169 V8DebuggerAgent(InjectedScriptManager*, V8Debugger*); | 174 V8DebuggerAgent(InjectedScriptManager*, V8Debugger*, Client*); |
| 170 | 175 |
| 171 virtual void startListeningV8Debugger() = 0; | |
| 172 virtual void stopListeningV8Debugger() = 0; | |
| 173 virtual void muteConsole() = 0; | |
| 174 virtual void unmuteConsole() = 0; | |
| 175 InjectedScriptManager* injectedScriptManager() { return m_injectedScriptMana
ger; } | 176 InjectedScriptManager* injectedScriptManager() { return m_injectedScriptMana
ger; } |
| 176 virtual InjectedScript injectedScriptForEval(ErrorString*, const int* execut
ionContextId) = 0; | |
| 177 | |
| 178 virtual void enable(); | |
| 179 virtual void disable(); | |
| 180 | 177 |
| 181 void didContinue() final; | 178 void didContinue() final; |
| 182 void reset(); | 179 void reset(); |
| 183 void resetModifiedSources(); | 180 void resetModifiedSources(); |
| 184 | 181 |
| 185 private: | 182 private: |
| 186 bool checkEnabled(ErrorString*); | 183 bool checkEnabled(ErrorString*); |
| 184 void enable(); |
| 185 void disable(); |
| 187 | 186 |
| 188 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; | 187 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; |
| 189 | 188 |
| 190 SkipPauseRequest shouldSkipExceptionPause(); | 189 SkipPauseRequest shouldSkipExceptionPause(); |
| 191 SkipPauseRequest shouldSkipStepPause(); | 190 SkipPauseRequest shouldSkipStepPause(); |
| 192 | 191 |
| 193 void schedulePauseOnNextStatementIfSteppingInto(); | 192 void schedulePauseOnNextStatementIfSteppingInto(); |
| 194 void cancelPauseOnNextStatement(); | 193 void cancelPauseOnNextStatement(); |
| 195 | 194 |
| 196 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame>> currentCall
Frames(); | 195 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame>> currentCall
Frames(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 233 |
| 235 enum DebuggerStep { | 234 enum DebuggerStep { |
| 236 NoStep = 0, | 235 NoStep = 0, |
| 237 StepInto, | 236 StepInto, |
| 238 StepOver, | 237 StepOver, |
| 239 StepOut | 238 StepOut |
| 240 }; | 239 }; |
| 241 | 240 |
| 242 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; | 241 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; |
| 243 V8Debugger* m_debugger; | 242 V8Debugger* m_debugger; |
| 243 Client* m_client; |
| 244 v8::Isolate* m_isolate; | 244 v8::Isolate* m_isolate; |
| 245 RefPtr<ScriptState> m_pausedScriptState; | 245 RefPtr<ScriptState> m_pausedScriptState; |
| 246 v8::Global<v8::Object> m_currentCallStack; | 246 v8::Global<v8::Object> m_currentCallStack; |
| 247 ScriptsMap m_scripts; | 247 ScriptsMap m_scripts; |
| 248 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds
; | 248 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds
; |
| 249 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints; | 249 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints; |
| 250 String m_continueToLocationBreakpointId; | 250 String m_continueToLocationBreakpointId; |
| 251 InspectorFrontend::Debugger::Reason::Enum m_breakReason; | 251 InspectorFrontend::Debugger::Reason::Enum m_breakReason; |
| 252 RefPtr<JSONObject> m_breakAuxData; | 252 RefPtr<JSONObject> m_breakAuxData; |
| 253 DebuggerStep m_scheduledDebuggerStep; | 253 DebuggerStep m_scheduledDebuggerStep; |
| 254 bool m_skipNextDebuggerStepOut; | 254 bool m_skipNextDebuggerStepOut; |
| 255 bool m_javaScriptPauseScheduled; | 255 bool m_javaScriptPauseScheduled; |
| 256 bool m_steppingFromFramework; | 256 bool m_steppingFromFramework; |
| 257 bool m_pausingOnNativeEvent; | 257 bool m_pausingOnNativeEvent; |
| 258 bool m_pausingOnAsyncOperation; | 258 bool m_pausingOnAsyncOperation; |
| 259 RawPtrWillBeMember<Listener> m_listener; | |
| 260 | 259 |
| 261 int m_skippedStepFrameCount; | 260 int m_skippedStepFrameCount; |
| 262 int m_recursionLevelForStepOut; | 261 int m_recursionLevelForStepOut; |
| 263 int m_recursionLevelForStepFrame; | 262 int m_recursionLevelForStepFrame; |
| 264 bool m_skipAllPauses; | 263 bool m_skipAllPauses; |
| 265 bool m_skipContentScripts; | 264 bool m_skipContentScripts; |
| 266 OwnPtr<ScriptRegexp> m_cachedSkipStackRegExp; | 265 OwnPtr<ScriptRegexp> m_cachedSkipStackRegExp; |
| 267 unsigned m_cachedSkipStackGeneration; | 266 unsigned m_cachedSkipStackGeneration; |
| 268 WillBeHeapHashSet<RawPtrWillBeWeakMember<AsyncCallTrackingListener>> m_async
CallTrackingListeners; | 267 WillBeHeapHashSet<RawPtrWillBeWeakMember<AsyncCallTrackingListener>> m_async
CallTrackingListeners; |
| 269 // This field must be destroyed before the listeners set above. | 268 // This field must be destroyed before the listeners set above. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 283 int m_currentAsyncOperationId; | 282 int m_currentAsyncOperationId; |
| 284 bool m_pendingTraceAsyncOperationCompleted; | 283 bool m_pendingTraceAsyncOperationCompleted; |
| 285 bool m_startingStepIntoAsync; | 284 bool m_startingStepIntoAsync; |
| 286 V8GlobalValueMap<String, v8::Script, v8::kNotWeak> m_compiledScripts; | 285 V8GlobalValueMap<String, v8::Script, v8::kNotWeak> m_compiledScripts; |
| 287 }; | 286 }; |
| 288 | 287 |
| 289 } // namespace blink | 288 } // namespace blink |
| 290 | 289 |
| 291 | 290 |
| 292 #endif // V8DebuggerAgent_h | 291 #endif // V8DebuggerAgent_h |
| OLD | NEW |