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 V8InspectorSessionImpl_h | 5 #ifndef V8InspectorSessionImpl_h |
6 #define V8InspectorSessionImpl_h | 6 #define V8InspectorSessionImpl_h |
7 | 7 |
8 #include "platform/inspector_protocol/InspectorProtocol.h" | 8 #include "platform/v8_inspector/Allocator.h" |
| 9 #include "platform/v8_inspector/protocol/Forward.h" |
9 #include "platform/v8_inspector/protocol/Runtime.h" | 10 #include "platform/v8_inspector/protocol/Runtime.h" |
10 #include "platform/v8_inspector/protocol/Schema.h" | 11 #include "platform/v8_inspector/protocol/Schema.h" |
| 12 #include "platform/v8_inspector/public/V8Inspector.h" |
11 #include "platform/v8_inspector/public/V8InspectorSession.h" | 13 #include "platform/v8_inspector/public/V8InspectorSession.h" |
12 | 14 |
13 #include <v8.h> | 15 #include <v8.h> |
14 | |
15 #include <vector> | 16 #include <vector> |
16 | 17 |
17 namespace v8_inspector { | 18 namespace v8_inspector { |
18 | 19 |
19 class InjectedScript; | 20 class InjectedScript; |
20 class RemoteObjectIdBase; | 21 class RemoteObjectIdBase; |
21 class V8ConsoleAgentImpl; | 22 class V8ConsoleAgentImpl; |
22 class V8DebuggerAgentImpl; | 23 class V8DebuggerAgentImpl; |
23 class V8InspectorImpl; | 24 class V8InspectorImpl; |
24 class V8HeapProfilerAgentImpl; | 25 class V8HeapProfilerAgentImpl; |
25 class V8ProfilerAgentImpl; | 26 class V8ProfilerAgentImpl; |
26 class V8RuntimeAgentImpl; | 27 class V8RuntimeAgentImpl; |
27 class V8SchemaAgentImpl; | 28 class V8SchemaAgentImpl; |
28 | 29 |
29 namespace protocol = blink::protocol; | 30 using protocol::ErrorString; |
30 | 31 |
31 class V8InspectorSessionImpl : public V8InspectorSession { | 32 class V8InspectorSessionImpl : public V8InspectorSession, public protocol::Front
endChannel { |
32 PROTOCOL_DISALLOW_COPY(V8InspectorSessionImpl); | 33 V8_INSPECTOR_DISALLOW_COPY(V8InspectorSessionImpl); |
33 public: | 34 public: |
34 static std::unique_ptr<V8InspectorSessionImpl> create(V8InspectorImpl*, int
contextGroupId, protocol::FrontendChannel*, const StringView& state); | 35 static std::unique_ptr<V8InspectorSessionImpl> create(V8InspectorImpl*, int
contextGroupId, V8Inspector::Channel*, const StringView& state); |
35 ~V8InspectorSessionImpl(); | 36 ~V8InspectorSessionImpl(); |
36 | 37 |
37 V8InspectorImpl* inspector() const { return m_inspector; } | 38 V8InspectorImpl* inspector() const { return m_inspector; } |
38 V8ConsoleAgentImpl* consoleAgent() { return m_consoleAgent.get(); } | 39 V8ConsoleAgentImpl* consoleAgent() { return m_consoleAgent.get(); } |
39 V8DebuggerAgentImpl* debuggerAgent() { return m_debuggerAgent.get(); } | 40 V8DebuggerAgentImpl* debuggerAgent() { return m_debuggerAgent.get(); } |
40 V8SchemaAgentImpl* schemaAgent() { return m_schemaAgent.get(); } | 41 V8SchemaAgentImpl* schemaAgent() { return m_schemaAgent.get(); } |
41 V8ProfilerAgentImpl* profilerAgent() { return m_profilerAgent.get(); } | 42 V8ProfilerAgentImpl* profilerAgent() { return m_profilerAgent.get(); } |
42 V8RuntimeAgentImpl* runtimeAgent() { return m_runtimeAgent.get(); } | 43 V8RuntimeAgentImpl* runtimeAgent() { return m_runtimeAgent.get(); } |
43 int contextGroupId() const { return m_contextGroupId; } | 44 int contextGroupId() const { return m_contextGroupId; } |
44 | 45 |
45 InjectedScript* findInjectedScript(ErrorString*, int contextId); | 46 InjectedScript* findInjectedScript(ErrorString*, int contextId); |
46 InjectedScript* findInjectedScript(ErrorString*, RemoteObjectIdBase*); | 47 InjectedScript* findInjectedScript(ErrorString*, RemoteObjectIdBase*); |
47 void reset(); | 48 void reset(); |
48 void discardInjectedScripts(); | 49 void discardInjectedScripts(); |
49 void reportAllContexts(V8RuntimeAgentImpl*); | 50 void reportAllContexts(V8RuntimeAgentImpl*); |
50 void setCustomObjectFormatterEnabled(bool); | 51 void setCustomObjectFormatterEnabled(bool); |
51 std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Co
ntext>, v8::Local<v8::Value>, const String16& groupName, bool generatePreview); | 52 std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Co
ntext>, v8::Local<v8::Value>, const String16& groupName, bool generatePreview); |
52 std::unique_ptr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Con
text>, v8::Local<v8::Value> table, v8::Local<v8::Value> columns); | 53 std::unique_ptr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Con
text>, v8::Local<v8::Value> table, v8::Local<v8::Value> columns); |
53 std::vector<std::unique_ptr<protocol::Schema::Domain>> supportedDomainsImpl(
); | 54 std::vector<std::unique_ptr<protocol::Schema::Domain>> supportedDomainsImpl(
); |
| 55 bool unwrapObject(ErrorString*, const String16& objectId, v8::Local<v8::Valu
e>*, v8::Local<v8::Context>*, String16* objectGroup); |
54 void releaseObjectGroup(const String16& objectGroup); | 56 void releaseObjectGroup(const String16& objectGroup); |
55 | 57 |
56 // V8InspectorSession implementation. | 58 // V8InspectorSession implementation. |
57 void dispatchProtocolMessage(const StringView& message) override; | 59 void dispatchProtocolMessage(const StringView& message) override; |
58 std::unique_ptr<StringBuffer> stateJSON() override; | 60 std::unique_ptr<StringBuffer> stateJSON() override; |
59 std::unique_ptr<blink::protocol::Array<blink::protocol::Schema::API::Domain>
> supportedDomains() override; | 61 std::vector<std::unique_ptr<protocol::Schema::API::Domain>> supportedDomains
() override; |
60 void addInspectedObject(std::unique_ptr<V8InspectorSession::Inspectable>) ov
erride; | 62 void addInspectedObject(std::unique_ptr<V8InspectorSession::Inspectable>) ov
erride; |
61 void schedulePauseOnNextStatement(const StringView& breakReason, const Strin
gView& breakDetails) override; | 63 void schedulePauseOnNextStatement(const StringView& breakReason, const Strin
gView& breakDetails) override; |
62 void cancelPauseOnNextStatement() override; | 64 void cancelPauseOnNextStatement() override; |
63 void breakProgram(const StringView& breakReason, const StringView& breakDeta
ils) override; | 65 void breakProgram(const StringView& breakReason, const StringView& breakDeta
ils) override; |
64 void setSkipAllPauses(bool) override; | 66 void setSkipAllPauses(bool) override; |
65 void resume() override; | 67 void resume() override; |
66 void stepOver() override; | 68 void stepOver() override; |
67 std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> searc
hInTextByLines(const StringView& text, const StringView& query, bool caseSensiti
ve, bool isRegex) override; | 69 std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>> searchInT
extByLines(const StringView& text, const StringView& query, bool caseSensitive,
bool isRegex) override; |
68 void releaseObjectGroup(const StringView& objectGroup) override; | 70 void releaseObjectGroup(const StringView& objectGroup) override; |
69 bool unwrapObject(ErrorString*, const StringView& objectId, v8::Local<v8::Va
lue>*, v8::Local<v8::Context>*, std::unique_ptr<StringBuffer>* objectGroup) over
ride; | 71 bool unwrapObject(std::unique_ptr<StringBuffer>*, const StringView& objectId
, v8::Local<v8::Value>*, v8::Local<v8::Context>*, std::unique_ptr<StringBuffer>*
objectGroup) override; |
70 std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject(v8::Local<v
8::Context>, v8::Local<v8::Value>, const StringView& groupName) override; | 72 std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject(v8::Local<v
8::Context>, v8::Local<v8::Value>, const StringView& groupName) override; |
71 | 73 |
72 V8InspectorSession::Inspectable* inspectedObject(unsigned num); | 74 V8InspectorSession::Inspectable* inspectedObject(unsigned num); |
73 static const unsigned kInspectedObjectBufferSize = 5; | 75 static const unsigned kInspectedObjectBufferSize = 5; |
74 | 76 |
75 private: | 77 private: |
76 V8InspectorSessionImpl(V8InspectorImpl*, int contextGroupId, protocol::Front
endChannel*, const StringView& state); | 78 V8InspectorSessionImpl(V8InspectorImpl*, int contextGroupId, V8Inspector::Ch
annel*, const StringView& state); |
77 protocol::DictionaryValue* agentState(const String16& name); | 79 protocol::DictionaryValue* agentState(const String16& name); |
78 | 80 |
| 81 // protocol::FrontendChannel implementation. |
| 82 void sendProtocolResponse(int callId, const String16& message) override; |
| 83 void sendProtocolNotification(const String16& message) override; |
| 84 void flushProtocolNotifications() override; |
| 85 |
79 int m_contextGroupId; | 86 int m_contextGroupId; |
80 V8InspectorImpl* m_inspector; | 87 V8InspectorImpl* m_inspector; |
| 88 V8Inspector::Channel* m_channel; |
81 bool m_customObjectFormatterEnabled; | 89 bool m_customObjectFormatterEnabled; |
82 | 90 |
83 protocol::UberDispatcher m_dispatcher; | 91 protocol::UberDispatcher m_dispatcher; |
84 std::unique_ptr<protocol::DictionaryValue> m_state; | 92 std::unique_ptr<protocol::DictionaryValue> m_state; |
85 | 93 |
86 std::unique_ptr<V8RuntimeAgentImpl> m_runtimeAgent; | 94 std::unique_ptr<V8RuntimeAgentImpl> m_runtimeAgent; |
87 std::unique_ptr<V8DebuggerAgentImpl> m_debuggerAgent; | 95 std::unique_ptr<V8DebuggerAgentImpl> m_debuggerAgent; |
88 std::unique_ptr<V8HeapProfilerAgentImpl> m_heapProfilerAgent; | 96 std::unique_ptr<V8HeapProfilerAgentImpl> m_heapProfilerAgent; |
89 std::unique_ptr<V8ProfilerAgentImpl> m_profilerAgent; | 97 std::unique_ptr<V8ProfilerAgentImpl> m_profilerAgent; |
90 std::unique_ptr<V8ConsoleAgentImpl> m_consoleAgent; | 98 std::unique_ptr<V8ConsoleAgentImpl> m_consoleAgent; |
91 std::unique_ptr<V8SchemaAgentImpl> m_schemaAgent; | 99 std::unique_ptr<V8SchemaAgentImpl> m_schemaAgent; |
92 std::vector<std::unique_ptr<V8InspectorSession::Inspectable>> m_inspectedObj
ects; | 100 std::vector<std::unique_ptr<V8InspectorSession::Inspectable>> m_inspectedObj
ects; |
93 }; | 101 }; |
94 | 102 |
95 } // namespace v8_inspector | 103 } // namespace v8_inspector |
96 | 104 |
97 #endif | 105 #endif |
OLD | NEW |