Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.h

Issue 1702673002: DevTools: migrate remote debugging protocol generators to jinja2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/Dispatcher.h" 8 #include "platform/inspector_protocol/Dispatcher.h"
9 #include "platform/inspector_protocol/Frontend.h" 9 #include "platform/inspector_protocol/Frontend.h"
10 #include "platform/v8_inspector/ScriptBreakpoint.h" 10 #include "platform/v8_inspector/ScriptBreakpoint.h"
(...skipping 17 matching lines...) Expand all
28 class JavaScriptCallFrame; 28 class JavaScriptCallFrame;
29 class JSONObject; 29 class JSONObject;
30 class PromiseTracker; 30 class PromiseTracker;
31 class RemoteCallFrameId; 31 class RemoteCallFrameId;
32 class ScriptRegexp; 32 class ScriptRegexp;
33 class V8AsyncCallTracker; 33 class V8AsyncCallTracker;
34 class V8StackTraceImpl; 34 class V8StackTraceImpl;
35 35
36 typedef String ErrorString; 36 typedef String ErrorString;
37 37
38 using protocol::OptionalValue;
39
38 class V8DebuggerAgentImpl : public V8DebuggerAgent { 40 class V8DebuggerAgentImpl : public V8DebuggerAgent {
39 WTF_MAKE_NONCOPYABLE(V8DebuggerAgentImpl); 41 WTF_MAKE_NONCOPYABLE(V8DebuggerAgentImpl);
40 USING_FAST_MALLOC(V8DebuggerAgentImpl); 42 USING_FAST_MALLOC(V8DebuggerAgentImpl);
41 public: 43 public:
42 enum SkipPauseRequest { 44 enum SkipPauseRequest {
43 RequestNoSkip, 45 RequestNoSkip,
44 RequestContinue, 46 RequestContinue,
45 RequestStepInto, 47 RequestStepInto,
46 RequestStepOut, 48 RequestStepOut,
47 RequestStepFrame 49 RequestStepFrame
(...skipping 14 matching lines...) Expand all
62 void restore() override; 64 void restore() override;
63 void disable(ErrorString*); 65 void disable(ErrorString*);
64 66
65 bool isPaused() override; 67 bool isPaused() override;
66 68
67 // Part of the protocol. 69 // Part of the protocol.
68 void enable(ErrorString*) override; 70 void enable(ErrorString*) override;
69 void setBreakpointsActive(ErrorString*, bool active) override; 71 void setBreakpointsActive(ErrorString*, bool active) override;
70 void setSkipAllPauses(ErrorString*, bool skipped) override; 72 void setSkipAllPauses(ErrorString*, bool skipped) override;
71 73
72 void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optional URL, const String* optionalURLRegex, const int* optionalColumnNumber, const Stri ng* optionalCondition, protocol::TypeBuilder::Debugger::BreakpointId*, RefPtr<pr otocol::TypeBuilder::Array<protocol::TypeBuilder::Debugger::Location>>& location s) override; 74 void setBreakpointByUrl(ErrorString*,
73 void setBreakpoint(ErrorString*, const RefPtr<JSONObject>& location, const S tring* optionalCondition, protocol::TypeBuilder::Debugger::BreakpointId*, RefPtr <protocol::TypeBuilder::Debugger::Location>& actualLocation) override; 75 int lineNumber,
76 const OptionalValue<String>& optionalURL,
77 const OptionalValue<String>& optionalURLRegex,
78 const OptionalValue<int>& optionalColumnNumber,
79 const OptionalValue<String>& optionalCondition,
80 protocol::Debugger::BreakpointId*,
81 OwnPtr<protocol::Array<protocol::Debugger::Location>>* locations) overri de;
82 void setBreakpoint(ErrorString*,
83 PassOwnPtr<protocol::Debugger::Location>,
84 const OptionalValue<String>& optionalCondition,
85 protocol::Debugger::BreakpointId*,
86 OwnPtr<protocol::Debugger::Location>* actualLocation) override;
74 void removeBreakpoint(ErrorString*, const String& breakpointId) override; 87 void removeBreakpoint(ErrorString*, const String& breakpointId) override;
75 void continueToLocation(ErrorString*, const RefPtr<JSONObject>& location, co nst bool* interstateLocationOpt) override; 88 void continueToLocation(ErrorString*,
76 void getStepInPositions(ErrorString*, const String& callFrameId, RefPtr<prot ocol::TypeBuilder::Array<protocol::TypeBuilder::Debugger::Location>>& positions) override; 89 PassOwnPtr<protocol::Debugger::Location>,
77 void getBacktrace(ErrorString*, RefPtr<protocol::TypeBuilder::Array<protocol ::TypeBuilder::Debugger::CallFrame>>&, RefPtr<protocol::TypeBuilder::Debugger::S tackTrace>&) override; 90 const OptionalValue<bool>& interstateLocationOpt) override;
78 void searchInContent(ErrorString*, const String& scriptId, const String& que ry, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<proto col::TypeBuilder::Array<protocol::TypeBuilder::Debugger::SearchMatch>>&) overrid e; 91 void getStepInPositions(ErrorString*,
92 const String& callFrameId,
93 OwnPtr<protocol::Array<protocol::Debugger::Location>>* positions) overri de;
94 void getBacktrace(ErrorString*,
95 OwnPtr<protocol::Array<protocol::Debugger::CallFrame>>*,
96 OwnPtr<protocol::Debugger::StackTrace>*) override;
97 void searchInContent(ErrorString*,
98 const String& scriptId,
99 const String& query,
100 const OptionalValue<bool>& optionalCaseSensitive,
101 const OptionalValue<bool>& optionalIsRegex,
102 OwnPtr<protocol::Array<protocol::Debugger::SearchMatch>>*) override;
79 void canSetScriptSource(ErrorString*, bool* result) override { *result = tru e; } 103 void canSetScriptSource(ErrorString*, bool* result) override { *result = tru e; }
80 void setScriptSource(ErrorString*, const String& inScriptId, const String& i nScriptSource, const bool* inPreview, RefPtr<protocol::TypeBuilder::Array<protoc ol::TypeBuilder::Debugger::CallFrame>>& optOutCallFrames, protocol::TypeBuilder: :OptOutput<bool>* optOutStackChanged, RefPtr<protocol::TypeBuilder::Debugger::St ackTrace>& optOutAsyncStackTrace, RefPtr<protocol::TypeBuilder::Debugger::SetScr iptSourceError>& optOutCompileError) override; 104 void setScriptSource(ErrorString*,
81 void restartFrame(ErrorString*, const String& callFrameId, RefPtr<protocol:: TypeBuilder::Array<protocol::TypeBuilder::Debugger::CallFrame>>& newCallFrames, RefPtr<protocol::TypeBuilder::Debugger::StackTrace>& asyncStackTrace) override; 105 const String& inScriptId,
106 const String& inScriptSource,
107 const OptionalValue<bool>& inPreview,
108 OwnPtr<protocol::Array<protocol::Debugger::CallFrame>>* optOutCallFrames ,
109 OptionalValue<bool>* optOutStackChanged,
110 OwnPtr<protocol::Debugger::StackTrace>* optOutAsyncStackTrace,
111 OwnPtr<protocol::Debugger::SetScriptSourceError>* optOutCompileError) ov erride;
112 void restartFrame(ErrorString*,
113 const String& callFrameId,
114 OwnPtr<protocol::Array<protocol::Debugger::CallFrame>>* newCallFrames,
115 OwnPtr<protocol::Debugger::StackTrace>* asyncStackTrace) override;
82 void getScriptSource(ErrorString*, const String& scriptId, String* scriptSou rce) override; 116 void getScriptSource(ErrorString*, const String& scriptId, String* scriptSou rce) override;
83 void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<proto col::TypeBuilder::Debugger::FunctionDetails>&) override; 117 void getFunctionDetails(ErrorString*,
84 void getGeneratorObjectDetails(ErrorString*, const String& objectId, RefPtr< protocol::TypeBuilder::Debugger::GeneratorObjectDetails>&) override; 118 const String& functionId,
85 void getCollectionEntries(ErrorString*, const String& objectId, RefPtr<proto col::TypeBuilder::Array<protocol::TypeBuilder::Debugger::CollectionEntry>>&) ove rride; 119 OwnPtr<protocol::Debugger::FunctionDetails>*) override;
120 void getGeneratorObjectDetails(ErrorString*,
121 const String& objectId,
122 OwnPtr<protocol::Debugger::GeneratorObjectDetails>*) override;
123 void getCollectionEntries(ErrorString*,
124 const String& objectId,
125 OwnPtr<protocol::Array<protocol::Debugger::CollectionEntry>>*) override;
86 void pause(ErrorString*) override; 126 void pause(ErrorString*) override;
87 void resume(ErrorString*) override; 127 void resume(ErrorString*) override;
88 void stepOver(ErrorString*) override; 128 void stepOver(ErrorString*) override;
89 void stepInto(ErrorString*) override; 129 void stepInto(ErrorString*) override;
90 void stepOut(ErrorString*) override; 130 void stepOut(ErrorString*) override;
91 void stepIntoAsync(ErrorString*) override; 131 void stepIntoAsync(ErrorString*) override;
92 void setPauseOnExceptions(ErrorString*, const String& pauseState) override; 132 void setPauseOnExceptions(ErrorString*, const String& pauseState) override;
93 void evaluateOnCallFrame(ErrorString*, 133 void evaluateOnCallFrame(ErrorString*,
94 const String& callFrameId, 134 const String& callFrameId,
95 const String& expression, 135 const String& expression,
96 const String* objectGroup, 136 const OptionalValue<String>& objectGroup,
97 const bool* includeCommandLineAPI, 137 const OptionalValue<bool>& includeCommandLineAPI,
98 const bool* doNotPauseOnExceptionsAndMuteConsole, 138 const OptionalValue<bool>& doNotPauseOnExceptionsAndMuteConsole,
99 const bool* returnByValue, 139 const OptionalValue<bool>& returnByValue,
100 const bool* generatePreview, 140 const OptionalValue<bool>& generatePreview,
101 RefPtr<protocol::TypeBuilder::Runtime::RemoteObject>& result, 141 OwnPtr<protocol::Runtime::RemoteObject>* result,
102 protocol::TypeBuilder::OptOutput<bool>* wasThrown, 142 OptionalValue<bool>* wasThrown,
103 RefPtr<protocol::TypeBuilder::Runtime::ExceptionDetails>&) override; 143 OwnPtr<protocol::Runtime::ExceptionDetails>*) override;
104 void setVariableValue(ErrorString*, int in_scopeNumber, const String& in_var iableName, const RefPtr<JSONObject>& in_newValue, const String* in_callFrame, co nst String* in_functionObjectId) override; 144 void setVariableValue(ErrorString*,
145 int scopeNumber,
146 const String& variableName,
147 PassOwnPtr<protocol::Runtime::CallArgument> newValue,
148 const OptionalValue<String>& callFrame,
149 const OptionalValue<String>& functionObjectId) override;
105 void setAsyncCallStackDepth(ErrorString*, int depth) override; 150 void setAsyncCallStackDepth(ErrorString*, int depth) override;
106 void enablePromiseTracker(ErrorString*, const bool* captureStacks) override; 151 void enablePromiseTracker(ErrorString*,
152 const OptionalValue<bool>& captureStacks) override;
107 void disablePromiseTracker(ErrorString*) override; 153 void disablePromiseTracker(ErrorString*) override;
108 void getPromiseById(ErrorString*, int promiseId, const String* objectGroup, RefPtr<protocol::TypeBuilder::Runtime::RemoteObject>& promise) override; 154 void getPromiseById(ErrorString*,
155 int promiseId,
156 const OptionalValue<String>& objectGroup,
157 OwnPtr<protocol::Runtime::RemoteObject>* promise) override;
109 void flushAsyncOperationEvents(ErrorString*) override; 158 void flushAsyncOperationEvents(ErrorString*) override;
110 void setAsyncOperationBreakpoint(ErrorString*, int operationId) override; 159 void setAsyncOperationBreakpoint(ErrorString*, int operationId) override;
111 void removeAsyncOperationBreakpoint(ErrorString*, int operationId) override; 160 void removeAsyncOperationBreakpoint(ErrorString*, int operationId) override;
112 void setBlackboxedRanges(ErrorString*, const String& scriptId, const RefPtr< JSONArray>& positions) override; 161 void setBlackboxedRanges(ErrorString*,
162 const String& scriptId,
163 PassOwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> position s) override;
113 164
114 void schedulePauseOnNextStatement(protocol::Frontend::Debugger::Reason::Enum breakReason, PassRefPtr<JSONObject> data) override; 165 void schedulePauseOnNextStatement(const String& breakReason, PassRefPtr<JSON Object> data) override;
115 void cancelPauseOnNextStatement() override; 166 void cancelPauseOnNextStatement() override;
116 bool canBreakProgram() override; 167 bool canBreakProgram() override;
117 void breakProgram(protocol::Frontend::Debugger::Reason::Enum breakReason, Pa ssRefPtr<JSONObject> data) override; 168 void breakProgram(const String& breakReason, PassRefPtr<JSONObject> data) ov erride;
118 void breakProgramOnException(protocol::Frontend::Debugger::Reason::Enum brea kReason, PassRefPtr<JSONObject> data) override; 169 void breakProgramOnException(const String& breakReason, PassRefPtr<JSONObjec t> data) override;
119 void willExecuteScript(int scriptId) override; 170 void willExecuteScript(int scriptId) override;
120 void didExecuteScript() override; 171 void didExecuteScript() override;
121 172
122 bool enabled() override; 173 bool enabled() override;
123 V8DebuggerImpl& debugger() override { return *m_debugger; } 174 V8DebuggerImpl& debugger() override { return *m_debugger; }
124 175
125 void setBreakpointAt(const String& scriptId, int lineNumber, int columnNumbe r, BreakpointSource, const String& condition = String()); 176 void setBreakpointAt(const String& scriptId, int lineNumber, int columnNumbe r, BreakpointSource, const String& condition = String());
126 void removeBreakpointAt(const String& scriptId, int lineNumber, int columnNu mber, BreakpointSource); 177 void removeBreakpointAt(const String& scriptId, int lineNumber, int columnNu mber, BreakpointSource);
127 178
128 // Async call stacks implementation 179 // Async call stacks implementation
129 int traceAsyncOperationStarting(const String& description) override; 180 int traceAsyncOperationStarting(const String& description) override;
130 void traceAsyncCallbackStarting(int operationId) override; 181 void traceAsyncCallbackStarting(int operationId) override;
131 void traceAsyncCallbackCompleted() override; 182 void traceAsyncCallbackCompleted() override;
132 void traceAsyncOperationCompleted(int operationId) override; 183 void traceAsyncOperationCompleted(int operationId) override;
133 bool trackingAsyncCalls() const override { return m_maxAsyncCallStackDepth; } 184 bool trackingAsyncCalls() const override { return m_maxAsyncCallStackDepth; }
134 185
135 void didUpdatePromise(protocol::Frontend::Debugger::EventType::Enum, PassRef Ptr<protocol::TypeBuilder::Debugger::PromiseDetails>); 186 void didUpdatePromise(const String& eventType, PassOwnPtr<protocol::Debugger ::PromiseDetails>);
136 void reset() override; 187 void reset() override;
137 188
138 // Interface for V8DebuggerImpl 189 // Interface for V8DebuggerImpl
139 SkipPauseRequest didPause(v8::Local<v8::Context>, v8::Local<v8::Object> call Frames, v8::Local<v8::Value> exception, const Vector<String>& hitBreakpoints, bo ol isPromiseRejection); 190 SkipPauseRequest didPause(v8::Local<v8::Context>, v8::Local<v8::Object> call Frames, v8::Local<v8::Value> exception, const Vector<String>& hitBreakpoints, bo ol isPromiseRejection);
140 void didContinue(); 191 void didContinue();
141 void didParseSource(const V8DebuggerParsedScript&); 192 void didParseSource(const V8DebuggerParsedScript&);
142 bool v8AsyncTaskEventsEnabled() const; 193 bool v8AsyncTaskEventsEnabled() const;
143 void didReceiveV8AsyncTaskEvent(v8::Local<v8::Context>, const String& eventT ype, const String& eventName, int id); 194 void didReceiveV8AsyncTaskEvent(v8::Local<v8::Context>, const String& eventT ype, const String& eventName, int id);
144 bool v8PromiseEventsEnabled() const; 195 bool v8PromiseEventsEnabled() const;
145 void didReceiveV8PromiseEvent(v8::Local<v8::Context>, v8::Local<v8::Object> promise, v8::Local<v8::Value> parentPromise, int status); 196 void didReceiveV8PromiseEvent(v8::Local<v8::Context>, v8::Local<v8::Object> promise, v8::Local<v8::Value> parentPromise, int status);
146 197
147 v8::Isolate* isolate() { return m_isolate; } 198 v8::Isolate* isolate() { return m_isolate; }
148 PassOwnPtr<V8StackTraceImpl> currentAsyncStackTraceForRuntime(); 199 PassOwnPtr<V8StackTraceImpl> currentAsyncStackTraceForRuntime();
149 200
150 private: 201 private:
151 bool checkEnabled(ErrorString*); 202 bool checkEnabled(ErrorString*);
152 void enable(); 203 void enable();
153 204
154 SkipPauseRequest shouldSkipExceptionPause(); 205 SkipPauseRequest shouldSkipExceptionPause();
155 SkipPauseRequest shouldSkipStepPause(); 206 SkipPauseRequest shouldSkipStepPause();
156 bool isMuteBreakpointInstalled(); 207 bool isMuteBreakpointInstalled();
157 208
158 void schedulePauseOnNextStatementIfSteppingInto(); 209 void schedulePauseOnNextStatementIfSteppingInto();
159 210
160 PassRefPtr<protocol::TypeBuilder::Array<protocol::TypeBuilder::Debugger::Cal lFrame>> currentCallFrames(); 211 PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> currentCallFrames ();
161 PassRefPtr<protocol::TypeBuilder::Debugger::StackTrace> currentAsyncStackTra ce(); 212 PassOwnPtr<protocol::Debugger::StackTrace> currentAsyncStackTrace();
162 bool callStackForId(ErrorString*, const RemoteCallFrameId&, v8::Local<v8::Ob ject>* callStack, bool* isAsync); 213 bool callStackForId(ErrorString*, const RemoteCallFrameId&, v8::Local<v8::Ob ject>* callStack, bool* isAsync);
163 214
164 void clearCurrentAsyncOperation(); 215 void clearCurrentAsyncOperation();
165 void resetAsyncCallTracker(); 216 void resetAsyncCallTracker();
166 217
167 void changeJavaScriptRecursionLevel(int step); 218 void changeJavaScriptRecursionLevel(int step);
168 219
169 void setPauseOnExceptionsImpl(ErrorString*, int); 220 void setPauseOnExceptionsImpl(ErrorString*, int);
170 221
171 PassRefPtr<protocol::TypeBuilder::Debugger::Location> resolveBreakpoint(cons t String& breakpointId, const String& scriptId, const ScriptBreakpoint&, Breakpo intSource); 222 PassOwnPtr<protocol::Debugger::Location> resolveBreakpoint(const String& bre akpointId, const String& scriptId, const ScriptBreakpoint&, BreakpointSource);
172 void removeBreakpoint(const String& breakpointId); 223 void removeBreakpoint(const String& breakpointId);
173 void clearStepIntoAsync(); 224 void clearStepIntoAsync();
174 bool assertPaused(ErrorString*); 225 bool assertPaused(ErrorString*);
175 void clearBreakDetails(); 226 void clearBreakDetails();
176 227
177 bool isCallStackEmptyOrBlackboxed(); 228 bool isCallStackEmptyOrBlackboxed();
178 bool isTopCallFrameBlackboxed(); 229 bool isTopCallFrameBlackboxed();
179 bool isCallFrameWithUnknownScriptOrBlackboxed(PassRefPtr<JavaScriptCallFrame >); 230 bool isCallFrameWithUnknownScriptOrBlackboxed(PassRefPtr<JavaScriptCallFrame >);
180 231
181 void internalSetAsyncCallStackDepth(int); 232 void internalSetAsyncCallStackDepth(int);
(...skipping 18 matching lines...) Expand all
200 RefPtr<JSONObject> m_state; 251 RefPtr<JSONObject> m_state;
201 protocol::Frontend::Debugger* m_frontend; 252 protocol::Frontend::Debugger* m_frontend;
202 v8::Isolate* m_isolate; 253 v8::Isolate* m_isolate;
203 v8::Global<v8::Context> m_pausedContext; 254 v8::Global<v8::Context> m_pausedContext;
204 v8::Global<v8::Object> m_currentCallStack; 255 v8::Global<v8::Object> m_currentCallStack;
205 ScriptsMap m_scripts; 256 ScriptsMap m_scripts;
206 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds ; 257 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds ;
207 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints; 258 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints;
208 MuteBreakpoins m_muteBreakpoints; 259 MuteBreakpoins m_muteBreakpoints;
209 String m_continueToLocationBreakpointId; 260 String m_continueToLocationBreakpointId;
210 protocol::Frontend::Debugger::Reason::Enum m_breakReason; 261 String m_breakReason;
211 RefPtr<JSONObject> m_breakAuxData; 262 RefPtr<JSONObject> m_breakAuxData;
212 DebuggerStep m_scheduledDebuggerStep; 263 DebuggerStep m_scheduledDebuggerStep;
213 bool m_skipNextDebuggerStepOut; 264 bool m_skipNextDebuggerStepOut;
214 bool m_javaScriptPauseScheduled; 265 bool m_javaScriptPauseScheduled;
215 bool m_steppingFromFramework; 266 bool m_steppingFromFramework;
216 bool m_pausingOnNativeEvent; 267 bool m_pausingOnNativeEvent;
217 bool m_pausingOnAsyncOperation; 268 bool m_pausingOnAsyncOperation;
218 269
219 int m_skippedStepFrameCount; 270 int m_skippedStepFrameCount;
220 int m_recursionLevelForStepOut; 271 int m_recursionLevelForStepOut;
(...skipping 16 matching lines...) Expand all
237 int m_currentAsyncOperationId; 288 int m_currentAsyncOperationId;
238 bool m_pendingTraceAsyncOperationCompleted; 289 bool m_pendingTraceAsyncOperationCompleted;
239 bool m_startingStepIntoAsync; 290 bool m_startingStepIntoAsync;
240 HashMap<String, Vector<std::pair<int, int>>> m_blackboxedPositions; 291 HashMap<String, Vector<std::pair<int, int>>> m_blackboxedPositions;
241 }; 292 };
242 293
243 } // namespace blink 294 } // namespace blink
244 295
245 296
246 #endif // V8DebuggerAgentImpl_h 297 #endif // V8DebuggerAgentImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698