| 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 17 matching lines...) Expand all Loading... |
| 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 V8DebuggerImpl_h |
| 32 #define V8DebuggerImpl_h | 32 #define V8DebuggerImpl_h |
| 33 | 33 |
| 34 #include "platform/inspector_protocol/TypeBuilder.h" | 34 #include "platform/inspector_protocol/TypeBuilder.h" |
| 35 #include "platform/v8_inspector/JavaScriptCallFrame.h" | 35 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
| 36 #include "platform/v8_inspector/V8DebuggerScript.h" | 36 #include "platform/v8_inspector/V8DebuggerScript.h" |
| 37 #include "platform/v8_inspector/public/V8Debugger.h" | 37 #include "platform/v8_inspector/public/V8Debugger.h" |
| 38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PtrUtil.h" |
| 39 | 39 |
| 40 #include <v8-debug.h> | 40 #include <v8-debug.h> |
| 41 #include <v8.h> | 41 #include <v8.h> |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 using protocol::Maybe; | 45 using protocol::Maybe; |
| 46 | 46 |
| 47 struct ScriptBreakpoint; | 47 struct ScriptBreakpoint; |
| 48 class InspectedContext; | 48 class InspectedContext; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 v8::Isolate* isolate() const { return m_isolate; } | 99 v8::Isolate* isolate() const { return m_isolate; } |
| 100 V8DebuggerClient* client() { return m_client; } | 100 V8DebuggerClient* client() { return m_client; } |
| 101 | 101 |
| 102 v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Loca
l<v8::Script>); | 102 v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Loca
l<v8::Script>); |
| 103 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[]
); | 103 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[]
); |
| 104 v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::Context>
, v8::Local<v8::String>); | 104 v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::Context>
, v8::Local<v8::String>); |
| 105 v8::Local<v8::Script> compileInternalScript(v8::Local<v8::Context>, v8::Loca
l<v8::String>, const String16& fileName); | 105 v8::Local<v8::Script> compileInternalScript(v8::Local<v8::Context>, v8::Loca
l<v8::String>, const String16& fileName); |
| 106 v8::Local<v8::Context> regexContext(); | 106 v8::Local<v8::Context> regexContext(); |
| 107 | 107 |
| 108 // V8Debugger implementation | 108 // V8Debugger implementation |
| 109 PassOwnPtr<V8InspectorSession> connect(int contextGroupId, V8InspectorSessio
nClient*, const String16* state) override; | 109 std::unique_ptr<V8InspectorSession> connect(int contextGroupId, V8InspectorS
essionClient*, const String16* state) override; |
| 110 void contextCreated(const V8ContextInfo&) override; | 110 void contextCreated(const V8ContextInfo&) override; |
| 111 void contextDestroyed(v8::Local<v8::Context>) override; | 111 void contextDestroyed(v8::Local<v8::Context>) override; |
| 112 void resetContextGroup(int contextGroupId) override; | 112 void resetContextGroup(int contextGroupId) override; |
| 113 void willExecuteScript(v8::Local<v8::Context>, int scriptId) override; | 113 void willExecuteScript(v8::Local<v8::Context>, int scriptId) override; |
| 114 void didExecuteScript(v8::Local<v8::Context>) override; | 114 void didExecuteScript(v8::Local<v8::Context>) override; |
| 115 void idleStarted() override; | 115 void idleStarted() override; |
| 116 void idleFinished() override; | 116 void idleFinished() override; |
| 117 PassOwnPtr<V8StackTrace> createStackTrace(v8::Local<v8::StackTrace>, size_t
maxStackSize) override; | 117 std::unique_ptr<V8StackTrace> createStackTrace(v8::Local<v8::StackTrace>, si
ze_t maxStackSize) override; |
| 118 PassOwnPtr<V8StackTrace> captureStackTrace(size_t maxStackSize) override; | 118 std::unique_ptr<V8StackTrace> captureStackTrace(size_t maxStackSize) overrid
e; |
| 119 | 119 |
| 120 using ContextByIdMap = protocol::HashMap<int, OwnPtr<InspectedContext>>; | 120 using ContextByIdMap = protocol::HashMap<int, std::unique_ptr<InspectedConte
xt>>; |
| 121 void discardInspectedContext(int contextGroupId, int contextId); | 121 void discardInspectedContext(int contextGroupId, int contextId); |
| 122 const ContextByIdMap* contextGroup(int contextGroupId); | 122 const ContextByIdMap* contextGroup(int contextGroupId); |
| 123 void disconnect(V8InspectorSessionImpl*); | 123 void disconnect(V8InspectorSessionImpl*); |
| 124 V8InspectorSessionImpl* sessionForContextGroup(int contextGroupId); | 124 V8InspectorSessionImpl* sessionForContextGroup(int contextGroupId); |
| 125 | 125 |
| 126 private: | 126 private: |
| 127 void enable(); | 127 void enable(); |
| 128 void disable(); | 128 void disable(); |
| 129 V8DebuggerAgentImpl* findEnabledDebuggerAgent(int contextGroupId); | 129 V8DebuggerAgentImpl* findEnabledDebuggerAgent(int contextGroupId); |
| 130 V8DebuggerAgentImpl* findEnabledDebuggerAgent(v8::Local<v8::Context>); | 130 V8DebuggerAgentImpl* findEnabledDebuggerAgent(v8::Local<v8::Context>); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 141 static void v8DebugEventCallback(const v8::Debug::EventDetails&); | 141 static void v8DebugEventCallback(const v8::Debug::EventDetails&); |
| 142 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const
char* functionName); | 142 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const
char* functionName); |
| 143 void handleV8DebugEvent(const v8::Debug::EventDetails&); | 143 void handleV8DebugEvent(const v8::Debug::EventDetails&); |
| 144 | 144 |
| 145 v8::Local<v8::String> v8InternalizedString(const char*) const; | 145 v8::Local<v8::String> v8InternalizedString(const char*) const; |
| 146 | 146 |
| 147 void handleV8AsyncTaskEvent(V8DebuggerAgentImpl*, v8::Local<v8::Context>, v8
::Local<v8::Object> executionState, v8::Local<v8::Object> eventData); | 147 void handleV8AsyncTaskEvent(V8DebuggerAgentImpl*, v8::Local<v8::Context>, v8
::Local<v8::Object> executionState, v8::Local<v8::Object> eventData); |
| 148 | 148 |
| 149 v8::Isolate* m_isolate; | 149 v8::Isolate* m_isolate; |
| 150 V8DebuggerClient* m_client; | 150 V8DebuggerClient* m_client; |
| 151 using ContextsByGroupMap = protocol::HashMap<int, OwnPtr<ContextByIdMap>>; | 151 using ContextsByGroupMap = protocol::HashMap<int, std::unique_ptr<ContextByI
dMap>>; |
| 152 ContextsByGroupMap m_contexts; | 152 ContextsByGroupMap m_contexts; |
| 153 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; | 153 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; |
| 154 SessionMap m_sessions; | 154 SessionMap m_sessions; |
| 155 int m_enabledAgentsCount; | 155 int m_enabledAgentsCount; |
| 156 bool m_breakpointsActivated; | 156 bool m_breakpointsActivated; |
| 157 v8::Global<v8::Object> m_debuggerScript; | 157 v8::Global<v8::Object> m_debuggerScript; |
| 158 v8::Global<v8::Context> m_debuggerContext; | 158 v8::Global<v8::Context> m_debuggerContext; |
| 159 v8::Local<v8::Object> m_executionState; | 159 v8::Local<v8::Object> m_executionState; |
| 160 v8::Local<v8::Context> m_pausedContext; | 160 v8::Local<v8::Context> m_pausedContext; |
| 161 bool m_runningNestedMessageLoop; | 161 bool m_runningNestedMessageLoop; |
| 162 v8::Global<v8::Context> m_regexContext; | 162 v8::Global<v8::Context> m_regexContext; |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 } // namespace blink | 165 } // namespace blink |
| 166 | 166 |
| 167 | 167 |
| 168 #endif // V8DebuggerImpl_h | 168 #endif // V8DebuggerImpl_h |
| OLD | NEW |