| 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/Dispatcher.h" | 9 #include "platform/inspector_protocol/Dispatcher.h" |
| 9 #include "platform/inspector_protocol/Frontend.h" | 10 #include "platform/inspector_protocol/Frontend.h" |
| 10 #include "platform/v8_inspector/ScriptBreakpoint.h" | 11 #include "platform/v8_inspector/ScriptBreakpoint.h" |
| 11 #include "platform/v8_inspector/V8DebuggerImpl.h" | 12 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 12 #include "platform/v8_inspector/public/V8DebuggerAgent.h" | 13 #include "platform/v8_inspector/public/V8DebuggerAgent.h" |
| 13 #include "wtf/HashMap.h" | |
| 14 #include "wtf/HashSet.h" | |
| 15 #include "wtf/ListHashSet.h" | |
| 16 #include "wtf/Vector.h" | |
| 17 #include "wtf/text/StringHash.h" | 14 #include "wtf/text/StringHash.h" |
| 18 | 15 |
| 19 namespace blink { | 16 namespace blink { |
| 20 | 17 |
| 21 class DevToolsFunctionInfo; | 18 class DevToolsFunctionInfo; |
| 22 class InjectedScript; | 19 class InjectedScript; |
| 23 class InjectedScriptManager; | 20 class InjectedScriptManager; |
| 24 class JavaScriptCallFrame; | 21 class JavaScriptCallFrame; |
| 25 class PromiseTracker; | 22 class PromiseTracker; |
| 26 class RemoteCallFrameId; | 23 class RemoteCallFrameId; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 int traceAsyncOperationStarting(const String& description) override; | 175 int traceAsyncOperationStarting(const String& description) override; |
| 179 void traceAsyncCallbackStarting(int operationId) override; | 176 void traceAsyncCallbackStarting(int operationId) override; |
| 180 void traceAsyncCallbackCompleted() override; | 177 void traceAsyncCallbackCompleted() override; |
| 181 void traceAsyncOperationCompleted(int operationId) override; | 178 void traceAsyncOperationCompleted(int operationId) override; |
| 182 bool trackingAsyncCalls() const override { return m_maxAsyncCallStackDepth;
} | 179 bool trackingAsyncCalls() const override { return m_maxAsyncCallStackDepth;
} |
| 183 | 180 |
| 184 void didUpdatePromise(const String& eventType, PassOwnPtr<protocol::Debugger
::PromiseDetails>); | 181 void didUpdatePromise(const String& eventType, PassOwnPtr<protocol::Debugger
::PromiseDetails>); |
| 185 void reset() override; | 182 void reset() override; |
| 186 | 183 |
| 187 // Interface for V8DebuggerImpl | 184 // Interface for V8DebuggerImpl |
| 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); | 185 SkipPauseRequest didPause(v8::Local<v8::Context>, v8::Local<v8::Object> call
Frames, v8::Local<v8::Value> exception, const protocol::Vector<String>& hitBreak
points, bool isPromiseRejection); |
| 189 void didContinue(); | 186 void didContinue(); |
| 190 void didParseSource(const V8DebuggerParsedScript&); | 187 void didParseSource(const V8DebuggerParsedScript&); |
| 191 bool v8AsyncTaskEventsEnabled() const; | 188 bool v8AsyncTaskEventsEnabled() const; |
| 192 void didReceiveV8AsyncTaskEvent(v8::Local<v8::Context>, const String& eventT
ype, const String& eventName, int id); | 189 void didReceiveV8AsyncTaskEvent(v8::Local<v8::Context>, const String& eventT
ype, const String& eventName, int id); |
| 193 bool v8PromiseEventsEnabled() const; | 190 bool v8PromiseEventsEnabled() const; |
| 194 void didReceiveV8PromiseEvent(v8::Local<v8::Context>, v8::Local<v8::Object>
promise, v8::Local<v8::Value> parentPromise, int status); | 191 void didReceiveV8PromiseEvent(v8::Local<v8::Context>, v8::Local<v8::Object>
promise, v8::Local<v8::Value> parentPromise, int status); |
| 195 | 192 |
| 196 v8::Isolate* isolate() { return m_isolate; } | 193 v8::Isolate* isolate() { return m_isolate; } |
| 197 PassOwnPtr<V8StackTraceImpl> currentAsyncStackTraceForRuntime(); | 194 PassOwnPtr<V8StackTraceImpl> currentAsyncStackTraceForRuntime(); |
| 198 | 195 |
| 199 private: | 196 private: |
| 200 bool checkEnabled(ErrorString*); | 197 bool checkEnabled(ErrorString*); |
| 201 void enable(); | 198 void enable(); |
| 202 | 199 |
| 203 SkipPauseRequest shouldSkipExceptionPause(); | 200 SkipPauseRequest shouldSkipExceptionPause(); |
| 204 SkipPauseRequest shouldSkipStepPause(); | 201 SkipPauseRequest shouldSkipStepPause(); |
| 205 bool isMuteBreakpointInstalled(); | |
| 206 | 202 |
| 207 void schedulePauseOnNextStatementIfSteppingInto(); | 203 void schedulePauseOnNextStatementIfSteppingInto(); |
| 208 | 204 |
| 209 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> currentCallFrames
(); | 205 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> currentCallFrames
(); |
| 210 PassOwnPtr<protocol::Runtime::StackTrace> currentAsyncStackTrace(); | 206 PassOwnPtr<protocol::Runtime::StackTrace> currentAsyncStackTrace(); |
| 211 | 207 |
| 212 void clearCurrentAsyncOperation(); | 208 void clearCurrentAsyncOperation(); |
| 213 void resetAsyncCallTracker(); | 209 void resetAsyncCallTracker(); |
| 214 | 210 |
| 215 void changeJavaScriptRecursionLevel(int step); | 211 void changeJavaScriptRecursionLevel(int step); |
| 216 | 212 |
| 217 void setPauseOnExceptionsImpl(ErrorString*, int); | 213 void setPauseOnExceptionsImpl(ErrorString*, int); |
| 218 | 214 |
| 219 PassOwnPtr<protocol::Debugger::Location> resolveBreakpoint(const String& bre
akpointId, const String& scriptId, const ScriptBreakpoint&, BreakpointSource); | 215 PassOwnPtr<protocol::Debugger::Location> resolveBreakpoint(const String& bre
akpointId, const String& scriptId, const ScriptBreakpoint&, BreakpointSource); |
| 220 void removeBreakpoint(const String& breakpointId); | 216 void removeBreakpoint(const String& breakpointId); |
| 221 void clearStepIntoAsync(); | 217 void clearStepIntoAsync(); |
| 222 bool assertPaused(ErrorString*); | 218 bool assertPaused(ErrorString*); |
| 223 void clearBreakDetails(); | 219 void clearBreakDetails(); |
| 224 | 220 |
| 225 bool isCallStackEmptyOrBlackboxed(); | 221 bool isCallStackEmptyOrBlackboxed(); |
| 226 bool isTopCallFrameBlackboxed(); | 222 bool isTopCallFrameBlackboxed(); |
| 227 bool isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCallFrame*); | 223 bool isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCallFrame*); |
| 228 | 224 |
| 229 void internalSetAsyncCallStackDepth(int); | 225 void internalSetAsyncCallStackDepth(int); |
| 230 void increaseCachedSkipStackGeneration(); | 226 void increaseCachedSkipStackGeneration(); |
| 231 | 227 |
| 232 using ScriptsMap = HashMap<String, V8DebuggerScript>; | 228 using ScriptsMap = protocol::HashMap<String, V8DebuggerScript>; |
| 233 using BreakpointIdToDebuggerBreakpointIdsMap = HashMap<String, Vector<String
>>; | 229 using BreakpointIdToDebuggerBreakpointIdsMap = protocol::HashMap<String, pro
tocol::Vector<String>>; |
| 234 using DebugServerBreakpointToBreakpointIdAndSourceMap = HashMap<String, std:
:pair<String, BreakpointSource>>; | 230 using DebugServerBreakpointToBreakpointIdAndSourceMap = protocol::HashMap<St
ring, std::pair<String, BreakpointSource>>; |
| 235 using MuteBreakpoins = HashMap<String, std::pair<String, int>>; | 231 using MuteBreakpoins = protocol::HashMap<String, std::pair<String, int>>; |
| 236 | 232 |
| 237 enum DebuggerStep { | 233 enum DebuggerStep { |
| 238 NoStep = 0, | 234 NoStep = 0, |
| 239 StepInto, | 235 StepInto, |
| 240 StepOver, | 236 StepOver, |
| 241 StepOut | 237 StepOut |
| 242 }; | 238 }; |
| 243 | 239 |
| 244 InjectedScriptManager* m_injectedScriptManager; | 240 InjectedScriptManager* m_injectedScriptManager; |
| 245 V8DebuggerImpl* m_debugger; | 241 V8DebuggerImpl* m_debugger; |
| 246 int m_contextGroupId; | 242 int m_contextGroupId; |
| 247 bool m_enabled; | 243 bool m_enabled; |
| 248 protocol::DictionaryValue* m_state; | 244 protocol::DictionaryValue* m_state; |
| 249 protocol::Frontend::Debugger* m_frontend; | 245 protocol::Frontend::Debugger* m_frontend; |
| 250 v8::Isolate* m_isolate; | 246 v8::Isolate* m_isolate; |
| 251 v8::Global<v8::Context> m_pausedContext; | 247 v8::Global<v8::Context> m_pausedContext; |
| 252 v8::Global<v8::Object> m_currentCallStack; | 248 v8::Global<v8::Object> m_currentCallStack; |
| 253 ScriptsMap m_scripts; | 249 ScriptsMap m_scripts; |
| 254 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds
; | 250 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds
; |
| 255 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints; | 251 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints; |
| 256 MuteBreakpoins m_muteBreakpoints; | |
| 257 String m_continueToLocationBreakpointId; | 252 String m_continueToLocationBreakpointId; |
| 258 String m_breakReason; | 253 String m_breakReason; |
| 259 OwnPtr<protocol::DictionaryValue> m_breakAuxData; | 254 OwnPtr<protocol::DictionaryValue> m_breakAuxData; |
| 260 DebuggerStep m_scheduledDebuggerStep; | 255 DebuggerStep m_scheduledDebuggerStep; |
| 261 bool m_skipNextDebuggerStepOut; | 256 bool m_skipNextDebuggerStepOut; |
| 262 bool m_javaScriptPauseScheduled; | 257 bool m_javaScriptPauseScheduled; |
| 263 bool m_steppingFromFramework; | 258 bool m_steppingFromFramework; |
| 264 bool m_pausingOnNativeEvent; | 259 bool m_pausingOnNativeEvent; |
| 265 bool m_pausingOnAsyncOperation; | 260 bool m_pausingOnAsyncOperation; |
| 266 | 261 |
| 267 int m_skippedStepFrameCount; | 262 int m_skippedStepFrameCount; |
| 268 int m_recursionLevelForStepOut; | 263 int m_recursionLevelForStepOut; |
| 269 int m_recursionLevelForStepFrame; | 264 int m_recursionLevelForStepFrame; |
| 270 bool m_skipAllPauses; | 265 bool m_skipAllPauses; |
| 271 | 266 |
| 272 // This field must be destroyed before the listeners set above. | 267 // This field must be destroyed before the listeners set above. |
| 273 OwnPtr<V8AsyncCallTracker> m_v8AsyncCallTracker; | 268 OwnPtr<V8AsyncCallTracker> m_v8AsyncCallTracker; |
| 274 OwnPtr<PromiseTracker> m_promiseTracker; | 269 OwnPtr<PromiseTracker> m_promiseTracker; |
| 275 | 270 |
| 276 using AsyncOperationIdToStackTrace = HashMap<int, OwnPtr<V8StackTraceImpl>>; | 271 using AsyncOperationIdToStackTrace = protocol::HashMap<int, OwnPtr<V8StackTr
aceImpl>>; |
| 277 AsyncOperationIdToStackTrace m_asyncOperations; | 272 AsyncOperationIdToStackTrace m_asyncOperations; |
| 278 int m_lastAsyncOperationId; | 273 int m_lastAsyncOperationId; |
| 279 ListHashSet<int> m_asyncOperationNotifications; | 274 protocol::HashSet<int> m_asyncOperationNotifications; |
| 280 HashSet<int> m_asyncOperationBreakpoints; | 275 protocol::HashSet<int> m_asyncOperationBreakpoints; |
| 281 HashSet<int> m_pausingAsyncOperations; | 276 protocol::HashSet<int> m_pausingAsyncOperations; |
| 282 unsigned m_maxAsyncCallStackDepth; | 277 unsigned m_maxAsyncCallStackDepth; |
| 283 OwnPtr<V8StackTraceImpl> m_currentAsyncCallChain; | 278 OwnPtr<V8StackTraceImpl> m_currentAsyncCallChain; |
| 284 unsigned m_nestedAsyncCallCount; | 279 unsigned m_nestedAsyncCallCount; |
| 285 int m_currentAsyncOperationId; | 280 int m_currentAsyncOperationId; |
| 286 bool m_pendingTraceAsyncOperationCompleted; | 281 bool m_pendingTraceAsyncOperationCompleted; |
| 287 bool m_startingStepIntoAsync; | 282 bool m_startingStepIntoAsync; |
| 288 HashMap<String, Vector<std::pair<int, int>>> m_blackboxedPositions; | 283 protocol::HashMap<String, protocol::Vector<std::pair<int, int>>> m_blackboxe
dPositions; |
| 289 }; | 284 }; |
| 290 | 285 |
| 291 } // namespace blink | 286 } // namespace blink |
| 292 | 287 |
| 293 | 288 |
| 294 #endif // V8DebuggerAgentImpl_h | 289 #endif // V8DebuggerAgentImpl_h |
| OLD | NEW |