Index: src/inspector/v8-debugger.h |
diff --git a/src/inspector/v8-debugger.h b/src/inspector/v8-debugger.h |
index 784f4ba4fabce97592673db8c725993369383f72..1e2746040f4f835ea13aba6b759df701de02a051 100644 |
--- a/src/inspector/v8-debugger.h |
+++ b/src/inspector/v8-debugger.h |
@@ -5,7 +5,6 @@ |
#ifndef V8_INSPECTOR_V8DEBUGGER_H_ |
#define V8_INSPECTOR_V8DEBUGGER_H_ |
-#include <list> |
#include <vector> |
#include "src/base/macros.h" |
@@ -21,9 +20,7 @@ |
namespace v8_inspector { |
-class AsyncStackTrace; |
struct ScriptBreakpoint; |
-class V8Debugger; |
class V8DebuggerAgentImpl; |
class V8InspectorImpl; |
class V8StackTraceImpl; |
@@ -38,7 +35,6 @@ |
~V8Debugger(); |
bool enabled() const; |
- v8::Isolate* isolate() const { return m_isolate; } |
String16 setBreakpoint(const ScriptBreakpoint&, int* actualLineNumber, |
int* actualColumnNumber); |
@@ -80,11 +76,9 @@ |
v8::Local<v8::Context> pausedContext() { return m_pausedContext; } |
int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } |
+ V8StackTraceImpl* currentAsyncCallChain(); |
+ V8StackTraceImpl* currentAsyncTaskCreationStack(); |
void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); |
- |
- std::shared_ptr<AsyncStackTrace> currentAsyncParent(); |
- std::shared_ptr<AsyncStackTrace> currentAsyncCreation(); |
- |
std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>); |
std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack); |
@@ -105,7 +99,7 @@ |
WasmTranslation* wasmTranslation() { return &m_wasmTranslation; } |
- void setMaxAsyncTaskStacksForTest(int limit); |
+ void setMaxAsyncTaskStacksForTest(int limit) { m_maxAsyncCallStacks = limit; } |
private: |
void compileDebuggerScript(); |
@@ -149,6 +143,8 @@ |
void asyncTaskStartedForStepping(void* task); |
void asyncTaskFinishedForStepping(void* task); |
void asyncTaskCanceledForStepping(void* task); |
+ |
+ void registerAsyncTaskIfNeeded(void* task); |
// v8::debug::DebugEventListener implementation. |
void PromiseEventOccurred(v8::debug::PromiseDebugActionType type, int id, |
@@ -182,24 +178,18 @@ |
int m_targetContextGroupId = 0; |
using AsyncTaskToStackTrace = |
- protocol::HashMap<void*, std::weak_ptr<AsyncStackTrace>>; |
+ protocol::HashMap<void*, std::unique_ptr<V8StackTraceImpl>>; |
AsyncTaskToStackTrace m_asyncTaskStacks; |
AsyncTaskToStackTrace m_asyncTaskCreationStacks; |
int m_maxAsyncCallStacks; |
+ std::map<int, void*> m_idToTask; |
+ std::unordered_map<void*, int> m_taskToId; |
+ int m_lastTaskId; |
protocol::HashSet<void*> m_recurringTasks; |
int m_maxAsyncCallStackDepth; |
- |
std::vector<void*> m_currentTasks; |
- std::vector<std::shared_ptr<AsyncStackTrace>> m_currentAsyncParent; |
- std::vector<std::shared_ptr<AsyncStackTrace>> m_currentAsyncCreation; |
- |
- void collectOldAsyncStacksIfNeeded(); |
- void removeOldAsyncTasks(AsyncTaskToStackTrace& map); |
- int m_asyncStacksCount = 0; |
- // V8Debugger owns all the async stacks, while most of the other references |
- // are weak, which allows to collect some stacks when there are too many. |
- std::list<std::shared_ptr<AsyncStackTrace>> m_allAsyncStacks; |
- |
+ std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; |
+ std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentCreationStacks; |
protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; |
protocol::HashMap<void*, void*> m_parentTask; |
protocol::HashMap<void*, void*> m_firstNextTask; |