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/Forward.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/V8Inspector.h" |
| 12 #include "platform/v8_inspector/public/V8InspectorSession.h" |
11 #include "wtf/Forward.h" | 13 #include "wtf/Forward.h" |
12 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
13 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
14 | 16 |
15 namespace v8_inspector { | 17 namespace v8_inspector { |
16 class V8Inspector; | 18 class V8Inspector; |
17 class V8InspectorSession; | |
18 } | 19 } |
19 | 20 |
20 namespace blink { | 21 namespace blink { |
21 | 22 |
22 class ExecutionContext; | 23 class ExecutionContext; |
23 class InspectorAgent; | 24 class InspectorAgent; |
24 class InstrumentingAgents; | 25 class InstrumentingAgents; |
25 class LocalFrame; | 26 class LocalFrame; |
26 | 27 |
27 class CORE_EXPORT InspectorSession | 28 class CORE_EXPORT InspectorSession |
28 : public GarbageCollectedFinalized<InspectorSession> | 29 : public GarbageCollectedFinalized<InspectorSession> |
29 , public protocol::FrontendChannel { | 30 , public protocol::FrontendChannel |
| 31 , public v8_inspector::V8Inspector::Channel { |
30 WTF_MAKE_NONCOPYABLE(InspectorSession); | 32 WTF_MAKE_NONCOPYABLE(InspectorSession); |
31 public: | 33 public: |
32 class Client { | 34 class Client { |
33 public: | 35 public: |
34 virtual void sendProtocolMessage(int sessionId, int callId, const String
& response, const String& state) = 0; | 36 virtual void sendProtocolMessage(int sessionId, int callId, const String
& response, const String& state) = 0; |
35 virtual ~Client() {} | 37 virtual ~Client() {} |
36 }; | 38 }; |
37 | 39 |
38 InspectorSession(Client*, InstrumentingAgents*, int sessionId, v8_inspector:
:V8Inspector*, int contextGroupId, const String* savedState); | 40 InspectorSession(Client*, InstrumentingAgents*, int sessionId, v8_inspector:
:V8Inspector*, int contextGroupId, const String* savedState); |
39 ~InspectorSession() override; | 41 ~InspectorSession() override; |
40 int sessionId() { return m_sessionId; } | 42 int sessionId() { return m_sessionId; } |
41 v8_inspector::V8InspectorSession* v8Session() { return m_v8Session.get(); } | 43 v8_inspector::V8InspectorSession* v8Session() { return m_v8Session.get(); } |
42 | 44 |
43 void append(InspectorAgent*); | 45 void append(InspectorAgent*); |
44 void restore(); | 46 void restore(); |
45 void dispose(); | 47 void dispose(); |
46 void didCommitLoadForLocalFrame(LocalFrame*); | 48 void didCommitLoadForLocalFrame(LocalFrame*); |
47 void dispatchProtocolMessage(const String& method, const String& message); | 49 void dispatchProtocolMessage(const String& method, const String& message); |
48 void flushProtocolNotifications() override; | 50 void flushProtocolNotifications() override; |
49 | 51 |
50 DECLARE_TRACE(); | 52 DECLARE_TRACE(); |
51 | 53 |
52 private: | 54 private: |
53 // protocol::FrontendChannel implementation. | 55 // protocol::FrontendChannel implementation. |
54 void sendProtocolResponse(int callId, const protocol::String16& message) ove
rride; | 56 void sendProtocolResponse(int callId, const String& message) override; |
55 void sendProtocolNotification(const protocol::String16& message) override; | 57 void sendProtocolNotification(const String& message) override; |
| 58 |
| 59 // v8_inspector::V8Inspector::Channel implementation. |
| 60 void sendProtocolResponse(int callId, const v8_inspector::StringView& messag
e) override; |
| 61 void sendProtocolNotification(const v8_inspector::StringView& message) overr
ide; |
56 | 62 |
57 Client* m_client; | 63 Client* m_client; |
58 std::unique_ptr<v8_inspector::V8InspectorSession> m_v8Session; | 64 std::unique_ptr<v8_inspector::V8InspectorSession> m_v8Session; |
59 int m_sessionId; | 65 int m_sessionId; |
60 bool m_disposed; | 66 bool m_disposed; |
61 Member<InstrumentingAgents> m_instrumentingAgents; | 67 Member<InstrumentingAgents> m_instrumentingAgents; |
62 std::unique_ptr<protocol::UberDispatcher> m_inspectorBackendDispatcher; | 68 std::unique_ptr<protocol::UberDispatcher> m_inspectorBackendDispatcher; |
63 std::unique_ptr<protocol::DictionaryValue> m_state; | 69 std::unique_ptr<protocol::DictionaryValue> m_state; |
64 HeapVector<Member<InspectorAgent>> m_agents; | 70 HeapVector<Member<InspectorAgent>> m_agents; |
65 Vector<protocol::String16> m_notificationQueue; | 71 Vector<String> m_notificationQueue; |
66 String m_lastSentState; | 72 String m_lastSentState; |
67 }; | 73 }; |
68 | 74 |
69 } // namespace blink | 75 } // namespace blink |
70 | 76 |
71 #endif // !defined(InspectorSession_h) | 77 #endif // !defined(InspectorSession_h) |
OLD | NEW |