| 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/Backend.h" | 8 #include "platform/inspector_protocol/Backend.h" |
| 9 #include "platform/inspector_protocol/Collections.h" | 9 #include "platform/inspector_protocol/Collections.h" |
| 10 #include "platform/inspector_protocol/Frontend.h" | 10 #include "platform/inspector_protocol/Frontend.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 void disable(ErrorString*) override; | 51 void disable(ErrorString*) override; |
| 52 void setBreakpointsActive(ErrorString*, bool active) override; | 52 void setBreakpointsActive(ErrorString*, bool active) override; |
| 53 void setSkipAllPauses(ErrorString*, bool skipped) override; | 53 void setSkipAllPauses(ErrorString*, bool skipped) override; |
| 54 void setBreakpointByUrl(ErrorString*, | 54 void setBreakpointByUrl(ErrorString*, |
| 55 int lineNumber, | 55 int lineNumber, |
| 56 const Maybe<String16>& optionalURL, | 56 const Maybe<String16>& optionalURL, |
| 57 const Maybe<String16>& optionalURLRegex, | 57 const Maybe<String16>& optionalURLRegex, |
| 58 const Maybe<int>& optionalColumnNumber, | 58 const Maybe<int>& optionalColumnNumber, |
| 59 const Maybe<String16>& optionalCondition, | 59 const Maybe<String16>& optionalCondition, |
| 60 String16*, | 60 String16*, |
| 61 OwnPtr<protocol::Array<protocol::Debugger::Location>>* locations) overri
de; | 61 std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* location
s) override; |
| 62 void setBreakpoint(ErrorString*, | 62 void setBreakpoint(ErrorString*, |
| 63 PassOwnPtr<protocol::Debugger::Location>, | 63 std::unique_ptr<protocol::Debugger::Location>, |
| 64 const Maybe<String16>& optionalCondition, | 64 const Maybe<String16>& optionalCondition, |
| 65 String16*, | 65 String16*, |
| 66 OwnPtr<protocol::Debugger::Location>* actualLocation) override; | 66 std::unique_ptr<protocol::Debugger::Location>* actualLocation) override; |
| 67 void removeBreakpoint(ErrorString*, const String16& breakpointId) override; | 67 void removeBreakpoint(ErrorString*, const String16& breakpointId) override; |
| 68 void continueToLocation(ErrorString*, | 68 void continueToLocation(ErrorString*, |
| 69 PassOwnPtr<protocol::Debugger::Location>, | 69 std::unique_ptr<protocol::Debugger::Location>, |
| 70 const Maybe<bool>& interstateLocationOpt) override; | 70 const Maybe<bool>& interstateLocationOpt) override; |
| 71 void getBacktrace(ErrorString*, | 71 void getBacktrace(ErrorString*, |
| 72 OwnPtr<protocol::Array<protocol::Debugger::CallFrame>>*, | 72 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*, |
| 73 Maybe<protocol::Runtime::StackTrace>*) override; | 73 Maybe<protocol::Runtime::StackTrace>*) override; |
| 74 void searchInContent(ErrorString*, | 74 void searchInContent(ErrorString*, |
| 75 const String16& scriptId, | 75 const String16& scriptId, |
| 76 const String16& query, | 76 const String16& query, |
| 77 const Maybe<bool>& optionalCaseSensitive, | 77 const Maybe<bool>& optionalCaseSensitive, |
| 78 const Maybe<bool>& optionalIsRegex, | 78 const Maybe<bool>& optionalIsRegex, |
| 79 OwnPtr<protocol::Array<protocol::Debugger::SearchMatch>>*) override; | 79 std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>>*) over
ride; |
| 80 void canSetScriptSource(ErrorString*, bool* result) override { *result = tru
e; } | 80 void canSetScriptSource(ErrorString*, bool* result) override { *result = tru
e; } |
| 81 void setScriptSource(ErrorString*, | 81 void setScriptSource(ErrorString*, |
| 82 const String16& inScriptId, | 82 const String16& inScriptId, |
| 83 const String16& inScriptSource, | 83 const String16& inScriptSource, |
| 84 const Maybe<bool>& inPreview, | 84 const Maybe<bool>& inPreview, |
| 85 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* optOutCallFrames, | 85 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* optOutCallFrames, |
| 86 Maybe<bool>* optOutStackChanged, | 86 Maybe<bool>* optOutStackChanged, |
| 87 Maybe<protocol::Runtime::StackTrace>* optOutAsyncStackTrace, | 87 Maybe<protocol::Runtime::StackTrace>* optOutAsyncStackTrace, |
| 88 Maybe<protocol::Debugger::SetScriptSourceError>* optOutCompileError) ove
rride; | 88 Maybe<protocol::Debugger::SetScriptSourceError>* optOutCompileError) ove
rride; |
| 89 void restartFrame(ErrorString*, | 89 void restartFrame(ErrorString*, |
| 90 const String16& callFrameId, | 90 const String16& callFrameId, |
| 91 OwnPtr<protocol::Array<protocol::Debugger::CallFrame>>* newCallFrames, | 91 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>* newCall
Frames, |
| 92 Maybe<protocol::Runtime::StackTrace>* asyncStackTrace) override; | 92 Maybe<protocol::Runtime::StackTrace>* asyncStackTrace) override; |
| 93 void getScriptSource(ErrorString*, const String16& scriptId, String16* scrip
tSource) override; | 93 void getScriptSource(ErrorString*, const String16& scriptId, String16* scrip
tSource) override; |
| 94 void getFunctionDetails(ErrorString*, | 94 void getFunctionDetails(ErrorString*, |
| 95 const String16& functionId, | 95 const String16& functionId, |
| 96 OwnPtr<protocol::Debugger::FunctionDetails>*) override; | 96 std::unique_ptr<protocol::Debugger::FunctionDetails>*) override; |
| 97 void getGeneratorObjectDetails(ErrorString*, | 97 void getGeneratorObjectDetails(ErrorString*, |
| 98 const String16& objectId, | 98 const String16& objectId, |
| 99 OwnPtr<protocol::Debugger::GeneratorObjectDetails>*) override; | 99 std::unique_ptr<protocol::Debugger::GeneratorObjectDetails>*) override; |
| 100 void getCollectionEntries(ErrorString*, | 100 void getCollectionEntries(ErrorString*, |
| 101 const String16& objectId, | 101 const String16& objectId, |
| 102 OwnPtr<protocol::Array<protocol::Debugger::CollectionEntry>>*) override; | 102 std::unique_ptr<protocol::Array<protocol::Debugger::CollectionEntry>>*)
override; |
| 103 void pause(ErrorString*) override; | 103 void pause(ErrorString*) override; |
| 104 void resume(ErrorString*) override; | 104 void resume(ErrorString*) override; |
| 105 void stepOver(ErrorString*) override; | 105 void stepOver(ErrorString*) override; |
| 106 void stepInto(ErrorString*) override; | 106 void stepInto(ErrorString*) override; |
| 107 void stepOut(ErrorString*) override; | 107 void stepOut(ErrorString*) override; |
| 108 void setPauseOnExceptions(ErrorString*, const String16& pauseState) override
; | 108 void setPauseOnExceptions(ErrorString*, const String16& pauseState) override
; |
| 109 void evaluateOnCallFrame(ErrorString*, | 109 void evaluateOnCallFrame(ErrorString*, |
| 110 const String16& callFrameId, | 110 const String16& callFrameId, |
| 111 const String16& expression, | 111 const String16& expression, |
| 112 const Maybe<String16>& objectGroup, | 112 const Maybe<String16>& objectGroup, |
| 113 const Maybe<bool>& includeCommandLineAPI, | 113 const Maybe<bool>& includeCommandLineAPI, |
| 114 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, | 114 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, |
| 115 const Maybe<bool>& returnByValue, | 115 const Maybe<bool>& returnByValue, |
| 116 const Maybe<bool>& generatePreview, | 116 const Maybe<bool>& generatePreview, |
| 117 OwnPtr<protocol::Runtime::RemoteObject>* result, | 117 std::unique_ptr<protocol::Runtime::RemoteObject>* result, |
| 118 Maybe<bool>* wasThrown, | 118 Maybe<bool>* wasThrown, |
| 119 Maybe<protocol::Runtime::ExceptionDetails>*) override; | 119 Maybe<protocol::Runtime::ExceptionDetails>*) override; |
| 120 void setVariableValue(ErrorString*, | 120 void setVariableValue(ErrorString*, |
| 121 int scopeNumber, | 121 int scopeNumber, |
| 122 const String16& variableName, | 122 const String16& variableName, |
| 123 PassOwnPtr<protocol::Runtime::CallArgument> newValue, | 123 std::unique_ptr<protocol::Runtime::CallArgument> newValue, |
| 124 const String16& callFrame) override; | 124 const String16& callFrame) override; |
| 125 void setAsyncCallStackDepth(ErrorString*, int depth) override; | 125 void setAsyncCallStackDepth(ErrorString*, int depth) override; |
| 126 void setBlackboxPatterns(ErrorString*, | 126 void setBlackboxPatterns(ErrorString*, |
| 127 PassOwnPtr<protocol::Array<String16>> patterns) override; | 127 std::unique_ptr<protocol::Array<String16>> patterns) override; |
| 128 void setBlackboxedRanges(ErrorString*, | 128 void setBlackboxedRanges(ErrorString*, |
| 129 const String16& scriptId, | 129 const String16& scriptId, |
| 130 PassOwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> position
s) override; | 130 std::unique_ptr<protocol::Array<protocol::Debugger::ScriptPosition>> pos
itions) override; |
| 131 | 131 |
| 132 bool enabled(); | 132 bool enabled(); |
| 133 V8DebuggerImpl& debugger() { return *m_debugger; } | 133 V8DebuggerImpl& debugger() { return *m_debugger; } |
| 134 | 134 |
| 135 void setBreakpointAt(const String16& scriptId, int lineNumber, int columnNum
ber, BreakpointSource, const String16& condition = String16()); | 135 void setBreakpointAt(const String16& scriptId, int lineNumber, int columnNum
ber, BreakpointSource, const String16& condition = String16()); |
| 136 void removeBreakpointAt(const String16& scriptId, int lineNumber, int column
Number, BreakpointSource); | 136 void removeBreakpointAt(const String16& scriptId, int lineNumber, int column
Number, BreakpointSource); |
| 137 void schedulePauseOnNextStatement(const String16& breakReason, PassOwnPtr<pr
otocol::DictionaryValue> data); | 137 void schedulePauseOnNextStatement(const String16& breakReason, std::unique_p
tr<protocol::DictionaryValue> data); |
| 138 void cancelPauseOnNextStatement(); | 138 void cancelPauseOnNextStatement(); |
| 139 void breakProgram(const String16& breakReason, PassOwnPtr<protocol::Dictiona
ryValue> data); | 139 void breakProgram(const String16& breakReason, std::unique_ptr<protocol::Dic
tionaryValue> data); |
| 140 void breakProgramOnException(const String16& breakReason, PassOwnPtr<protoco
l::DictionaryValue> data); | 140 void breakProgramOnException(const String16& breakReason, std::unique_ptr<pr
otocol::DictionaryValue> data); |
| 141 | 141 |
| 142 // Async call stacks implementation. | 142 // Async call stacks implementation. |
| 143 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring
); | 143 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring
); |
| 144 void asyncTaskCanceled(void* task); | 144 void asyncTaskCanceled(void* task); |
| 145 void asyncTaskStarted(void* task); | 145 void asyncTaskStarted(void* task); |
| 146 void asyncTaskFinished(void* task); | 146 void asyncTaskFinished(void* task); |
| 147 void allAsyncTasksCanceled(); | 147 void allAsyncTasksCanceled(); |
| 148 | 148 |
| 149 void reset(); | 149 void reset(); |
| 150 | 150 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 163 | 163 |
| 164 private: | 164 private: |
| 165 bool checkEnabled(ErrorString*); | 165 bool checkEnabled(ErrorString*); |
| 166 void enable(); | 166 void enable(); |
| 167 | 167 |
| 168 SkipPauseRequest shouldSkipExceptionPause(JavaScriptCallFrame* topCallFrame)
; | 168 SkipPauseRequest shouldSkipExceptionPause(JavaScriptCallFrame* topCallFrame)
; |
| 169 SkipPauseRequest shouldSkipStepPause(JavaScriptCallFrame* topCallFrame); | 169 SkipPauseRequest shouldSkipStepPause(JavaScriptCallFrame* topCallFrame); |
| 170 | 170 |
| 171 void schedulePauseOnNextStatementIfSteppingInto(); | 171 void schedulePauseOnNextStatementIfSteppingInto(); |
| 172 | 172 |
| 173 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> currentCallFrames
(ErrorString*); | 173 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>> currentCallF
rames(ErrorString*); |
| 174 PassOwnPtr<protocol::Runtime::StackTrace> currentAsyncStackTrace(); | 174 std::unique_ptr<protocol::Runtime::StackTrace> currentAsyncStackTrace(); |
| 175 | 175 |
| 176 void changeJavaScriptRecursionLevel(int step); | 176 void changeJavaScriptRecursionLevel(int step); |
| 177 | 177 |
| 178 void setPauseOnExceptionsImpl(ErrorString*, int); | 178 void setPauseOnExceptionsImpl(ErrorString*, int); |
| 179 | 179 |
| 180 PassOwnPtr<protocol::Debugger::Location> resolveBreakpoint(const String16& b
reakpointId, const String16& scriptId, const ScriptBreakpoint&, BreakpointSource
); | 180 std::unique_ptr<protocol::Debugger::Location> resolveBreakpoint(const String
16& breakpointId, const String16& scriptId, const ScriptBreakpoint&, BreakpointS
ource); |
| 181 void removeBreakpoint(const String16& breakpointId); | 181 void removeBreakpoint(const String16& breakpointId); |
| 182 bool assertPaused(ErrorString*); | 182 bool assertPaused(ErrorString*); |
| 183 void clearBreakDetails(); | 183 void clearBreakDetails(); |
| 184 | 184 |
| 185 bool isCurrentCallStackEmptyOrBlackboxed(); | 185 bool isCurrentCallStackEmptyOrBlackboxed(); |
| 186 bool isTopPausedCallFrameBlackboxed(); | 186 bool isTopPausedCallFrameBlackboxed(); |
| 187 bool isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCallFrame*); | 187 bool isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCallFrame*); |
| 188 | 188 |
| 189 void internalSetAsyncCallStackDepth(int); | 189 void internalSetAsyncCallStackDepth(int); |
| 190 void increaseCachedSkipStackGeneration(); | 190 void increaseCachedSkipStackGeneration(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 209 protocol::DictionaryValue* m_state; | 209 protocol::DictionaryValue* m_state; |
| 210 protocol::Frontend::Debugger* m_frontend; | 210 protocol::Frontend::Debugger* m_frontend; |
| 211 v8::Isolate* m_isolate; | 211 v8::Isolate* m_isolate; |
| 212 v8::Global<v8::Context> m_pausedContext; | 212 v8::Global<v8::Context> m_pausedContext; |
| 213 JavaScriptCallFrames m_pausedCallFrames; | 213 JavaScriptCallFrames m_pausedCallFrames; |
| 214 ScriptsMap m_scripts; | 214 ScriptsMap m_scripts; |
| 215 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds
; | 215 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds
; |
| 216 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints; | 216 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints; |
| 217 String16 m_continueToLocationBreakpointId; | 217 String16 m_continueToLocationBreakpointId; |
| 218 String16 m_breakReason; | 218 String16 m_breakReason; |
| 219 OwnPtr<protocol::DictionaryValue> m_breakAuxData; | 219 std::unique_ptr<protocol::DictionaryValue> m_breakAuxData; |
| 220 DebuggerStep m_scheduledDebuggerStep; | 220 DebuggerStep m_scheduledDebuggerStep; |
| 221 bool m_skipNextDebuggerStepOut; | 221 bool m_skipNextDebuggerStepOut; |
| 222 bool m_javaScriptPauseScheduled; | 222 bool m_javaScriptPauseScheduled; |
| 223 bool m_steppingFromFramework; | 223 bool m_steppingFromFramework; |
| 224 bool m_pausingOnNativeEvent; | 224 bool m_pausingOnNativeEvent; |
| 225 | 225 |
| 226 int m_skippedStepFrameCount; | 226 int m_skippedStepFrameCount; |
| 227 int m_recursionLevelForStepOut; | 227 int m_recursionLevelForStepOut; |
| 228 int m_recursionLevelForStepFrame; | 228 int m_recursionLevelForStepFrame; |
| 229 bool m_skipAllPauses; | 229 bool m_skipAllPauses; |
| 230 | 230 |
| 231 using AsyncTaskToStackTrace = protocol::HashMap<void*, OwnPtr<V8StackTraceIm
pl>>; | 231 using AsyncTaskToStackTrace = protocol::HashMap<void*, std::unique_ptr<V8Sta
ckTraceImpl>>; |
| 232 AsyncTaskToStackTrace m_asyncTaskStacks; | 232 AsyncTaskToStackTrace m_asyncTaskStacks; |
| 233 protocol::HashSet<void*> m_recurringTasks; | 233 protocol::HashSet<void*> m_recurringTasks; |
| 234 int m_maxAsyncCallStackDepth; | 234 int m_maxAsyncCallStackDepth; |
| 235 #if ENABLE(ASSERT) | 235 #if ENABLE(ASSERT) |
| 236 protocol::Vector<void*> m_currentTasks; | 236 protocol::Vector<void*> m_currentTasks; |
| 237 #endif | 237 #endif |
| 238 protocol::Vector<OwnPtr<V8StackTraceImpl>> m_currentStacks; | 238 protocol::Vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; |
| 239 OwnPtr<V8Regex> m_blackboxPattern; | 239 std::unique_ptr<V8Regex> m_blackboxPattern; |
| 240 protocol::HashMap<String16, protocol::Vector<std::pair<int, int>>> m_blackbo
xedPositions; | 240 protocol::HashMap<String16, protocol::Vector<std::pair<int, int>>> m_blackbo
xedPositions; |
| 241 }; | 241 }; |
| 242 | 242 |
| 243 } // namespace blink | 243 } // namespace blink |
| 244 | 244 |
| 245 | 245 |
| 246 #endif // V8DebuggerAgentImpl_h | 246 #endif // V8DebuggerAgentImpl_h |
| OLD | NEW |