OLD | NEW |
| (Empty) |
1 // Copyright 2016 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_INSPECTOR_V8INSPECTORSESSIONIMPL_H_ | |
6 #define V8_INSPECTOR_V8INSPECTORSESSIONIMPL_H_ | |
7 | |
8 #include "src/inspector/Allocator.h" | |
9 #include "src/inspector/protocol/Forward.h" | |
10 #include "src/inspector/protocol/Runtime.h" | |
11 #include "src/inspector/protocol/Schema.h" | |
12 #include "src/inspector/public/V8Inspector.h" | |
13 #include "src/inspector/public/V8InspectorSession.h" | |
14 | |
15 #include <v8.h> | |
16 #include <vector> | |
17 | |
18 namespace v8_inspector { | |
19 | |
20 class InjectedScript; | |
21 class RemoteObjectIdBase; | |
22 class V8ConsoleAgentImpl; | |
23 class V8DebuggerAgentImpl; | |
24 class V8InspectorImpl; | |
25 class V8HeapProfilerAgentImpl; | |
26 class V8ProfilerAgentImpl; | |
27 class V8RuntimeAgentImpl; | |
28 class V8SchemaAgentImpl; | |
29 | |
30 using protocol::ErrorString; | |
31 | |
32 class V8InspectorSessionImpl : public V8InspectorSession, public protocol::Front
endChannel { | |
33 V8_INSPECTOR_DISALLOW_COPY(V8InspectorSessionImpl); | |
34 public: | |
35 static std::unique_ptr<V8InspectorSessionImpl> create(V8InspectorImpl*, int
contextGroupId, V8Inspector::Channel*, const StringView& state); | |
36 ~V8InspectorSessionImpl(); | |
37 | |
38 V8InspectorImpl* inspector() const { return m_inspector; } | |
39 V8ConsoleAgentImpl* consoleAgent() { return m_consoleAgent.get(); } | |
40 V8DebuggerAgentImpl* debuggerAgent() { return m_debuggerAgent.get(); } | |
41 V8SchemaAgentImpl* schemaAgent() { return m_schemaAgent.get(); } | |
42 V8ProfilerAgentImpl* profilerAgent() { return m_profilerAgent.get(); } | |
43 V8RuntimeAgentImpl* runtimeAgent() { return m_runtimeAgent.get(); } | |
44 int contextGroupId() const { return m_contextGroupId; } | |
45 | |
46 InjectedScript* findInjectedScript(ErrorString*, int contextId); | |
47 InjectedScript* findInjectedScript(ErrorString*, RemoteObjectIdBase*); | |
48 void reset(); | |
49 void discardInjectedScripts(); | |
50 void reportAllContexts(V8RuntimeAgentImpl*); | |
51 void setCustomObjectFormatterEnabled(bool); | |
52 std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Co
ntext>, v8::Local<v8::Value>, const String16& groupName, bool generatePreview); | |
53 std::unique_ptr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Con
text>, v8::Local<v8::Value> table, v8::Local<v8::Value> columns); | |
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); | |
56 void releaseObjectGroup(const String16& objectGroup); | |
57 | |
58 // V8InspectorSession implementation. | |
59 void dispatchProtocolMessage(const StringView& message) override; | |
60 std::unique_ptr<StringBuffer> stateJSON() override; | |
61 std::vector<std::unique_ptr<protocol::Schema::API::Domain>> supportedDomains
() override; | |
62 void addInspectedObject(std::unique_ptr<V8InspectorSession::Inspectable>) ov
erride; | |
63 void schedulePauseOnNextStatement(const StringView& breakReason, const Strin
gView& breakDetails) override; | |
64 void cancelPauseOnNextStatement() override; | |
65 void breakProgram(const StringView& breakReason, const StringView& breakDeta
ils) override; | |
66 void setSkipAllPauses(bool) override; | |
67 void resume() override; | |
68 void stepOver() override; | |
69 std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>> searchInT
extByLines(const StringView& text, const StringView& query, bool caseSensitive,
bool isRegex) override; | |
70 void releaseObjectGroup(const StringView& objectGroup) override; | |
71 bool unwrapObject(std::unique_ptr<StringBuffer>*, const StringView& objectId
, v8::Local<v8::Value>*, v8::Local<v8::Context>*, std::unique_ptr<StringBuffer>*
objectGroup) override; | |
72 std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject(v8::Local<v
8::Context>, v8::Local<v8::Value>, const StringView& groupName) override; | |
73 | |
74 V8InspectorSession::Inspectable* inspectedObject(unsigned num); | |
75 static const unsigned kInspectedObjectBufferSize = 5; | |
76 | |
77 private: | |
78 V8InspectorSessionImpl(V8InspectorImpl*, int contextGroupId, V8Inspector::Ch
annel*, const StringView& state); | |
79 protocol::DictionaryValue* agentState(const String16& name); | |
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 | |
86 int m_contextGroupId; | |
87 V8InspectorImpl* m_inspector; | |
88 V8Inspector::Channel* m_channel; | |
89 bool m_customObjectFormatterEnabled; | |
90 | |
91 protocol::UberDispatcher m_dispatcher; | |
92 std::unique_ptr<protocol::DictionaryValue> m_state; | |
93 | |
94 std::unique_ptr<V8RuntimeAgentImpl> m_runtimeAgent; | |
95 std::unique_ptr<V8DebuggerAgentImpl> m_debuggerAgent; | |
96 std::unique_ptr<V8HeapProfilerAgentImpl> m_heapProfilerAgent; | |
97 std::unique_ptr<V8ProfilerAgentImpl> m_profilerAgent; | |
98 std::unique_ptr<V8ConsoleAgentImpl> m_consoleAgent; | |
99 std::unique_ptr<V8SchemaAgentImpl> m_schemaAgent; | |
100 std::vector<std::unique_ptr<V8InspectorSession::Inspectable>> m_inspectedObj
ects; | |
101 }; | |
102 | |
103 } // namespace v8_inspector | |
104 | |
105 #endif // V8_INSPECTOR_V8INSPECTORSESSIONIMPL_H_ | |
OLD | NEW |