31 #ifndef V8_INSPECTOR_V8_INSPECTOR_IMPL_H_ 32 #define V8_INSPECTOR_V8_INSPECTOR_IMPL_H_ 36 #include <unordered_map> 38 #include "src/base/macros.h" 39 #include "src/base/platform/mutex.h" 40 #include "src/inspector/protocol/Protocol.h" 42 #include "include/v8-inspector.h" 46 class InspectedContext;
48 class V8ConsoleMessageStorage;
50 class V8DebuggerAgentImpl;
51 class V8InspectorSessionImpl;
52 class V8ProfilerAgentImpl;
53 class V8RuntimeAgentImpl;
54 class V8StackTraceImpl;
61 v8::Isolate* isolate()
const {
return m_isolate; }
63 V8Debugger* debugger() {
return m_debugger.get(); }
65 int contextGroupId(
int contextId)
const;
66 uint64_t isolateId()
const {
return m_isolateId; }
76 std::unique_ptr<V8InspectorSession> connect(
int contextGroupId,
83 void contextCollected(
int contextGroupId,
int contextId);
84 void resetContextGroup(
int contextGroupId)
override;
85 void idleStarted()
override;
86 void idleFinished()
override;
91 unsigned columnNumber, std::unique_ptr<V8StackTrace>,
92 int scriptId)
override;
95 std::unique_ptr<V8StackTrace> createStackTrace(
97 std::unique_ptr<V8StackTrace> captureStackTrace(
bool fullStack)
override;
98 void asyncTaskScheduled(
const StringView& taskName,
void* task,
99 bool recurring)
override;
100 void asyncTaskCanceled(
void* task)
override;
101 void asyncTaskStarted(
void* task)
override;
102 void asyncTaskFinished(
void* task)
override;
103 void allAsyncTasksCanceled()
override;
106 void externalAsyncTaskStarted(
const V8StackTraceId& parent)
override;
107 void externalAsyncTaskFinished(
const V8StackTraceId& parent)
override;
109 unsigned nextExceptionId() {
return ++m_lastExceptionId; }
110 void enableStackCapturingIfNeeded();
111 void disableStackCapturingIfNeeded();
112 void muteExceptions(
int contextGroupId);
113 void unmuteExceptions(
int contextGroupId);
115 bool hasConsoleMessageStorage(
int contextGroupId);
116 void discardInspectedContext(
int contextGroupId,
int contextId);
122 void forEachContext(
int contextGroupId,
133 protocol::Response setTimeout(
double timeout);
136 v8::Isolate* m_isolate;
139 std::shared_ptr<CancelToken> m_cancelToken;
144 v8::Isolate* m_isolate;
146 std::unique_ptr<V8Debugger> m_debugger;
148 int m_capturingStackTracesCount;
149 unsigned m_lastExceptionId;
151 int m_lastSessionId = 0;
152 uint64_t m_isolateId;
154 using MuteExceptionsMap = std::unordered_map<int, int>;
155 MuteExceptionsMap m_muteExceptionsMap;
157 using ContextByIdMap =
158 std::unordered_map<int, std::unique_ptr<InspectedContext>>;
159 using ContextsByGroupMap =
160 std::unordered_map<int, std::unique_ptr<ContextByIdMap>>;
161 ContextsByGroupMap m_contexts;
164 std::unordered_map<int, std::map<int, V8InspectorSessionImpl*>> m_sessions;
166 using ConsoleStorageMap =
167 std::unordered_map<int, std::unique_ptr<V8ConsoleMessageStorage>>;
168 ConsoleStorageMap m_consoleStorageMap;
170 std::unordered_map<int, int> m_contextIdToGroupIdMap;
172 std::unique_ptr<V8Console> m_console;
179 #endif // V8_INSPECTOR_V8_INSPECTOR_IMPL_H_