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 13 matching lines...) Expand all Loading... | |
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 V8DebuggerImpl_h |
32 #define V8DebuggerImpl_h | 32 #define V8DebuggerImpl_h |
33 | 33 |
34 #include "platform/inspector_protocol/Collections.h" | |
34 #include "platform/inspector_protocol/Maybe.h" | 35 #include "platform/inspector_protocol/Maybe.h" |
35 #include "platform/inspector_protocol/Platform.h" | 36 #include "platform/inspector_protocol/Platform.h" |
36 #include "platform/v8_inspector/JavaScriptCallFrame.h" | 37 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
37 #include "platform/v8_inspector/V8DebuggerScript.h" | 38 #include "platform/v8_inspector/V8DebuggerScript.h" |
38 #include "platform/v8_inspector/protocol/Debugger.h" | 39 #include "platform/v8_inspector/protocol/Debugger.h" |
39 #include "platform/v8_inspector/public/V8Debugger.h" | 40 #include "platform/v8_inspector/public/V8Debugger.h" |
40 | 41 |
41 #include <v8-debug.h> | 42 #include <v8-debug.h> |
42 #include <v8.h> | 43 #include <v8.h> |
43 | 44 |
45 #include <vector> | |
46 | |
44 namespace blink { | 47 namespace blink { |
45 | 48 |
46 using protocol::Maybe; | 49 using protocol::Maybe; |
47 | 50 |
48 struct ScriptBreakpoint; | 51 struct ScriptBreakpoint; |
49 class InspectedContext; | 52 class InspectedContext; |
50 class V8DebuggerAgentImpl; | 53 class V8DebuggerAgentImpl; |
51 class V8InspectorSessionImpl; | 54 class V8InspectorSessionImpl; |
52 class V8RuntimeAgentImpl; | 55 class V8RuntimeAgentImpl; |
53 | 56 |
(...skipping 25 matching lines...) Expand all Loading... | |
79 void stepOverStatement(); | 82 void stepOverStatement(); |
80 void stepOutOfFunction(); | 83 void stepOutOfFunction(); |
81 void clearStepping(); | 84 void clearStepping(); |
82 | 85 |
83 bool setScriptSource(const String16& sourceID, const String16& newContent, b ool preview, ErrorString*, Maybe<protocol::Debugger::SetScriptSourceError>*, Jav aScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged); | 86 bool setScriptSource(const String16& sourceID, const String16& newContent, b ool preview, ErrorString*, Maybe<protocol::Debugger::SetScriptSourceError>*, Jav aScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged); |
84 JavaScriptCallFrames currentCallFrames(int limit = 0); | 87 JavaScriptCallFrames currentCallFrames(int limit = 0); |
85 | 88 |
86 // Each script inherits debug data from v8::Context where it has been compil ed. | 89 // Each script inherits debug data from v8::Context where it has been compil ed. |
87 // Only scripts whose debug data matches |contextGroupId| will be reported. | 90 // Only scripts whose debug data matches |contextGroupId| will be reported. |
88 // Passing 0 will result in reporting all scripts. | 91 // Passing 0 will result in reporting all scripts. |
89 void getCompiledScripts(int contextGroupId, protocol::Vector<V8DebuggerParse dScript>&); | 92 void getCompiledScripts(int contextGroupId, std::vector<V8DebuggerParsedScri pt>&); |
90 void debuggerAgentEnabled(); | 93 void debuggerAgentEnabled(); |
91 void debuggerAgentDisabled(); | 94 void debuggerAgentDisabled(); |
92 | 95 |
93 bool isPaused() override; | 96 bool isPaused() override; |
94 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } | 97 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } |
95 | 98 |
96 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Function>); | 99 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Function>); |
97 v8::Local<v8::Value> generatorObjectDetails(v8::Local<v8::Object>&); | 100 v8::Local<v8::Value> generatorObjectDetails(v8::Local<v8::Object>&); |
98 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Object>&); | 101 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Object>&); |
99 | 102 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&) ; | 143 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&) ; |
141 void handleProgramBreak(v8::Local<v8::Context> pausedContext, v8::Local<v8:: Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hit Breakpoints, bool isPromiseRejection = false); | 144 void handleProgramBreak(v8::Local<v8::Context> pausedContext, v8::Local<v8:: Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hit Breakpoints, bool isPromiseRejection = false); |
142 static void v8DebugEventCallback(const v8::Debug::EventDetails&); | 145 static void v8DebugEventCallback(const v8::Debug::EventDetails&); |
143 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const char* functionName); | 146 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const char* functionName); |
144 void handleV8DebugEvent(const v8::Debug::EventDetails&); | 147 void handleV8DebugEvent(const v8::Debug::EventDetails&); |
145 | 148 |
146 v8::Local<v8::String> v8InternalizedString(const char*) const; | 149 v8::Local<v8::String> v8InternalizedString(const char*) const; |
147 | 150 |
148 void handleV8AsyncTaskEvent(V8DebuggerAgentImpl*, v8::Local<v8::Context>, v8 ::Local<v8::Object> executionState, v8::Local<v8::Object> eventData); | 151 void handleV8AsyncTaskEvent(V8DebuggerAgentImpl*, v8::Local<v8::Context>, v8 ::Local<v8::Object> executionState, v8::Local<v8::Object> eventData); |
149 | 152 |
153 using ContextsByGroupMap = protocol::HashMap<int, std::unique_ptr<ContextByI dMap>>; | |
154 | |
155 bool isContextInGroup(int groupId, int contextId) const | |
dgozman
2016/06/24 17:01:13
Please move implementation to cpp.
eostroukhov-old
2016/06/24 22:24:26
Done.
| |
156 { | |
157 ContextsByGroupMap::const_iterator iter = m_contexts.find(groupId); | |
158 return iter != m_contexts.cend() | |
159 && iter->second->find(contextId) != iter->second->cend(); | |
160 } | |
161 | |
150 v8::Isolate* m_isolate; | 162 v8::Isolate* m_isolate; |
151 V8DebuggerClient* m_client; | 163 V8DebuggerClient* m_client; |
152 using ContextsByGroupMap = protocol::HashMap<int, std::unique_ptr<ContextByI dMap>>; | |
153 ContextsByGroupMap m_contexts; | 164 ContextsByGroupMap m_contexts; |
154 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; | 165 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; |
155 SessionMap m_sessions; | 166 SessionMap m_sessions; |
156 int m_enabledAgentsCount; | 167 int m_enabledAgentsCount; |
157 bool m_breakpointsActivated; | 168 bool m_breakpointsActivated; |
158 v8::Global<v8::Object> m_debuggerScript; | 169 v8::Global<v8::Object> m_debuggerScript; |
159 v8::Global<v8::Context> m_debuggerContext; | 170 v8::Global<v8::Context> m_debuggerContext; |
160 v8::Local<v8::Object> m_executionState; | 171 v8::Local<v8::Object> m_executionState; |
161 v8::Local<v8::Context> m_pausedContext; | 172 v8::Local<v8::Context> m_pausedContext; |
162 bool m_runningNestedMessageLoop; | 173 bool m_runningNestedMessageLoop; |
163 v8::Global<v8::Context> m_regexContext; | 174 v8::Global<v8::Context> m_regexContext; |
164 }; | 175 }; |
165 | 176 |
166 } // namespace blink | 177 } // namespace blink |
167 | 178 |
168 | 179 |
169 #endif // V8DebuggerImpl_h | 180 #endif // V8DebuggerImpl_h |
OLD | NEW |