| 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/Allocator.h" | 8 #include "platform/inspector_protocol/Allocator.h" |
| 9 #include "platform/inspector_protocol/Collections.h" | 9 #include "platform/inspector_protocol/Collections.h" |
| 10 #include "platform/inspector_protocol/Dispatcher.h" | 10 #include "platform/inspector_protocol/Dispatcher.h" |
| 11 #include "platform/inspector_protocol/Frontend.h" | 11 #include "platform/inspector_protocol/Frontend.h" |
| 12 #include "platform/inspector_protocol/String16.h" | 12 #include "platform/inspector_protocol/String16.h" |
| 13 #include "platform/inspector_protocol/TypeBuilder.h" | 13 #include "platform/inspector_protocol/TypeBuilder.h" |
| 14 #include "platform/v8_inspector/public/V8InspectorSession.h" | 14 #include "platform/v8_inspector/public/V8InspectorSession.h" |
| 15 #include "platform/v8_inspector/public/V8InspectorSessionClient.h" | 15 #include "platform/v8_inspector/public/V8InspectorSessionClient.h" |
| 16 #include "wtf/PassOwnPtr.h" | 16 #include "wtf/PtrUtil.h" |
| 17 | 17 |
| 18 #include <v8.h> | 18 #include <v8.h> |
| 19 | 19 |
| 20 namespace blink { | 20 namespace blink { |
| 21 | 21 |
| 22 class InjectedScript; | 22 class InjectedScript; |
| 23 class RemoteObjectIdBase; | 23 class RemoteObjectIdBase; |
| 24 class V8DebuggerAgentImpl; | 24 class V8DebuggerAgentImpl; |
| 25 class V8DebuggerImpl; | 25 class V8DebuggerImpl; |
| 26 class V8HeapProfilerAgentImpl; | 26 class V8HeapProfilerAgentImpl; |
| 27 class V8ProfilerAgentImpl; | 27 class V8ProfilerAgentImpl; |
| 28 class V8RuntimeAgentImpl; | 28 class V8RuntimeAgentImpl; |
| 29 | 29 |
| 30 class V8InspectorSessionImpl : public V8InspectorSession { | 30 class V8InspectorSessionImpl : public V8InspectorSession { |
| 31 PROTOCOL_DISALLOW_COPY(V8InspectorSessionImpl); | 31 PROTOCOL_DISALLOW_COPY(V8InspectorSessionImpl); |
| 32 public: | 32 public: |
| 33 static PassOwnPtr<V8InspectorSessionImpl> create(V8DebuggerImpl*, int contex
tGroupId, V8InspectorSessionClient*, const String16* state); | 33 static std::unique_ptr<V8InspectorSessionImpl> create(V8DebuggerImpl*, int c
ontextGroupId, V8InspectorSessionClient*, const String16* state); |
| 34 ~V8InspectorSessionImpl(); | 34 ~V8InspectorSessionImpl(); |
| 35 | 35 |
| 36 V8DebuggerImpl* debugger() const { return m_debugger; } | 36 V8DebuggerImpl* debugger() const { return m_debugger; } |
| 37 V8InspectorSessionClient* client() const { return m_client; } | 37 V8InspectorSessionClient* client() const { return m_client; } |
| 38 V8DebuggerAgentImpl* debuggerAgent() { return m_debuggerAgent.get(); } | 38 V8DebuggerAgentImpl* debuggerAgent() { return m_debuggerAgent.get(); } |
| 39 V8ProfilerAgentImpl* profilerAgent() { return m_profilerAgent.get(); } | 39 V8ProfilerAgentImpl* profilerAgent() { return m_profilerAgent.get(); } |
| 40 V8RuntimeAgentImpl* runtimeAgent() { return m_runtimeAgent.get(); } | 40 V8RuntimeAgentImpl* runtimeAgent() { return m_runtimeAgent.get(); } |
| 41 int contextGroupId() const { return m_contextGroupId; } | 41 int contextGroupId() const { return m_contextGroupId; } |
| 42 | 42 |
| 43 InjectedScript* findInjectedScript(ErrorString*, int contextId); | 43 InjectedScript* findInjectedScript(ErrorString*, int contextId); |
| 44 InjectedScript* findInjectedScript(ErrorString*, RemoteObjectIdBase*); | 44 InjectedScript* findInjectedScript(ErrorString*, RemoteObjectIdBase*); |
| 45 void reset(); | 45 void reset(); |
| 46 void discardInjectedScripts(); | 46 void discardInjectedScripts(); |
| 47 void reportAllContexts(V8RuntimeAgentImpl*); | 47 void reportAllContexts(V8RuntimeAgentImpl*); |
| 48 void setCustomObjectFormatterEnabled(bool); | 48 void setCustomObjectFormatterEnabled(bool); |
| 49 void changeInstrumentationCounter(int delta); | 49 void changeInstrumentationCounter(int delta); |
| 50 | 50 |
| 51 // V8InspectorSession implementation. | 51 // V8InspectorSession implementation. |
| 52 void dispatchProtocolMessage(const String16& message) override; | 52 void dispatchProtocolMessage(const String16& message) override; |
| 53 String16 stateJSON() override; | 53 String16 stateJSON() override; |
| 54 void addInspectedObject(PassOwnPtr<V8InspectorSession::Inspectable>) overrid
e; | 54 void addInspectedObject(std::unique_ptr<V8InspectorSession::Inspectable>) ov
erride; |
| 55 void schedulePauseOnNextStatement(const String16& breakReason, PassOwnPtr<pr
otocol::DictionaryValue> data) override; | 55 void schedulePauseOnNextStatement(const String16& breakReason, std::unique_p
tr<protocol::DictionaryValue> data) override; |
| 56 void cancelPauseOnNextStatement() override; | 56 void cancelPauseOnNextStatement() override; |
| 57 void breakProgram(const String16& breakReason, PassOwnPtr<protocol::Dictiona
ryValue> data) override; | 57 void breakProgram(const String16& breakReason, std::unique_ptr<protocol::Dic
tionaryValue> data) override; |
| 58 void breakProgramOnException(const String16& breakReason, PassOwnPtr<protoco
l::DictionaryValue> data) override; | 58 void breakProgramOnException(const String16& breakReason, std::unique_ptr<pr
otocol::DictionaryValue> data) override; |
| 59 void setSkipAllPauses(bool) override; | 59 void setSkipAllPauses(bool) override; |
| 60 void resume() override; | 60 void resume() override; |
| 61 void stepOver() override; | 61 void stepOver() override; |
| 62 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring
) override; | 62 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring
) override; |
| 63 void asyncTaskCanceled(void* task) override; | 63 void asyncTaskCanceled(void* task) override; |
| 64 void asyncTaskStarted(void* task) override; | 64 void asyncTaskStarted(void* task) override; |
| 65 void asyncTaskFinished(void* task) override; | 65 void asyncTaskFinished(void* task) override; |
| 66 void allAsyncTasksCanceled() override; | 66 void allAsyncTasksCanceled() override; |
| 67 void releaseObjectGroup(const String16& objectGroup) override; | 67 void releaseObjectGroup(const String16& objectGroup) override; |
| 68 v8::Local<v8::Value> findObject(ErrorString*, const String16& objectId, v8::
Local<v8::Context>* = nullptr, String16* groupName = nullptr) override; | 68 v8::Local<v8::Value> findObject(ErrorString*, const String16& objectId, v8::
Local<v8::Context>* = nullptr, String16* groupName = nullptr) override; |
| 69 PassOwnPtr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Context
>, v8::Local<v8::Value>, const String16& groupName, bool generatePreview = false
) override; | 69 std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Co
ntext>, v8::Local<v8::Value>, const String16& groupName, bool generatePreview =
false) override; |
| 70 PassOwnPtr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Context>
, v8::Local<v8::Value> table, v8::Local<v8::Value> columns) override; | 70 std::unique_ptr<protocol::Runtime::RemoteObject> wrapTable(v8::Local<v8::Con
text>, v8::Local<v8::Value> table, v8::Local<v8::Value> columns) override; |
| 71 | 71 |
| 72 V8InspectorSession::Inspectable* inspectedObject(unsigned num); | 72 V8InspectorSession::Inspectable* inspectedObject(unsigned num); |
| 73 static const unsigned kInspectedObjectBufferSize = 5; | 73 static const unsigned kInspectedObjectBufferSize = 5; |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 V8InspectorSessionImpl(V8DebuggerImpl*, int contextGroupId, V8InspectorSessi
onClient*, const String16* state); | 76 V8InspectorSessionImpl(V8DebuggerImpl*, int contextGroupId, V8InspectorSessi
onClient*, const String16* state); |
| 77 protocol::DictionaryValue* agentState(const String16& name); | 77 protocol::DictionaryValue* agentState(const String16& name); |
| 78 | 78 |
| 79 int m_contextGroupId; | 79 int m_contextGroupId; |
| 80 V8DebuggerImpl* m_debugger; | 80 V8DebuggerImpl* m_debugger; |
| 81 V8InspectorSessionClient* m_client; | 81 V8InspectorSessionClient* m_client; |
| 82 bool m_customObjectFormatterEnabled; | 82 bool m_customObjectFormatterEnabled; |
| 83 int m_instrumentationCounter; | 83 int m_instrumentationCounter; |
| 84 | 84 |
| 85 OwnPtr<protocol::Frontend> m_frontend; | 85 std::unique_ptr<protocol::Frontend> m_frontend; |
| 86 OwnPtr<protocol::Dispatcher> m_dispatcher; | 86 std::unique_ptr<protocol::Dispatcher> m_dispatcher; |
| 87 OwnPtr<protocol::DictionaryValue> m_state; | 87 std::unique_ptr<protocol::DictionaryValue> m_state; |
| 88 | 88 |
| 89 OwnPtr<V8RuntimeAgentImpl> m_runtimeAgent; | 89 std::unique_ptr<V8RuntimeAgentImpl> m_runtimeAgent; |
| 90 OwnPtr<V8DebuggerAgentImpl> m_debuggerAgent; | 90 std::unique_ptr<V8DebuggerAgentImpl> m_debuggerAgent; |
| 91 OwnPtr<V8HeapProfilerAgentImpl> m_heapProfilerAgent; | 91 std::unique_ptr<V8HeapProfilerAgentImpl> m_heapProfilerAgent; |
| 92 OwnPtr<V8ProfilerAgentImpl> m_profilerAgent; | 92 std::unique_ptr<V8ProfilerAgentImpl> m_profilerAgent; |
| 93 protocol::Vector<OwnPtr<V8InspectorSession::Inspectable>> m_inspectedObjects
; | 93 protocol::Vector<std::unique_ptr<V8InspectorSession::Inspectable>> m_inspect
edObjects; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace blink | 96 } // namespace blink |
| 97 | 97 |
| 98 #endif | 98 #endif |
| OLD | NEW |