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