| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 bool setScriptSource(const String16& sourceID, v8::Local<v8::String> newSour
ce, bool preview, ErrorString*, Maybe<protocol::Debugger::SetScriptSourceError>*
, JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged); | 91 bool setScriptSource(const String16& sourceID, v8::Local<v8::String> newSour
ce, bool preview, ErrorString*, Maybe<protocol::Debugger::SetScriptSourceError>*
, JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged); |
| 92 JavaScriptCallFrames currentCallFrames(int limit = 0); | 92 JavaScriptCallFrames currentCallFrames(int limit = 0); |
| 93 | 93 |
| 94 // Each script inherits debug data from v8::Context where it has been compil
ed. | 94 // Each script inherits debug data from v8::Context where it has been compil
ed. |
| 95 // Only scripts whose debug data matches |contextGroupId| will be reported. | 95 // Only scripts whose debug data matches |contextGroupId| will be reported. |
| 96 // Passing 0 will result in reporting all scripts. | 96 // Passing 0 will result in reporting all scripts. |
| 97 void getCompiledScripts(int contextGroupId, std::vector<std::unique_ptr<V8De
buggerScript>>&); | 97 void getCompiledScripts(int contextGroupId, std::vector<std::unique_ptr<V8De
buggerScript>>&); |
| 98 void debuggerAgentEnabled(); | 98 void debuggerAgentEnabled(); |
| 99 void debuggerAgentDisabled(); | 99 void debuggerAgentDisabled(); |
| 100 | 100 |
| 101 bool isPaused() override; | 101 bool isPaused(); |
| 102 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } | 102 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } |
| 103 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } | 103 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } |
| 104 V8StackTraceImpl* currentAsyncCallChain(); | 104 V8StackTraceImpl* currentAsyncCallChain(); |
| 105 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); | 105 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); |
| 106 | 106 |
| 107 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Function>); | 107 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Function>); |
| 108 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, v8::Loc
al<v8::Value>); | 108 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, v8::Loc
al<v8::Value>); |
| 109 | 109 |
| 110 v8::Isolate* isolate() const { return m_isolate; } | 110 v8::Isolate* isolate() const { return m_isolate; } |
| 111 V8DebuggerClient* client() { return m_client; } | 111 V8DebuggerClient* client() { return m_client; } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 122 | 122 |
| 123 // V8Debugger implementation | 123 // V8Debugger implementation |
| 124 std::unique_ptr<V8InspectorSession> connect(int contextGroupId, protocol::Fr
ontendChannel*, V8InspectorSessionClient*, const String16* state) override; | 124 std::unique_ptr<V8InspectorSession> connect(int contextGroupId, protocol::Fr
ontendChannel*, V8InspectorSessionClient*, const String16* state) override; |
| 125 void contextCreated(const V8ContextInfo&) override; | 125 void contextCreated(const V8ContextInfo&) override; |
| 126 void contextDestroyed(v8::Local<v8::Context>) override; | 126 void contextDestroyed(v8::Local<v8::Context>) override; |
| 127 void resetContextGroup(int contextGroupId) override; | 127 void resetContextGroup(int contextGroupId) override; |
| 128 void willExecuteScript(v8::Local<v8::Context>, int scriptId) override; | 128 void willExecuteScript(v8::Local<v8::Context>, int scriptId) override; |
| 129 void didExecuteScript(v8::Local<v8::Context>) override; | 129 void didExecuteScript(v8::Local<v8::Context>) override; |
| 130 void idleStarted() override; | 130 void idleStarted() override; |
| 131 void idleFinished() override; | 131 void idleFinished() override; |
| 132 bool addConsoleMessage(int contextGroupId, MessageSource, MessageLevel, cons
t String16& message, const String16& url, unsigned lineNumber, unsigned columnNu
mber, std::unique_ptr<V8StackTrace>, int scriptId, const String16& requestIdenti
fier, const String16& workerId) override; | 132 void addConsoleMessage(int contextGroupId, MessageSource, MessageLevel, cons
t String16& message, const String16& url, unsigned lineNumber, unsigned columnNu
mber, std::unique_ptr<V8StackTrace>, int scriptId, const String16& requestIdenti
fier, const String16& workerId) override; |
| 133 void logToConsole(v8::Local<v8::Context>, const String16& message, v8::Local
<v8::Value> arg1, v8::Local<v8::Value> arg2) override; | 133 void logToConsole(v8::Local<v8::Context>, const String16& message, v8::Local
<v8::Value> arg1, v8::Local<v8::Value> arg2) override; |
| 134 void exceptionThrown(int contextGroupId, const String16& errorMessage, const
String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8St
ackTrace>, int scriptId) override; | 134 void exceptionThrown(int contextGroupId, const String16& errorMessage, const
String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8St
ackTrace>, int scriptId) override; |
| 135 unsigned promiseRejected(v8::Local<v8::Context>, const String16& errorMessag
e, v8::Local<v8::Value> exception, const String16& url, unsigned lineNumber, uns
igned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId) override; | 135 unsigned promiseRejected(v8::Local<v8::Context>, const String16& errorMessag
e, v8::Local<v8::Value> exception, const String16& url, unsigned lineNumber, uns
igned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId) override; |
| 136 void promiseRejectionRevoked(v8::Local<v8::Context>, unsigned promiseRejecti
onId) override; | 136 void promiseRejectionRevoked(v8::Local<v8::Context>, unsigned promiseRejecti
onId) override; |
| 137 void consoleMessagesCount(int contextGroupId, unsigned* total, unsigned* wit
hArguments) override; | 137 void consoleMessagesCount(int contextGroupId, unsigned* total, unsigned* wit
hArguments) override; |
| 138 std::unique_ptr<V8StackTrace> createStackTrace(v8::Local<v8::StackTrace>) ov
erride; | 138 std::unique_ptr<V8StackTrace> createStackTrace(v8::Local<v8::StackTrace>) ov
erride; |
| 139 std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) override; | 139 std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) override; |
| 140 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring
) override; | 140 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring
) override; |
| 141 void asyncTaskCanceled(void* task) override; | 141 void asyncTaskCanceled(void* task) override; |
| 142 void asyncTaskStarted(void* task) override; | 142 void asyncTaskStarted(void* task) override; |
| 143 void asyncTaskFinished(void* task) override; | 143 void asyncTaskFinished(void* task) override; |
| 144 void allAsyncTasksCanceled() override; | 144 void allAsyncTasksCanceled() override; |
| 145 void muteConsole() override { m_muteConsoleCount++; } | |
| 146 void unmuteConsole() override { m_muteConsoleCount--; } | |
| 147 | 145 |
| 148 using ContextByIdMap = protocol::HashMap<int, std::unique_ptr<InspectedConte
xt>>; | 146 using ContextByIdMap = protocol::HashMap<int, std::unique_ptr<InspectedConte
xt>>; |
| 149 void discardInspectedContext(int contextGroupId, int contextId); | 147 void discardInspectedContext(int contextGroupId, int contextId); |
| 150 const ContextByIdMap* contextGroup(int contextGroupId); | 148 const ContextByIdMap* contextGroup(int contextGroupId); |
| 151 void disconnect(V8InspectorSessionImpl*); | 149 void disconnect(V8InspectorSessionImpl*); |
| 152 V8InspectorSessionImpl* sessionForContextGroup(int contextGroupId); | 150 V8InspectorSessionImpl* sessionForContextGroup(int contextGroupId); |
| 153 InspectedContext* getContext(int groupId, int contextId) const; | 151 InspectedContext* getContext(int groupId, int contextId) const; |
| 154 | 152 |
| 155 private: | 153 private: |
| 156 void enable(); | 154 void enable(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 180 v8::Local<v8::Value> functionLocation(v8::Local<v8::Context>, v8::Local<v8::
Function>); | 178 v8::Local<v8::Value> functionLocation(v8::Local<v8::Context>, v8::Local<v8::
Function>); |
| 181 | 179 |
| 182 v8::Isolate* m_isolate; | 180 v8::Isolate* m_isolate; |
| 183 V8DebuggerClient* m_client; | 181 V8DebuggerClient* m_client; |
| 184 ContextsByGroupMap m_contexts; | 182 ContextsByGroupMap m_contexts; |
| 185 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; | 183 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; |
| 186 SessionMap m_sessions; | 184 SessionMap m_sessions; |
| 187 using ConsoleStorageMap = protocol::HashMap<int, std::unique_ptr<V8ConsoleMe
ssageStorage>>; | 185 using ConsoleStorageMap = protocol::HashMap<int, std::unique_ptr<V8ConsoleMe
ssageStorage>>; |
| 188 ConsoleStorageMap m_consoleStorageMap; | 186 ConsoleStorageMap m_consoleStorageMap; |
| 189 int m_capturingStackTracesCount; | 187 int m_capturingStackTracesCount; |
| 190 int m_muteConsoleCount; | |
| 191 unsigned m_lastExceptionId; | 188 unsigned m_lastExceptionId; |
| 192 int m_enabledAgentsCount; | 189 int m_enabledAgentsCount; |
| 193 bool m_breakpointsActivated; | 190 bool m_breakpointsActivated; |
| 194 v8::Global<v8::Object> m_debuggerScript; | 191 v8::Global<v8::Object> m_debuggerScript; |
| 195 v8::Global<v8::Context> m_debuggerContext; | 192 v8::Global<v8::Context> m_debuggerContext; |
| 196 v8::Local<v8::Object> m_executionState; | 193 v8::Local<v8::Object> m_executionState; |
| 197 v8::Local<v8::Context> m_pausedContext; | 194 v8::Local<v8::Context> m_pausedContext; |
| 198 bool m_runningNestedMessageLoop; | 195 bool m_runningNestedMessageLoop; |
| 199 v8::Global<v8::Context> m_regexContext; | 196 v8::Global<v8::Context> m_regexContext; |
| 200 | 197 |
| 201 using AsyncTaskToStackTrace = protocol::HashMap<void*, std::unique_ptr<V8Sta
ckTraceImpl>>; | 198 using AsyncTaskToStackTrace = protocol::HashMap<void*, std::unique_ptr<V8Sta
ckTraceImpl>>; |
| 202 AsyncTaskToStackTrace m_asyncTaskStacks; | 199 AsyncTaskToStackTrace m_asyncTaskStacks; |
| 203 protocol::HashSet<void*> m_recurringTasks; | 200 protocol::HashSet<void*> m_recurringTasks; |
| 204 int m_maxAsyncCallStackDepth; | 201 int m_maxAsyncCallStackDepth; |
| 205 std::vector<void*> m_currentTasks; | 202 std::vector<void*> m_currentTasks; |
| 206 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; | 203 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; |
| 207 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; | 204 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; |
| 208 }; | 205 }; |
| 209 | 206 |
| 210 } // namespace blink | 207 } // namespace blink |
| 211 | 208 |
| 212 | 209 |
| 213 #endif // V8DebuggerImpl_h | 210 #endif // V8DebuggerImpl_h |
| OLD | NEW |