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 V8_INSPECTOR_V8INSPECTORIMPL_H_ | 31 #ifndef V8_INSPECTOR_V8INSPECTORIMPL_H_ |
32 #define V8_INSPECTOR_V8INSPECTORIMPL_H_ | 32 #define V8_INSPECTOR_V8INSPECTORIMPL_H_ |
33 | 33 |
34 #include <vector> | 34 #include <functional> |
35 | 35 |
36 #include "src/base/macros.h" | 36 #include "src/base/macros.h" |
37 #include "src/inspector/protocol/Protocol.h" | 37 #include "src/inspector/protocol/Protocol.h" |
38 | 38 |
39 #include "include/v8-inspector.h" | 39 #include "include/v8-inspector.h" |
40 | 40 |
41 namespace v8_inspector { | 41 namespace v8_inspector { |
42 | 42 |
43 class InspectedContext; | 43 class InspectedContext; |
44 class V8Console; | 44 class V8Console; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void asyncTaskFinished(void* task) override; | 95 void asyncTaskFinished(void* task) override; |
96 void allAsyncTasksCanceled() override; | 96 void allAsyncTasksCanceled() override; |
97 | 97 |
98 unsigned nextExceptionId() { return ++m_lastExceptionId; } | 98 unsigned nextExceptionId() { return ++m_lastExceptionId; } |
99 void enableStackCapturingIfNeeded(); | 99 void enableStackCapturingIfNeeded(); |
100 void disableStackCapturingIfNeeded(); | 100 void disableStackCapturingIfNeeded(); |
101 void muteExceptions(int contextGroupId); | 101 void muteExceptions(int contextGroupId); |
102 void unmuteExceptions(int contextGroupId); | 102 void unmuteExceptions(int contextGroupId); |
103 V8ConsoleMessageStorage* ensureConsoleMessageStorage(int contextGroupId); | 103 V8ConsoleMessageStorage* ensureConsoleMessageStorage(int contextGroupId); |
104 bool hasConsoleMessageStorage(int contextGroupId); | 104 bool hasConsoleMessageStorage(int contextGroupId); |
105 using ContextByIdMap = | |
106 protocol::HashMap<int, std::unique_ptr<InspectedContext>>; | |
107 void discardInspectedContext(int contextGroupId, int contextId); | 105 void discardInspectedContext(int contextGroupId, int contextId); |
108 const ContextByIdMap* contextGroup(int contextGroupId); | |
109 void disconnect(V8InspectorSessionImpl*); | 106 void disconnect(V8InspectorSessionImpl*); |
110 V8InspectorSessionImpl* sessionForContextGroup(int contextGroupId); | 107 V8InspectorSessionImpl* sessionForContextGroup(int contextGroupId); |
| 108 V8InspectorSessionImpl* sessionById(int sessionId); |
111 InspectedContext* getContext(int groupId, int contextId) const; | 109 InspectedContext* getContext(int groupId, int contextId) const; |
112 V8DebuggerAgentImpl* enabledDebuggerAgentForGroup(int contextGroupId); | |
113 V8RuntimeAgentImpl* enabledRuntimeAgentForGroup(int contextGroupId); | |
114 V8ProfilerAgentImpl* enabledProfilerAgentForGroup(int contextGroupId); | |
115 V8Console* console(); | 110 V8Console* console(); |
| 111 void forEachContext(int contextGroupId, |
| 112 std::function<void(InspectedContext*)> callback); |
116 | 113 |
117 private: | 114 private: |
118 v8::Isolate* m_isolate; | 115 v8::Isolate* m_isolate; |
119 V8InspectorClient* m_client; | 116 V8InspectorClient* m_client; |
120 std::unique_ptr<V8Debugger> m_debugger; | 117 std::unique_ptr<V8Debugger> m_debugger; |
121 v8::Global<v8::Context> m_regexContext; | 118 v8::Global<v8::Context> m_regexContext; |
122 int m_capturingStackTracesCount; | 119 int m_capturingStackTracesCount; |
123 unsigned m_lastExceptionId; | 120 unsigned m_lastExceptionId; |
124 int m_lastContextId; | 121 int m_lastContextId; |
| 122 int m_lastSessionId = 0; |
125 | 123 |
126 using MuteExceptionsMap = protocol::HashMap<int, int>; | 124 using MuteExceptionsMap = protocol::HashMap<int, int>; |
127 MuteExceptionsMap m_muteExceptionsMap; | 125 MuteExceptionsMap m_muteExceptionsMap; |
128 | 126 |
| 127 using ContextByIdMap = |
| 128 protocol::HashMap<int, std::unique_ptr<InspectedContext>>; |
129 using ContextsByGroupMap = | 129 using ContextsByGroupMap = |
130 protocol::HashMap<int, std::unique_ptr<ContextByIdMap>>; | 130 protocol::HashMap<int, std::unique_ptr<ContextByIdMap>>; |
131 ContextsByGroupMap m_contexts; | 131 ContextsByGroupMap m_contexts; |
132 | 132 |
133 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; | 133 using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>; |
134 SessionMap m_sessions; | 134 SessionMap m_sessions; |
| 135 protocol::HashMap<int, V8InspectorSessionImpl*> m_sessionById; |
135 | 136 |
136 using ConsoleStorageMap = | 137 using ConsoleStorageMap = |
137 protocol::HashMap<int, std::unique_ptr<V8ConsoleMessageStorage>>; | 138 protocol::HashMap<int, std::unique_ptr<V8ConsoleMessageStorage>>; |
138 ConsoleStorageMap m_consoleStorageMap; | 139 ConsoleStorageMap m_consoleStorageMap; |
139 | 140 |
140 protocol::HashMap<int, int> m_contextIdToGroupIdMap; | 141 protocol::HashMap<int, int> m_contextIdToGroupIdMap; |
141 | 142 |
142 std::unique_ptr<V8Console> m_console; | 143 std::unique_ptr<V8Console> m_console; |
143 | 144 |
144 DISALLOW_COPY_AND_ASSIGN(V8InspectorImpl); | 145 DISALLOW_COPY_AND_ASSIGN(V8InspectorImpl); |
145 }; | 146 }; |
146 | 147 |
147 } // namespace v8_inspector | 148 } // namespace v8_inspector |
148 | 149 |
149 #endif // V8_INSPECTOR_V8INSPECTORIMPL_H_ | 150 #endif // V8_INSPECTOR_V8INSPECTORIMPL_H_ |
OLD | NEW |