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

Side by Side Diff: src/inspector/v8-debugger.h

Issue 2746743002: [inspector] support setTimeout in Debugger.scheduleStepIntoAsync method (Closed)
Patch Set: addressed comments Created 3 years, 8 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
« no previous file with comments | « src/api.cc ('k') | src/inspector/v8-debugger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project 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 V8_INSPECTOR_V8DEBUGGER_H_ 5 #ifndef V8_INSPECTOR_V8DEBUGGER_H_
6 #define V8_INSPECTOR_V8DEBUGGER_H_ 6 #define V8_INSPECTOR_V8DEBUGGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "src/base/macros.h" 10 #include "src/base/macros.h"
11 #include "src/debug/debug-interface.h" 11 #include "src/debug/debug-interface.h"
12 #include "src/inspector/java-script-call-frame.h" 12 #include "src/inspector/java-script-call-frame.h"
13 #include "src/inspector/protocol/Debugger.h"
13 #include "src/inspector/protocol/Forward.h" 14 #include "src/inspector/protocol/Forward.h"
14 #include "src/inspector/protocol/Runtime.h" 15 #include "src/inspector/protocol/Runtime.h"
15 #include "src/inspector/v8-debugger-script.h" 16 #include "src/inspector/v8-debugger-script.h"
16 #include "src/inspector/wasm-translation.h" 17 #include "src/inspector/wasm-translation.h"
17 18
18 #include "include/v8-inspector.h" 19 #include "include/v8-inspector.h"
19 20
20 namespace v8_inspector { 21 namespace v8_inspector {
21 22
22 struct ScriptBreakpoint; 23 struct ScriptBreakpoint;
23 class V8DebuggerAgentImpl; 24 class V8DebuggerAgentImpl;
24 class V8InspectorImpl; 25 class V8InspectorImpl;
25 class V8StackTraceImpl; 26 class V8StackTraceImpl;
26 27
27 using protocol::Response; 28 using protocol::Response;
29 using ScheduleStepIntoAsyncCallback =
30 protocol::Debugger::Backend::ScheduleStepIntoAsyncCallback;
28 31
29 class V8Debugger : public v8::debug::DebugDelegate { 32 class V8Debugger : public v8::debug::DebugDelegate {
30 public: 33 public:
31 V8Debugger(v8::Isolate*, V8InspectorImpl*); 34 V8Debugger(v8::Isolate*, V8InspectorImpl*);
32 ~V8Debugger(); 35 ~V8Debugger();
33 36
34 bool enabled() const; 37 bool enabled() const;
35 38
36 String16 setBreakpoint(const ScriptBreakpoint&, int* actualLineNumber, 39 String16 setBreakpoint(const ScriptBreakpoint&, int* actualLineNumber,
37 int* actualColumnNumber); 40 int* actualColumnNumber);
38 void removeBreakpoint(const String16& breakpointId); 41 void removeBreakpoint(const String16& breakpointId);
39 void setBreakpointsActivated(bool); 42 void setBreakpointsActivated(bool);
40 bool breakpointsActivated() const { return m_breakpointsActivated; } 43 bool breakpointsActivated() const { return m_breakpointsActivated; }
41 44
42 v8::debug::ExceptionBreakState getPauseOnExceptionsState(); 45 v8::debug::ExceptionBreakState getPauseOnExceptionsState();
43 void setPauseOnExceptionsState(v8::debug::ExceptionBreakState); 46 void setPauseOnExceptionsState(v8::debug::ExceptionBreakState);
44 bool canBreakProgram(); 47 bool canBreakProgram();
45 void breakProgram(); 48 void breakProgram();
46 void continueProgram(); 49 void continueProgram();
47 50
48 void setPauseOnNextStatement(bool, int targetContextGroupId); 51 void setPauseOnNextStatement(bool, int targetContextGroupId);
49 void stepIntoStatement(int targetContextGroupId); 52 void stepIntoStatement(int targetContextGroupId);
50 void stepOverStatement(int targetContextGroupId); 53 void stepOverStatement(int targetContextGroupId);
51 void stepOutOfFunction(int targetContextGroupId); 54 void stepOutOfFunction(int targetContextGroupId);
55 void scheduleStepIntoAsync(
56 std::unique_ptr<ScheduleStepIntoAsyncCallback> callback,
57 int targetContextGroupId);
52 58
53 Response setScriptSource( 59 Response setScriptSource(
54 const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun, 60 const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun,
55 protocol::Maybe<protocol::Runtime::ExceptionDetails>*, 61 protocol::Maybe<protocol::Runtime::ExceptionDetails>*,
56 JavaScriptCallFrames* newCallFrames, protocol::Maybe<bool>* stackChanged, 62 JavaScriptCallFrames* newCallFrames, protocol::Maybe<bool>* stackChanged,
57 bool* compileError); 63 bool* compileError);
58 JavaScriptCallFrames currentCallFrames(int limit = 0); 64 JavaScriptCallFrames currentCallFrames(int limit = 0);
59 65
60 // Each script inherits debug data from v8::Context where it has been 66 // Each script inherits debug data from v8::Context where it has been
61 // compiled. 67 // compiled.
(...skipping 11 matching lines...) Expand all
73 V8StackTraceImpl* currentAsyncCallChain(); 79 V8StackTraceImpl* currentAsyncCallChain();
74 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); 80 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int);
75 std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>); 81 std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>);
76 std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack); 82 std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack);
77 83
78 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, 84 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>,
79 v8::Local<v8::Value>); 85 v8::Local<v8::Value>);
80 86
81 void asyncTaskScheduled(const StringView& taskName, void* task, 87 void asyncTaskScheduled(const StringView& taskName, void* task,
82 bool recurring); 88 bool recurring);
83 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring);
84 void asyncTaskCanceled(void* task); 89 void asyncTaskCanceled(void* task);
85 void asyncTaskStarted(void* task); 90 void asyncTaskStarted(void* task);
86 void asyncTaskFinished(void* task); 91 void asyncTaskFinished(void* task);
87 void allAsyncTasksCanceled(); 92 void allAsyncTasksCanceled();
88 93
89 void muteScriptParsedEvents(); 94 void muteScriptParsedEvents();
90 void unmuteScriptParsedEvents(); 95 void unmuteScriptParsedEvents();
91 96
92 V8InspectorImpl* inspector() { return m_inspector; } 97 V8InspectorImpl* inspector() { return m_inspector; }
93 98
(...skipping 25 matching lines...) Expand all
119 }; 124 };
120 v8::MaybeLocal<v8::Value> getTargetScopes(v8::Local<v8::Context>, 125 v8::MaybeLocal<v8::Value> getTargetScopes(v8::Local<v8::Context>,
121 v8::Local<v8::Value>, 126 v8::Local<v8::Value>,
122 ScopeTargetKind); 127 ScopeTargetKind);
123 128
124 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Context>, 129 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Context>,
125 v8::Local<v8::Function>); 130 v8::Local<v8::Function>);
126 v8::MaybeLocal<v8::Value> generatorScopes(v8::Local<v8::Context>, 131 v8::MaybeLocal<v8::Value> generatorScopes(v8::Local<v8::Context>,
127 v8::Local<v8::Value>); 132 v8::Local<v8::Value>);
128 133
129 void asyncTaskCreated(void* task, void* parentTask); 134 void asyncTaskCreatedForStack(void* task, void* parentTask);
135 void asyncTaskScheduledForStack(const String16& taskName, void* task,
136 bool recurring);
137 void asyncTaskCanceledForStack(void* task);
138 void asyncTaskStartedForStack(void* task);
139 void asyncTaskFinishedForStack(void* task);
140
141 void asyncTaskCandidateForStepping(void* task);
142 void asyncTaskStartedForStepping(void* task);
143 void asyncTaskFinishedForStepping(void* task);
144 void asyncTaskCanceledForStepping(void* task);
145
130 void registerAsyncTaskIfNeeded(void* task); 146 void registerAsyncTaskIfNeeded(void* task);
131 147
132 // v8::debug::DebugEventListener implementation. 148 // v8::debug::DebugEventListener implementation.
133 void PromiseEventOccurred(v8::Local<v8::Context> context, 149 void PromiseEventOccurred(v8::Local<v8::Context> context,
134 v8::debug::PromiseDebugActionType type, int id, 150 v8::debug::PromiseDebugActionType type, int id,
135 int parentId, bool createdByUser) override; 151 int parentId, bool createdByUser) override;
136 void ScriptCompiled(v8::Local<v8::debug::Script> script, 152 void ScriptCompiled(v8::Local<v8::debug::Script> script,
137 bool has_compile_error) override; 153 bool has_compile_error) override;
138 void BreakProgramRequested(v8::Local<v8::Context> paused_context, 154 void BreakProgramRequested(v8::Local<v8::Context> paused_context,
139 v8::Local<v8::Object> exec_state, 155 v8::Local<v8::Object> exec_state,
140 v8::Local<v8::Value> break_points_hit) override; 156 v8::Local<v8::Value> break_points_hit) override;
141 void ExceptionThrown(v8::Local<v8::Context> paused_context, 157 void ExceptionThrown(v8::Local<v8::Context> paused_context,
142 v8::Local<v8::Object> exec_state, 158 v8::Local<v8::Object> exec_state,
143 v8::Local<v8::Value> exception, 159 v8::Local<v8::Value> exception,
144 v8::Local<v8::Value> promise, bool is_uncaught) override; 160 v8::Local<v8::Value> promise, bool is_uncaught) override;
145 bool IsFunctionBlackboxed(v8::Local<v8::debug::Script> script, 161 bool IsFunctionBlackboxed(v8::Local<v8::debug::Script> script,
146 const v8::debug::Location& start, 162 const v8::debug::Location& start,
147 const v8::debug::Location& end) override; 163 const v8::debug::Location& end) override;
148 164
149 int currentContextGroupId(); 165 int currentContextGroupId();
150 void handleAsyncTaskStepping(v8::Local<v8::Context> context,
151 v8::debug::PromiseDebugActionType type,
152 void* task, void* parentTask,
153 bool createdByUser);
154 166
155 v8::Isolate* m_isolate; 167 v8::Isolate* m_isolate;
156 V8InspectorImpl* m_inspector; 168 V8InspectorImpl* m_inspector;
157 int m_enableCount; 169 int m_enableCount;
158 bool m_breakpointsActivated; 170 bool m_breakpointsActivated;
159 v8::Global<v8::Object> m_debuggerScript; 171 v8::Global<v8::Object> m_debuggerScript;
160 v8::Global<v8::Context> m_debuggerContext; 172 v8::Global<v8::Context> m_debuggerContext;
161 v8::Local<v8::Object> m_executionState; 173 v8::Local<v8::Object> m_executionState;
162 v8::Local<v8::Context> m_pausedContext; 174 v8::Local<v8::Context> m_pausedContext;
163 bool m_runningNestedMessageLoop; 175 bool m_runningNestedMessageLoop;
(...skipping 11 matching lines...) Expand all
175 int m_lastTaskId; 187 int m_lastTaskId;
176 protocol::HashSet<void*> m_recurringTasks; 188 protocol::HashSet<void*> m_recurringTasks;
177 int m_maxAsyncCallStackDepth; 189 int m_maxAsyncCallStackDepth;
178 std::vector<void*> m_currentTasks; 190 std::vector<void*> m_currentTasks;
179 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; 191 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks;
180 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; 192 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap;
181 protocol::HashMap<void*, void*> m_parentTask; 193 protocol::HashMap<void*, void*> m_parentTask;
182 protocol::HashMap<void*, void*> m_firstNextTask; 194 protocol::HashMap<void*, void*> m_firstNextTask;
183 void* m_taskWithScheduledBreak = nullptr; 195 void* m_taskWithScheduledBreak = nullptr;
184 196
197 std::unique_ptr<ScheduleStepIntoAsyncCallback> m_stepIntoAsyncCallback;
198 bool m_breakRequested = false;
199
185 v8::debug::ExceptionBreakState m_pauseOnExceptionsState; 200 v8::debug::ExceptionBreakState m_pauseOnExceptionsState;
186 201
187 WasmTranslation m_wasmTranslation; 202 WasmTranslation m_wasmTranslation;
188 203
189 DISALLOW_COPY_AND_ASSIGN(V8Debugger); 204 DISALLOW_COPY_AND_ASSIGN(V8Debugger);
190 }; 205 };
191 206
192 } // namespace v8_inspector 207 } // namespace v8_inspector
193 208
194 #endif // V8_INSPECTOR_V8DEBUGGER_H_ 209 #endif // V8_INSPECTOR_V8DEBUGGER_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/inspector/v8-debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698