| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 #include <v8-debug.h> | 41 #include <v8-debug.h> |
| 42 #include <v8.h> | 42 #include <v8.h> |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 using protocol::Maybe; | 46 using protocol::Maybe; |
| 47 | 47 |
| 48 struct ScriptBreakpoint; | 48 struct ScriptBreakpoint; |
| 49 class InspectedContext; | 49 class InspectedContext; |
| 50 class V8ConsoleMessageStorage; |
| 50 class V8DebuggerAgentImpl; | 51 class V8DebuggerAgentImpl; |
| 51 class V8InspectorSessionImpl; | 52 class V8InspectorSessionImpl; |
| 52 class V8RuntimeAgentImpl; | 53 class V8RuntimeAgentImpl; |
| 53 | 54 |
| 54 class V8DebuggerImpl : public V8Debugger { | 55 class V8DebuggerImpl : public V8Debugger { |
| 55 PROTOCOL_DISALLOW_COPY(V8DebuggerImpl); | 56 PROTOCOL_DISALLOW_COPY(V8DebuggerImpl); |
| 56 public: | 57 public: |
| 57 V8DebuggerImpl(v8::Isolate*, V8DebuggerClient*); | 58 V8DebuggerImpl(v8::Isolate*, V8DebuggerClient*); |
| 58 ~V8DebuggerImpl() override; | 59 ~V8DebuggerImpl() override; |
| 59 | 60 |
| 61 static int contextId(v8::Local<v8::Context>); |
| 62 |
| 60 bool enabled() const; | 63 bool enabled() const; |
| 61 | 64 |
| 62 String16 setBreakpoint(const String16& sourceID, const ScriptBreakpoint&, in
t* actualLineNumber, int* actualColumnNumber, bool interstatementLocation); | 65 String16 setBreakpoint(const String16& sourceID, const ScriptBreakpoint&, in
t* actualLineNumber, int* actualColumnNumber, bool interstatementLocation); |
| 63 void removeBreakpoint(const String16& breakpointId); | 66 void removeBreakpoint(const String16& breakpointId); |
| 64 void setBreakpointsActivated(bool); | 67 void setBreakpointsActivated(bool); |
| 65 bool breakpointsActivated() const { return m_breakpointsActivated; } | 68 bool breakpointsActivated() const { return m_breakpointsActivated; } |
| 66 | 69 |
| 67 enum PauseOnExceptionsState { | 70 enum PauseOnExceptionsState { |
| 68 DontPauseOnExceptions, | 71 DontPauseOnExceptions, |
| 69 PauseOnAllExceptions, | 72 PauseOnAllExceptions, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 99 | 102 |
| 100 v8::Isolate* isolate() const { return m_isolate; } | 103 v8::Isolate* isolate() const { return m_isolate; } |
| 101 V8DebuggerClient* client() { return m_client; } | 104 V8DebuggerClient* client() { return m_client; } |
| 102 | 105 |
| 103 v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Loca
l<v8::Script>); | 106 v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Loca
l<v8::Script>); |
| 104 v8::MaybeLocal<v8::Value> callFunction(v8::Local<v8::Function>, v8::Local<v8
::Context>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]
); | 107 v8::MaybeLocal<v8::Value> callFunction(v8::Local<v8::Function>, v8::Local<v8
::Context>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]
); |
| 105 v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::Context>
, v8::Local<v8::String>); | 108 v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::Context>
, v8::Local<v8::String>); |
| 106 v8::Local<v8::Script> compileInternalScript(v8::Local<v8::Context>, v8::Loca
l<v8::String>, const String16& fileName); | 109 v8::Local<v8::Script> compileInternalScript(v8::Local<v8::Context>, v8::Loca
l<v8::String>, const String16& fileName); |
| 107 v8::Local<v8::Context> regexContext(); | 110 v8::Local<v8::Context> regexContext(); |
| 108 | 111 |
| 112 void enableStackCapturingIfNeeded(); |
| 113 void disableStackCapturingIfNeeded(); |
| 114 V8ConsoleMessageStorage* ensureConsoleMessageStorage(int contextGroupId); |
| 115 |
| 109 // V8Debugger implementation | 116 // V8Debugger implementation |
| 110 std::unique_ptr<V8InspectorSession> connect(int contextGroupId, protocol::Fr
ontendChannel*, V8InspectorSessionClient*, const String16* state) override; | 117 std::unique_ptr<V8InspectorSession> connect(int contextGroupId, protocol::Fr
ontendChannel*, V8InspectorSessionClient*, const String16* state) override; |
| 111 void contextCreated(const V8ContextInfo&) override; | 118 void contextCreated(const V8ContextInfo&) override; |
| 112 void contextDestroyed(v8::Local<v8::Context>) override; | 119 void contextDestroyed(v8::Local<v8::Context>) override; |
| 113 void resetContextGroup(int contextGroupId) override; | 120 void resetContextGroup(int contextGroupId) override; |
| 114 void willExecuteScript(v8::Local<v8::Context>, int scriptId) override; | 121 void willExecuteScript(v8::Local<v8::Context>, int scriptId) override; |
| 115 void didExecuteScript(v8::Local<v8::Context>) override; | 122 void didExecuteScript(v8::Local<v8::Context>) override; |
| 116 void idleStarted() override; | 123 void idleStarted() override; |
| 117 void idleFinished() override; | 124 void idleFinished() override; |
| 125 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) override; |
| 126 void logToConsole(v8::Local<v8::Context>, const String16& message, protocol:
:Vector<v8::Local<v8::Value>>* arguments) override; |
| 127 unsigned promiseRejected(v8::Local<v8::Context>, const String16& errorMessag
e, v8::Local<v8::Value> reason, const String16& url, unsigned lineNumber, unsign
ed columnNumber, std::unique_ptr<V8StackTrace>, int scriptId) override; |
| 128 void promiseRejectionRevoked(v8::Local<v8::Context>, unsigned promiseRejecti
onId) override; |
| 129 protocol::Vector<unsigned> consoleMessageArgumentCounts(int contextGroupId)
override; |
| 118 std::unique_ptr<V8StackTrace> createStackTrace(v8::Local<v8::StackTrace>) ov
erride; | 130 std::unique_ptr<V8StackTrace> createStackTrace(v8::Local<v8::StackTrace>) ov
erride; |
| 119 std::unique_ptr<V8StackTrace> captureStackTrace(size_t maxStackSize) overrid
e; | 131 std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) override; |
| 132 void muteConsole() override { m_muteConsoleCount++; } |
| 133 void unmuteConsole() override { m_muteConsoleCount--; } |
| 120 | 134 |
| 121 using ContextByIdMap = protocol::HashMap<int, std::unique_ptr<InspectedConte
xt>>; | 135 using ContextByIdMap = protocol::HashMap<int, std::unique_ptr<InspectedConte
xt>>; |
| 122 void discardInspectedContext(int contextGroupId, int contextId); | 136 void discardInspectedContext(int contextGroupId, int contextId); |
| 123 const ContextByIdMap* contextGroup(int contextGroupId); | 137 const ContextByIdMap* contextGroup(int contextGroupId); |
| 124 void disconnect(V8InspectorSessionImpl*); | 138 void disconnect(V8InspectorSessionImpl*); |
| 125 V8InspectorSessionImpl* sessionForContextGroup(int contextGroupId); | 139 V8InspectorSessionImpl* sessionForContextGroup(int contextGroupId); |
| 126 | 140 |
| 127 private: | 141 private: |
| 128 void enable(); | 142 void enable(); |
| 129 void disable(); | 143 void disable(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 146 v8::Local<v8::String> v8InternalizedString(const char*) const; | 160 v8::Local<v8::String> v8InternalizedString(const char*) const; |
| 147 | 161 |
| 148 void handleV8AsyncTaskEvent(V8DebuggerAgentImpl*, v8::Local<v8::Context>, v8
::Local<v8::Object> executionState, v8::Local<v8::Object> eventData); | 162 void handleV8AsyncTaskEvent(V8DebuggerAgentImpl*, v8::Local<v8::Context>, v8
::Local<v8::Object> executionState, v8::Local<v8::Object> eventData); |
| 149 | 163 |
| 150 v8::Isolate* m_isolate; | 164 v8::Isolate* m_isolate; |
| 151 V8DebuggerClient* m_client; | 165 V8DebuggerClient* m_client; |
| 152 using ContextsByGroupMap = protocol::HashMap<int, std::unique_ptr<ContextByI
dMap>>; | 166 using ContextsByGroupMap = protocol::HashMap<int, std::unique_ptr<ContextByI
dMap>>; |
| 153 ContextsByGroupMap m_contexts; | 167 ContextsByGroupMap m_contexts; |
| 154 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; | 168 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; |
| 155 SessionMap m_sessions; | 169 SessionMap m_sessions; |
| 170 using ConsoleStorageMap = protocol::HashMap<int, std::unique_ptr<V8ConsoleMe
ssageStorage>>; |
| 171 ConsoleStorageMap m_consoleStorageMap; |
| 172 int m_capturingStackTracesCount; |
| 173 int m_muteConsoleCount; |
| 174 unsigned m_lastConsoleMessageId; |
| 156 int m_enabledAgentsCount; | 175 int m_enabledAgentsCount; |
| 157 bool m_breakpointsActivated; | 176 bool m_breakpointsActivated; |
| 158 v8::Global<v8::Object> m_debuggerScript; | 177 v8::Global<v8::Object> m_debuggerScript; |
| 159 v8::Global<v8::Context> m_debuggerContext; | 178 v8::Global<v8::Context> m_debuggerContext; |
| 160 v8::Local<v8::Object> m_executionState; | 179 v8::Local<v8::Object> m_executionState; |
| 161 v8::Local<v8::Context> m_pausedContext; | 180 v8::Local<v8::Context> m_pausedContext; |
| 162 bool m_runningNestedMessageLoop; | 181 bool m_runningNestedMessageLoop; |
| 163 v8::Global<v8::Context> m_regexContext; | 182 v8::Global<v8::Context> m_regexContext; |
| 164 }; | 183 }; |
| 165 | 184 |
| 166 } // namespace blink | 185 } // namespace blink |
| 167 | 186 |
| 168 | 187 |
| 169 #endif // V8DebuggerImpl_h | 188 #endif // V8DebuggerImpl_h |
| OLD | NEW |