OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef InspectorSession_h | 5 #ifndef InspectorSession_h |
6 #define InspectorSession_h | 6 #define InspectorSession_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/inspector/protocol/InspectorProtocol.h" |
9 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
10 #include "platform/inspector_protocol/InspectorProtocol.h" | 11 #include "platform/v8_inspector/public/V8InspectorSession.h" |
11 #include "wtf/Forward.h" | 12 #include "wtf/Forward.h" |
12 #include "wtf/Vector.h" | 13 #include "wtf/Vector.h" |
13 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
14 | 15 |
15 namespace v8_inspector { | 16 namespace v8_inspector { |
16 class V8Inspector; | 17 class V8Inspector; |
17 class V8InspectorSession; | |
18 } | 18 } |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 | 21 |
22 class ExecutionContext; | 22 class ExecutionContext; |
23 class InspectorAgent; | 23 class InspectorAgent; |
24 class InstrumentingAgents; | 24 class InstrumentingAgents; |
25 class LocalFrame; | 25 class LocalFrame; |
26 | 26 |
27 class CORE_EXPORT InspectorSession | 27 class CORE_EXPORT InspectorSession |
28 : public GarbageCollectedFinalized<InspectorSession> | 28 : public GarbageCollectedFinalized<InspectorSession> |
29 , public protocol::FrontendChannel { | 29 , public protocol::FrontendChannel |
| 30 , public v8_inspector::protocol::FrontendChannel { |
30 WTF_MAKE_NONCOPYABLE(InspectorSession); | 31 WTF_MAKE_NONCOPYABLE(InspectorSession); |
31 public: | 32 public: |
32 class Client { | 33 class Client { |
33 public: | 34 public: |
34 virtual void sendProtocolMessage(int sessionId, int callId, const String
& response, const String& state) = 0; | 35 virtual void sendProtocolMessage(int sessionId, int callId, const String
& response, const String& state) = 0; |
35 virtual ~Client() {} | 36 virtual ~Client() {} |
36 }; | 37 }; |
37 | 38 |
38 InspectorSession(Client*, InstrumentingAgents*, int sessionId, v8_inspector:
:V8Inspector*, int contextGroupId, const String* savedState); | 39 InspectorSession(Client*, InstrumentingAgents*, int sessionId, v8_inspector:
:V8Inspector*, int contextGroupId, const String* savedState); |
39 ~InspectorSession() override; | 40 ~InspectorSession() override; |
40 int sessionId() { return m_sessionId; } | 41 int sessionId() { return m_sessionId; } |
41 v8_inspector::V8InspectorSession* v8Session() { return m_v8Session.get(); } | 42 v8_inspector::V8InspectorSession* v8Session() { return m_v8Session.get(); } |
42 | 43 |
43 void append(InspectorAgent*); | 44 void append(InspectorAgent*); |
44 void restore(); | 45 void restore(); |
45 void dispose(); | 46 void dispose(); |
46 void didCommitLoadForLocalFrame(LocalFrame*); | 47 void didCommitLoadForLocalFrame(LocalFrame*); |
47 void dispatchProtocolMessage(const String& method, const String& message); | 48 void dispatchProtocolMessage(const String& method, const String& message); |
48 void flushProtocolNotifications() override; | 49 void flushProtocolNotifications() override; |
49 | 50 |
50 DECLARE_TRACE(); | 51 DECLARE_TRACE(); |
51 | 52 |
52 private: | 53 private: |
53 // protocol::FrontendChannel implementation. | 54 // protocol::FrontendChannel implementation. |
54 void sendProtocolResponse(int callId, const protocol::String16& message) ove
rride; | 55 void sendProtocolResponse(int callId, const String& message) override; |
55 void sendProtocolNotification(const protocol::String16& message) override; | 56 void sendProtocolNotification(const String& message) override; |
| 57 |
| 58 // v8_inspector::protocol::FrontendChannel implementation. |
| 59 void sendProtocolResponse(int callId, const v8_inspector::String16& message)
override; |
| 60 void sendProtocolNotification(const v8_inspector::String16& message) overrid
e; |
56 | 61 |
57 Client* m_client; | 62 Client* m_client; |
58 std::unique_ptr<v8_inspector::V8InspectorSession> m_v8Session; | 63 std::unique_ptr<v8_inspector::V8InspectorSession> m_v8Session; |
59 int m_sessionId; | 64 int m_sessionId; |
60 bool m_disposed; | 65 bool m_disposed; |
61 Member<InstrumentingAgents> m_instrumentingAgents; | 66 Member<InstrumentingAgents> m_instrumentingAgents; |
62 std::unique_ptr<protocol::UberDispatcher> m_inspectorBackendDispatcher; | 67 std::unique_ptr<protocol::UberDispatcher> m_inspectorBackendDispatcher; |
63 std::unique_ptr<protocol::DictionaryValue> m_state; | 68 std::unique_ptr<protocol::DictionaryValue> m_state; |
64 HeapVector<Member<InspectorAgent>> m_agents; | 69 HeapVector<Member<InspectorAgent>> m_agents; |
65 Vector<protocol::String16> m_notificationQueue; | 70 Vector<String> m_notificationQueue; |
66 String m_lastSentState; | 71 String m_lastSentState; |
67 }; | 72 }; |
68 | 73 |
69 } // namespace blink | 74 } // namespace blink |
70 | 75 |
71 #endif // !defined(InspectorSession_h) | 76 #endif // !defined(InspectorSession_h) |
OLD | NEW |