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

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

Issue 2825903002: [inspector] deduplicate stack frames (Closed)
Patch Set: cleanup cache after stack trace collected 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
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 <list> 8 #include <list>
9 #include <vector> 9 #include <vector>
10 10
11 #include "src/base/macros.h" 11 #include "src/base/macros.h"
12 #include "src/debug/debug-interface.h" 12 #include "src/debug/debug-interface.h"
13 #include "src/inspector/java-script-call-frame.h" 13 #include "src/inspector/java-script-call-frame.h"
14 #include "src/inspector/protocol/Debugger.h" 14 #include "src/inspector/protocol/Debugger.h"
15 #include "src/inspector/protocol/Forward.h" 15 #include "src/inspector/protocol/Forward.h"
16 #include "src/inspector/protocol/Runtime.h" 16 #include "src/inspector/protocol/Runtime.h"
17 #include "src/inspector/v8-debugger-script.h" 17 #include "src/inspector/v8-debugger-script.h"
18 #include "src/inspector/wasm-translation.h" 18 #include "src/inspector/wasm-translation.h"
19 19
20 #include "include/v8-inspector.h" 20 #include "include/v8-inspector.h"
21 21
22 namespace v8_inspector { 22 namespace v8_inspector {
23 23
24 class AsyncStackTrace; 24 class AsyncStackTrace;
25 struct ScriptBreakpoint; 25 struct ScriptBreakpoint;
26 class StackFrame;
26 class V8Debugger; 27 class V8Debugger;
27 class V8DebuggerAgentImpl; 28 class V8DebuggerAgentImpl;
28 class V8InspectorImpl; 29 class V8InspectorImpl;
29 class V8StackTraceImpl; 30 class V8StackTraceImpl;
30 31
31 using protocol::Response; 32 using protocol::Response;
32 using ScheduleStepIntoAsyncCallback = 33 using ScheduleStepIntoAsyncCallback =
33 protocol::Debugger::Backend::ScheduleStepIntoAsyncCallback; 34 protocol::Debugger::Backend::ScheduleStepIntoAsyncCallback;
34 35
35 class V8Debugger : public v8::debug::DebugDelegate { 36 class V8Debugger : public v8::debug::DebugDelegate {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 bool isPaused() const { return m_runningNestedMessageLoop; } 80 bool isPaused() const { return m_runningNestedMessageLoop; }
80 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } 81 v8::Local<v8::Context> pausedContext() { return m_pausedContext; }
81 82
82 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } 83 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; }
83 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); 84 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int);
84 85
85 std::shared_ptr<AsyncStackTrace> currentAsyncParent(); 86 std::shared_ptr<AsyncStackTrace> currentAsyncParent();
86 std::shared_ptr<AsyncStackTrace> currentAsyncCreation(); 87 std::shared_ptr<AsyncStackTrace> currentAsyncCreation();
87 88
89 std::shared_ptr<StackFrame> lookupFrame(int frameId);
90 void storeFrame(int frameId, std::shared_ptr<StackFrame> frame);
91
88 std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>); 92 std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>);
89 std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack); 93 std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack);
90 94
91 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, 95 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>,
92 v8::Local<v8::Value>); 96 v8::Local<v8::Value>);
93 97
94 void asyncTaskScheduled(const StringView& taskName, void* task, 98 void asyncTaskScheduled(const StringView& taskName, void* task,
95 bool recurring); 99 bool recurring);
96 void asyncTaskCanceled(void* task); 100 void asyncTaskCanceled(void* task);
97 void asyncTaskStarted(void* task); 101 void asyncTaskStarted(void* task);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 std::vector<void*> m_currentTasks; 198 std::vector<void*> m_currentTasks;
195 std::vector<std::shared_ptr<AsyncStackTrace>> m_currentAsyncParent; 199 std::vector<std::shared_ptr<AsyncStackTrace>> m_currentAsyncParent;
196 std::vector<std::shared_ptr<AsyncStackTrace>> m_currentAsyncCreation; 200 std::vector<std::shared_ptr<AsyncStackTrace>> m_currentAsyncCreation;
197 201
198 void collectOldAsyncStacksIfNeeded(); 202 void collectOldAsyncStacksIfNeeded();
199 void removeOldAsyncTasks(AsyncTaskToStackTrace& map); 203 void removeOldAsyncTasks(AsyncTaskToStackTrace& map);
200 int m_asyncStacksCount = 0; 204 int m_asyncStacksCount = 0;
201 // V8Debugger owns all the async stacks, while most of the other references 205 // V8Debugger owns all the async stacks, while most of the other references
202 // are weak, which allows to collect some stacks when there are too many. 206 // are weak, which allows to collect some stacks when there are too many.
203 std::list<std::shared_ptr<AsyncStackTrace>> m_allAsyncStacks; 207 std::list<std::shared_ptr<AsyncStackTrace>> m_allAsyncStacks;
208 std::map<int, std::weak_ptr<StackFrame>> m_framesCache;
204 209
205 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; 210 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap;
206 void* m_taskWithScheduledBreak = nullptr; 211 void* m_taskWithScheduledBreak = nullptr;
207 212
208 std::unique_ptr<ScheduleStepIntoAsyncCallback> m_stepIntoAsyncCallback; 213 std::unique_ptr<ScheduleStepIntoAsyncCallback> m_stepIntoAsyncCallback;
209 bool m_breakRequested = false; 214 bool m_breakRequested = false;
210 215
211 v8::debug::ExceptionBreakState m_pauseOnExceptionsState; 216 v8::debug::ExceptionBreakState m_pauseOnExceptionsState;
212 217
213 WasmTranslation m_wasmTranslation; 218 WasmTranslation m_wasmTranslation;
214 219
215 DISALLOW_COPY_AND_ASSIGN(V8Debugger); 220 DISALLOW_COPY_AND_ASSIGN(V8Debugger);
216 }; 221 };
217 222
218 } // namespace v8_inspector 223 } // namespace v8_inspector
219 224
220 #endif // V8_INSPECTOR_V8DEBUGGER_H_ 225 #endif // V8_INSPECTOR_V8DEBUGGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698