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