| 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 V8DebuggerAgentImpl_h | 5 #ifndef V8DebuggerAgentImpl_h |
| 6 #define V8DebuggerAgentImpl_h | 6 #define V8DebuggerAgentImpl_h |
| 7 | 7 |
| 8 #include "platform/inspector_protocol/Collections.h" | 8 #include "platform/inspector_protocol/Collections.h" |
| 9 #include "platform/inspector_protocol/Dispatcher.h" | 9 #include "platform/inspector_protocol/Dispatcher.h" |
| 10 #include "platform/inspector_protocol/Frontend.h" | 10 #include "platform/inspector_protocol/Frontend.h" |
| 11 #include "platform/inspector_protocol/String16.h" | 11 #include "platform/inspector_protocol/String16.h" |
| 12 #include "platform/v8_inspector/V8DebuggerImpl.h" | 12 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 13 #include "platform/v8_inspector/public/V8DebuggerAgent.h" | 13 #include "platform/v8_inspector/public/V8DebuggerAgent.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class JavaScriptCallFrame; | 17 class JavaScriptCallFrame; |
| 18 class PromiseTracker; | 18 class PromiseTracker; |
| 19 class V8AsyncCallTracker; | |
| 20 class V8InspectorConnectionImpl; | 19 class V8InspectorConnectionImpl; |
| 21 class V8StackTraceImpl; | 20 class V8StackTraceImpl; |
| 22 | 21 |
| 23 namespace protocol { | 22 namespace protocol { |
| 24 class DictionaryValue; | 23 class DictionaryValue; |
| 25 } | 24 } |
| 26 | 25 |
| 27 using protocol::Maybe; | 26 using protocol::Maybe; |
| 28 | 27 |
| 29 class V8DebuggerAgentImpl : public V8DebuggerAgent { | 28 class V8DebuggerAgentImpl : public V8DebuggerAgent { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void breakProgramOnException(const String16& breakReason, PassOwnPtr<protoco
l::DictionaryValue> data) override; | 141 void breakProgramOnException(const String16& breakReason, PassOwnPtr<protoco
l::DictionaryValue> data) override; |
| 143 void willExecuteScript(int scriptId) override; | 142 void willExecuteScript(int scriptId) override; |
| 144 void didExecuteScript() override; | 143 void didExecuteScript() override; |
| 145 | 144 |
| 146 bool enabled() override; | 145 bool enabled() override; |
| 147 V8DebuggerImpl& debugger() override { return *m_debugger; } | 146 V8DebuggerImpl& debugger() override { return *m_debugger; } |
| 148 | 147 |
| 149 void setBreakpointAt(const String16& scriptId, int lineNumber, int columnNum
ber, BreakpointSource, const String16& condition = String16()); | 148 void setBreakpointAt(const String16& scriptId, int lineNumber, int columnNum
ber, BreakpointSource, const String16& condition = String16()); |
| 150 void removeBreakpointAt(const String16& scriptId, int lineNumber, int column
Number, BreakpointSource); | 149 void removeBreakpointAt(const String16& scriptId, int lineNumber, int column
Number, BreakpointSource); |
| 151 | 150 |
| 152 // Async call stacks implementation | 151 // Async call stacks implementation. |
| 153 int traceAsyncOperationStarting(const String16& description) override; | 152 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring
) override; |
| 154 void traceAsyncCallbackStarting(int operationId) override; | 153 void asyncTaskCanceled(void* task) override; |
| 155 void traceAsyncCallbackCompleted() override; | 154 void asyncTaskStarted(void* task) override; |
| 156 void traceAsyncOperationCompleted(int operationId) override; | 155 void asyncTaskFinished(void* task) override; |
| 157 bool trackingAsyncCalls() const override { return m_maxAsyncCallStackDepth;
} | 156 void allAsyncTasksCanceled() override; |
| 158 | 157 |
| 159 void reset(); | 158 void reset(); |
| 160 | 159 |
| 161 // Interface for V8DebuggerImpl | 160 // Interface for V8DebuggerImpl |
| 162 SkipPauseRequest didPause(v8::Local<v8::Context>, v8::Local<v8::Value> excep
tion, const protocol::Vector<String16>& hitBreakpoints, bool isPromiseRejection)
; | 161 SkipPauseRequest didPause(v8::Local<v8::Context>, v8::Local<v8::Value> excep
tion, const protocol::Vector<String16>& hitBreakpoints, bool isPromiseRejection)
; |
| 163 void didContinue(); | 162 void didContinue(); |
| 164 void didParseSource(const V8DebuggerParsedScript&); | 163 void didParseSource(const V8DebuggerParsedScript&); |
| 165 bool v8AsyncTaskEventsEnabled() const; | 164 bool v8AsyncTaskEventsEnabled() const; |
| 166 void didReceiveV8AsyncTaskEvent(v8::Local<v8::Context>, const String16& even
tType, const String16& eventName, int id); | 165 void didReceiveV8AsyncTaskEvent(v8::Local<v8::Context>, const String16& even
tType, const String16& eventName, int id); |
| 167 | 166 |
| 168 v8::Isolate* isolate() { return m_isolate; } | 167 v8::Isolate* isolate() { return m_isolate; } |
| 169 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } | 168 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } |
| 170 V8StackTraceImpl* currentAsyncCallChain(); | 169 V8StackTraceImpl* currentAsyncCallChain(); |
| 171 | 170 |
| 172 private: | 171 private: |
| 173 bool checkEnabled(ErrorString*); | 172 bool checkEnabled(ErrorString*); |
| 174 void enable(); | 173 void enable(); |
| 175 | 174 |
| 176 SkipPauseRequest shouldSkipExceptionPause(JavaScriptCallFrame* topCallFrame)
; | 175 SkipPauseRequest shouldSkipExceptionPause(JavaScriptCallFrame* topCallFrame)
; |
| 177 SkipPauseRequest shouldSkipStepPause(JavaScriptCallFrame* topCallFrame); | 176 SkipPauseRequest shouldSkipStepPause(JavaScriptCallFrame* topCallFrame); |
| 178 | 177 |
| 179 void schedulePauseOnNextStatementIfSteppingInto(); | 178 void schedulePauseOnNextStatementIfSteppingInto(); |
| 180 | 179 |
| 181 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> currentCallFrames
(ErrorString*); | 180 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> currentCallFrames
(ErrorString*); |
| 182 PassOwnPtr<protocol::Runtime::StackTrace> currentAsyncStackTrace(); | 181 PassOwnPtr<protocol::Runtime::StackTrace> currentAsyncStackTrace(); |
| 183 | 182 |
| 184 void clearCurrentAsyncOperation(); | |
| 185 void resetAsyncCallTracker(); | |
| 186 | |
| 187 void changeJavaScriptRecursionLevel(int step); | 183 void changeJavaScriptRecursionLevel(int step); |
| 188 | 184 |
| 189 void setPauseOnExceptionsImpl(ErrorString*, int); | 185 void setPauseOnExceptionsImpl(ErrorString*, int); |
| 190 | 186 |
| 191 PassOwnPtr<protocol::Debugger::Location> resolveBreakpoint(const String16& b
reakpointId, const String16& scriptId, const ScriptBreakpoint&, BreakpointSource
); | 187 PassOwnPtr<protocol::Debugger::Location> resolveBreakpoint(const String16& b
reakpointId, const String16& scriptId, const ScriptBreakpoint&, BreakpointSource
); |
| 192 void removeBreakpoint(const String16& breakpointId); | 188 void removeBreakpoint(const String16& breakpointId); |
| 193 bool assertPaused(ErrorString*); | 189 bool assertPaused(ErrorString*); |
| 194 void clearBreakDetails(); | 190 void clearBreakDetails(); |
| 195 | 191 |
| 196 bool isCurrentCallStackEmptyOrBlackboxed(); | 192 bool isCurrentCallStackEmptyOrBlackboxed(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 bool m_skipNextDebuggerStepOut; | 226 bool m_skipNextDebuggerStepOut; |
| 231 bool m_javaScriptPauseScheduled; | 227 bool m_javaScriptPauseScheduled; |
| 232 bool m_steppingFromFramework; | 228 bool m_steppingFromFramework; |
| 233 bool m_pausingOnNativeEvent; | 229 bool m_pausingOnNativeEvent; |
| 234 | 230 |
| 235 int m_skippedStepFrameCount; | 231 int m_skippedStepFrameCount; |
| 236 int m_recursionLevelForStepOut; | 232 int m_recursionLevelForStepOut; |
| 237 int m_recursionLevelForStepFrame; | 233 int m_recursionLevelForStepFrame; |
| 238 bool m_skipAllPauses; | 234 bool m_skipAllPauses; |
| 239 | 235 |
| 240 // This field must be destroyed before the listeners set above. | 236 using AsyncTaskToStackTrace = protocol::HashMap<void*, OwnPtr<V8StackTraceIm
pl>>; |
| 241 OwnPtr<V8AsyncCallTracker> m_v8AsyncCallTracker; | 237 AsyncTaskToStackTrace m_asyncTaskStacks; |
| 242 | 238 protocol::HashSet<void*> m_recurringTasks; |
| 243 using AsyncOperationIdToStackTrace = protocol::HashMap<int, OwnPtr<V8StackTr
aceImpl>>; | |
| 244 AsyncOperationIdToStackTrace m_asyncOperations; | |
| 245 int m_lastAsyncOperationId; | |
| 246 int m_maxAsyncCallStackDepth; | 239 int m_maxAsyncCallStackDepth; |
| 247 OwnPtr<V8StackTraceImpl> m_currentAsyncCallChain; | 240 #if ENABLE(ASSERT) |
| 248 unsigned m_nestedAsyncCallCount; | 241 Vector<void*> m_currentTasks; |
| 249 int m_currentAsyncOperationId; | 242 #endif |
| 250 bool m_pendingTraceAsyncOperationCompleted; | 243 Vector<OwnPtr<V8StackTraceImpl>> m_currentStacks; |
| 251 protocol::HashMap<String16, protocol::Vector<std::pair<int, int>>> m_blackbo
xedPositions; | 244 protocol::HashMap<String16, protocol::Vector<std::pair<int, int>>> m_blackbo
xedPositions; |
| 252 }; | 245 }; |
| 253 | 246 |
| 254 } // namespace blink | 247 } // namespace blink |
| 255 | 248 |
| 256 | 249 |
| 257 #endif // V8DebuggerAgentImpl_h | 250 #endif // V8DebuggerAgentImpl_h |
| OLD | NEW |