| 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef V8DebuggerImpl_h | 31 #ifndef V8InspectorImpl_h |
| 32 #define V8DebuggerImpl_h | 32 #define V8InspectorImpl_h |
| 33 | 33 |
| 34 #include "platform/inspector_protocol/Collections.h" | 34 #include "platform/inspector_protocol/Collections.h" |
| 35 #include "platform/inspector_protocol/Maybe.h" | 35 #include "platform/inspector_protocol/Maybe.h" |
| 36 #include "platform/inspector_protocol/Platform.h" | 36 #include "platform/inspector_protocol/Platform.h" |
| 37 #include "platform/v8_inspector/JavaScriptCallFrame.h" | 37 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
| 38 #include "platform/v8_inspector/V8DebuggerScript.h" | 38 #include "platform/v8_inspector/V8DebuggerScript.h" |
| 39 #include "platform/v8_inspector/protocol/Debugger.h" | 39 #include "platform/v8_inspector/protocol/Debugger.h" |
| 40 #include "platform/v8_inspector/public/V8Debugger.h" | 40 #include "platform/v8_inspector/public/V8Inspector.h" |
| 41 | 41 |
| 42 #include <v8-debug.h> | 42 #include <v8-debug.h> |
| 43 #include <v8.h> | 43 #include <v8.h> |
| 44 #include <vector> | 44 #include <vector> |
| 45 | 45 |
| 46 #include <vector> | |
| 47 | |
| 48 namespace blink { | 46 namespace blink { |
| 49 | 47 |
| 50 using protocol::Maybe; | 48 using protocol::Maybe; |
| 51 | 49 |
| 52 struct ScriptBreakpoint; | 50 struct ScriptBreakpoint; |
| 53 class InspectedContext; | 51 class InspectedContext; |
| 54 class V8ConsoleMessageStorage; | 52 class V8ConsoleMessageStorage; |
| 55 class V8DebuggerAgentImpl; | 53 class V8DebuggerAgentImpl; |
| 56 class V8InspectorSessionImpl; | 54 class V8InspectorSessionImpl; |
| 57 class V8RuntimeAgentImpl; | 55 class V8RuntimeAgentImpl; |
| 58 class V8StackTraceImpl; | 56 class V8StackTraceImpl; |
| 59 | 57 |
| 60 class V8DebuggerImpl : public V8Debugger { | 58 class V8InspectorImpl : public V8Inspector { |
| 61 PROTOCOL_DISALLOW_COPY(V8DebuggerImpl); | 59 PROTOCOL_DISALLOW_COPY(V8InspectorImpl); |
| 62 public: | 60 public: |
| 63 V8DebuggerImpl(v8::Isolate*, V8DebuggerClient*); | 61 V8InspectorImpl(v8::Isolate*, V8InspectorClient*); |
| 64 ~V8DebuggerImpl() override; | 62 ~V8InspectorImpl() override; |
| 65 | 63 |
| 66 static int contextId(v8::Local<v8::Context>); | 64 static int contextId(v8::Local<v8::Context>); |
| 67 static int getGroupId(v8::Local<v8::Context>); | 65 static int getGroupId(v8::Local<v8::Context>); |
| 68 | 66 |
| 69 bool enabled() const; | 67 bool enabled() const; |
| 70 | 68 |
| 71 String16 setBreakpoint(const String16& sourceID, const ScriptBreakpoint&, in
t* actualLineNumber, int* actualColumnNumber, bool interstatementLocation); | 69 String16 setBreakpoint(const String16& sourceID, const ScriptBreakpoint&, in
t* actualLineNumber, int* actualColumnNumber, bool interstatementLocation); |
| 72 void removeBreakpoint(const String16& breakpointId); | 70 void removeBreakpoint(const String16& breakpointId); |
| 73 void setBreakpointsActivated(bool); | 71 void setBreakpointsActivated(bool); |
| 74 bool breakpointsActivated() const { return m_breakpointsActivated; } | 72 bool breakpointsActivated() const { return m_breakpointsActivated; } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 102 bool isPaused(); | 100 bool isPaused(); |
| 103 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } | 101 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } |
| 104 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } | 102 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } |
| 105 V8StackTraceImpl* currentAsyncCallChain(); | 103 V8StackTraceImpl* currentAsyncCallChain(); |
| 106 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); | 104 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); |
| 107 | 105 |
| 108 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Function>); | 106 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Function>); |
| 109 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, v8::Loc
al<v8::Value>); | 107 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, v8::Loc
al<v8::Value>); |
| 110 | 108 |
| 111 v8::Isolate* isolate() const { return m_isolate; } | 109 v8::Isolate* isolate() const { return m_isolate; } |
| 112 V8DebuggerClient* client() { return m_client; } | 110 V8InspectorClient* client() { return m_client; } |
| 113 | 111 |
| 114 v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Loca
l<v8::Script>); | 112 v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Loca
l<v8::Script>); |
| 115 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[]
); | 113 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[]
); |
| 116 v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::Context>
, v8::Local<v8::String>); | 114 v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::Context>
, v8::Local<v8::String>); |
| 117 v8::Local<v8::Script> compileScript(v8::Local<v8::Context>, v8::Local<v8::St
ring>, const String16& fileName, bool markAsInternal); | 115 v8::Local<v8::Script> compileScript(v8::Local<v8::Context>, v8::Local<v8::St
ring>, const String16& fileName, bool markAsInternal); |
| 118 v8::Local<v8::Context> regexContext(); | 116 v8::Local<v8::Context> regexContext(); |
| 119 | 117 |
| 120 void enableStackCapturingIfNeeded(); | 118 void enableStackCapturingIfNeeded(); |
| 121 void disableStackCapturingIfNeeded(); | 119 void disableStackCapturingIfNeeded(); |
| 122 V8ConsoleMessageStorage* ensureConsoleMessageStorage(int contextGroupId); | 120 V8ConsoleMessageStorage* ensureConsoleMessageStorage(int contextGroupId); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 168 |
| 171 void handleV8AsyncTaskEvent(v8::Local<v8::Context>, v8::Local<v8::Object> ex
ecutionState, v8::Local<v8::Object> eventData); | 169 void handleV8AsyncTaskEvent(v8::Local<v8::Context>, v8::Local<v8::Object> ex
ecutionState, v8::Local<v8::Object> eventData); |
| 172 | 170 |
| 173 using ContextsByGroupMap = protocol::HashMap<int, std::unique_ptr<ContextByI
dMap>>; | 171 using ContextsByGroupMap = protocol::HashMap<int, std::unique_ptr<ContextByI
dMap>>; |
| 174 | 172 |
| 175 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Context>, v8::Local<v8:
:Object>); | 173 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Context>, v8::Local<v8:
:Object>); |
| 176 v8::Local<v8::Value> generatorObjectLocation(v8::Local<v8::Object>); | 174 v8::Local<v8::Value> generatorObjectLocation(v8::Local<v8::Object>); |
| 177 v8::Local<v8::Value> functionLocation(v8::Local<v8::Context>, v8::Local<v8::
Function>); | 175 v8::Local<v8::Value> functionLocation(v8::Local<v8::Context>, v8::Local<v8::
Function>); |
| 178 | 176 |
| 179 v8::Isolate* m_isolate; | 177 v8::Isolate* m_isolate; |
| 180 V8DebuggerClient* m_client; | 178 V8InspectorClient* m_client; |
| 181 ContextsByGroupMap m_contexts; | 179 ContextsByGroupMap m_contexts; |
| 182 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; | 180 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; |
| 183 SessionMap m_sessions; | 181 SessionMap m_sessions; |
| 184 using ConsoleStorageMap = protocol::HashMap<int, std::unique_ptr<V8ConsoleMe
ssageStorage>>; | 182 using ConsoleStorageMap = protocol::HashMap<int, std::unique_ptr<V8ConsoleMe
ssageStorage>>; |
| 185 ConsoleStorageMap m_consoleStorageMap; | 183 ConsoleStorageMap m_consoleStorageMap; |
| 186 int m_capturingStackTracesCount; | 184 int m_capturingStackTracesCount; |
| 187 unsigned m_lastExceptionId; | 185 unsigned m_lastExceptionId; |
| 188 int m_enabledAgentsCount; | 186 int m_enabledAgentsCount; |
| 189 bool m_breakpointsActivated; | 187 bool m_breakpointsActivated; |
| 190 v8::Global<v8::Object> m_debuggerScript; | 188 v8::Global<v8::Object> m_debuggerScript; |
| 191 v8::Global<v8::Context> m_debuggerContext; | 189 v8::Global<v8::Context> m_debuggerContext; |
| 192 v8::Local<v8::Object> m_executionState; | 190 v8::Local<v8::Object> m_executionState; |
| 193 v8::Local<v8::Context> m_pausedContext; | 191 v8::Local<v8::Context> m_pausedContext; |
| 194 bool m_runningNestedMessageLoop; | 192 bool m_runningNestedMessageLoop; |
| 195 v8::Global<v8::Context> m_regexContext; | 193 v8::Global<v8::Context> m_regexContext; |
| 196 | 194 |
| 197 using AsyncTaskToStackTrace = protocol::HashMap<void*, std::unique_ptr<V8Sta
ckTraceImpl>>; | 195 using AsyncTaskToStackTrace = protocol::HashMap<void*, std::unique_ptr<V8Sta
ckTraceImpl>>; |
| 198 AsyncTaskToStackTrace m_asyncTaskStacks; | 196 AsyncTaskToStackTrace m_asyncTaskStacks; |
| 199 protocol::HashSet<void*> m_recurringTasks; | 197 protocol::HashSet<void*> m_recurringTasks; |
| 200 int m_maxAsyncCallStackDepth; | 198 int m_maxAsyncCallStackDepth; |
| 201 std::vector<void*> m_currentTasks; | 199 std::vector<void*> m_currentTasks; |
| 202 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; | 200 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; |
| 203 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; | 201 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; |
| 204 }; | 202 }; |
| 205 | 203 |
| 206 } // namespace blink | 204 } // namespace blink |
| 207 | 205 |
| 208 | 206 |
| 209 #endif // V8DebuggerImpl_h | 207 #endif // V8InspectorImpl_h |
| OLD | NEW |