| 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/base/macros.h" | |
| 9 #include "src/inspector/protocol/Forward.h" | |
| 10 #include "src/inspector/protocol/Runtime.h" | |
| 11 #include "src/inspector/protocol/Schema.h" | |
| 12 | |
| 13 #include "include/v8-inspector.h" | |
| 14 | |
| 15 #include <vector> | |
| 16 | |
| 17 namespace v8_inspector { | |
| 18 | |
| 19 class InjectedScript; | |
| 20 class RemoteObjectIdBase; | |
| 21 class V8ConsoleAgentImpl; | |
| 22 class V8DebuggerAgentImpl; | |
| 23 class V8InspectorImpl; | |
| 24 class V8HeapProfilerAgentImpl; | |
| 25 class V8ProfilerAgentImpl; | |
| 26 class V8RuntimeAgentImpl; | |
| 27 class V8SchemaAgentImpl; | |
| 28 | |
| 29 using protocol::ErrorString; | |
| 30 | |
| 31 class V8InspectorSessionImpl : public V8InspectorSession, | |
| 32 public protocol::FrontendChannel { | |
| 33 DISALLOW_COPY_AND_ASSIGN(V8InspectorSessionImpl); | |
| 34 | |
| 35 public: | |
| 36 static std::unique_ptr<V8InspectorSessionImpl> create( | |
| 37 V8InspectorImpl*, int contextGroupId, V8Inspector::Channel*, | |
| 38 const StringView& state); | |
| 39 ~V8InspectorSessionImpl(); | |
| 40 | |
| 41 V8InspectorImpl* inspector() const { return m_inspector; } | |
| 42 V8ConsoleAgentImpl* consoleAgent() { return m_consoleAgent.get(); } | |
| 43 V8DebuggerAgentImpl* debuggerAgent() { return m_debuggerAgent.get(); } | |
| 44 V8SchemaAgentImpl* schemaAgent() { return m_schemaAgent.get(); } | |
| 45 V8ProfilerAgentImpl* profilerAgent() { return m_profilerAgent.get(); } | |
| 46 V8RuntimeAgentImpl* runtimeAgent() { return m_runtimeAgent.get(); } | |
| 47 int contextGroupId() const { return m_contextGroupId; } | |
| 48 | |
| 49 InjectedScript* findInjectedScript(ErrorString*, int contextId); | |
| 50 InjectedScript* findInjectedScript(ErrorString*, RemoteObjectIdBase*); | |
| 51 void reset(); | |
| 52 void discardInjectedScripts(); | |
| 53 void reportAllContexts(V8RuntimeAgentImpl*); | |
| 54 void setCustomObjectFormatterEnabled(bool); | |
| 55 std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject( | |
| 56 v8::Local<v8::Context>, v8::Local<v8::Value>, const String16& groupName, | |
| 57 bool generatePreview); | |
| 58 std::unique_ptr<protocol::Runtime::RemoteObject> wrapTable( | |
| 59 v8::Local<v8::Context>, v8::Local<v8::Value> table, | |
| 60 v8::Local<v8::Value> columns); | |
| 61 std::vector<std::unique_ptr<protocol::Schema::Domain>> supportedDomainsImpl(); | |
| 62 bool unwrapObject(ErrorString*, const String16& objectId, | |
| 63 v8::Local<v8::Value>*, v8::Local<v8::Context>*, | |
| 64 String16* objectGroup); | |
| 65 void releaseObjectGroup(const String16& objectGroup); | |
| 66 | |
| 67 // V8InspectorSession implementation. | |
| 68 void dispatchProtocolMessage(const StringView& message) override; | |
| 69 std::unique_ptr<StringBuffer> stateJSON() override; | |
| 70 std::vector<std::unique_ptr<protocol::Schema::API::Domain>> supportedDomains() | |
| 71 override; | |
| 72 void addInspectedObject( | |
| 73 std::unique_ptr<V8InspectorSession::Inspectable>) override; | |
| 74 void schedulePauseOnNextStatement(const StringView& breakReason, | |
| 75 const StringView& breakDetails) override; | |
| 76 void cancelPauseOnNextStatement() override; | |
| 77 void breakProgram(const StringView& breakReason, | |
| 78 const StringView& breakDetails) override; | |
| 79 void setSkipAllPauses(bool) override; | |
| 80 void resume() override; | |
| 81 void stepOver() override; | |
| 82 std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>> | |
| 83 searchInTextByLines(const StringView& text, const StringView& query, | |
| 84 bool caseSensitive, bool isRegex) override; | |
| 85 void releaseObjectGroup(const StringView& objectGroup) override; | |
| 86 bool unwrapObject(std::unique_ptr<StringBuffer>*, const StringView& objectId, | |
| 87 v8::Local<v8::Value>*, v8::Local<v8::Context>*, | |
| 88 std::unique_ptr<StringBuffer>* objectGroup) override; | |
| 89 std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject( | |
| 90 v8::Local<v8::Context>, v8::Local<v8::Value>, | |
| 91 const StringView& groupName) override; | |
| 92 | |
| 93 V8InspectorSession::Inspectable* inspectedObject(unsigned num); | |
| 94 static const unsigned kInspectedObjectBufferSize = 5; | |
| 95 | |
| 96 private: | |
| 97 V8InspectorSessionImpl(V8InspectorImpl*, int contextGroupId, | |
| 98 V8Inspector::Channel*, const StringView& state); | |
| 99 protocol::DictionaryValue* agentState(const String16& name); | |
| 100 | |
| 101 // protocol::FrontendChannel implementation. | |
| 102 void sendProtocolResponse(int callId, const String16& message) override; | |
| 103 void sendProtocolNotification(const String16& message) override; | |
| 104 void flushProtocolNotifications() override; | |
| 105 | |
| 106 int m_contextGroupId; | |
| 107 V8InspectorImpl* m_inspector; | |
| 108 V8Inspector::Channel* m_channel; | |
| 109 bool m_customObjectFormatterEnabled; | |
| 110 | |
| 111 protocol::UberDispatcher m_dispatcher; | |
| 112 std::unique_ptr<protocol::DictionaryValue> m_state; | |
| 113 | |
| 114 std::unique_ptr<V8RuntimeAgentImpl> m_runtimeAgent; | |
| 115 std::unique_ptr<V8DebuggerAgentImpl> m_debuggerAgent; | |
| 116 std::unique_ptr<V8HeapProfilerAgentImpl> m_heapProfilerAgent; | |
| 117 std::unique_ptr<V8ProfilerAgentImpl> m_profilerAgent; | |
| 118 std::unique_ptr<V8ConsoleAgentImpl> m_consoleAgent; | |
| 119 std::unique_ptr<V8SchemaAgentImpl> m_schemaAgent; | |
| 120 std::vector<std::unique_ptr<V8InspectorSession::Inspectable>> | |
| 121 m_inspectedObjects; | |
| 122 }; | |
| 123 | |
| 124 } // namespace v8_inspector | |
| 125 | |
| 126 #endif // V8_INSPECTOR_V8INSPECTORSESSIONIMPL_H_ | |
| OLD | NEW |