| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef InspectorBaseAgent_h | 31 #ifndef InspectorBaseAgent_h |
| 32 #define InspectorBaseAgent_h | 32 #define InspectorBaseAgent_h |
| 33 | 33 |
| 34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "core/inspector/InstrumentingAgents.h" | 35 #include "core/inspector/InstrumentingAgents.h" |
| 36 #include "platform/JSONValues.h" | |
| 37 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
| 38 #include "platform/inspector_protocol/Dispatcher.h" | 37 #include "platform/inspector_protocol/Dispatcher.h" |
| 39 #include "platform/inspector_protocol/Frontend.h" | 38 #include "platform/inspector_protocol/Frontend.h" |
| 40 #include "platform/inspector_protocol/TypeBuilder.h" | 39 #include "platform/inspector_protocol/TypeBuilder.h" |
| 40 #include "platform/inspector_protocol/Values.h" |
| 41 #include "wtf/Forward.h" | 41 #include "wtf/Forward.h" |
| 42 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
| 43 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 class Frontend; | 47 class Frontend; |
| 48 class InstrumentingAgents; | 48 class InstrumentingAgents; |
| 49 class LocalFrame; | 49 class LocalFrame; |
| 50 | 50 |
| 51 using protocol::Maybe; | 51 using protocol::Maybe; |
| 52 | 52 |
| 53 class CORE_EXPORT InspectorAgent : public NoBaseWillBeGarbageCollectedFinalized<
InspectorAgent> { | 53 class CORE_EXPORT InspectorAgent : public NoBaseWillBeGarbageCollectedFinalized<
InspectorAgent> { |
| 54 USING_FAST_MALLOC_WILL_BE_REMOVED(InspectorAgent); | 54 USING_FAST_MALLOC_WILL_BE_REMOVED(InspectorAgent); |
| 55 public: | 55 public: |
| 56 explicit InspectorAgent(const String&); | 56 explicit InspectorAgent(const String&); |
| 57 virtual ~InspectorAgent(); | 57 virtual ~InspectorAgent(); |
| 58 DECLARE_VIRTUAL_TRACE(); | 58 DECLARE_VIRTUAL_TRACE(); |
| 59 | 59 |
| 60 virtual void init() { } | 60 virtual void init() { } |
| 61 virtual void setFrontend(protocol::Frontend*) = 0; | 61 virtual void setFrontend(protocol::Frontend*) = 0; |
| 62 virtual void clearFrontend() = 0; | 62 virtual void clearFrontend() = 0; |
| 63 virtual void disable(ErrorString*) { } | 63 virtual void disable(ErrorString*) { } |
| 64 virtual void restore() { } | 64 virtual void restore() { } |
| 65 virtual void registerInDispatcher(protocol::Dispatcher*) = 0; | 65 virtual void registerInDispatcher(protocol::Dispatcher*) = 0; |
| 66 virtual void discardAgent() { } | 66 virtual void discardAgent() { } |
| 67 virtual void didCommitLoadForLocalFrame(LocalFrame*) { } | 67 virtual void didCommitLoadForLocalFrame(LocalFrame*) { } |
| 68 virtual void flushPendingProtocolNotifications() { } | 68 virtual void flushPendingProtocolNotifications() { } |
| 69 virtual void setState(PassRefPtr<JSONObject>); | 69 virtual void setState(PassRefPtr<protocol::DictionaryValue>); |
| 70 | 70 |
| 71 String name() const { return m_name; } | 71 String name() const { return m_name; } |
| 72 void appended(InstrumentingAgents*); | 72 void appended(InstrumentingAgents*); |
| 73 | 73 |
| 74 protected: | 74 protected: |
| 75 RawPtrWillBeMember<InstrumentingAgents> m_instrumentingAgents; | 75 RawPtrWillBeMember<InstrumentingAgents> m_instrumentingAgents; |
| 76 RefPtr<JSONObject> m_state; | 76 RefPtr<protocol::DictionaryValue> m_state; |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 String m_name; | 79 String m_name; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 class CORE_EXPORT InspectorAgentRegistry final { | 82 class CORE_EXPORT InspectorAgentRegistry final { |
| 83 DISALLOW_NEW(); | 83 DISALLOW_NEW(); |
| 84 WTF_MAKE_NONCOPYABLE(InspectorAgentRegistry); | 84 WTF_MAKE_NONCOPYABLE(InspectorAgentRegistry); |
| 85 public: | 85 public: |
| 86 explicit InspectorAgentRegistry(InstrumentingAgents*); | 86 explicit InspectorAgentRegistry(InstrumentingAgents*); |
| 87 void append(PassOwnPtrWillBeRawPtr<InspectorAgent>); | 87 void append(PassOwnPtrWillBeRawPtr<InspectorAgent>); |
| 88 | 88 |
| 89 void setFrontend(protocol::Frontend*); | 89 void setFrontend(protocol::Frontend*); |
| 90 void clearFrontend(); | 90 void clearFrontend(); |
| 91 void restore(const String& savedState); | 91 void restore(const String& savedState); |
| 92 void registerInDispatcher(protocol::Dispatcher*); | 92 void registerInDispatcher(protocol::Dispatcher*); |
| 93 void discardAgents(); | 93 void discardAgents(); |
| 94 void flushPendingProtocolNotifications(); | 94 void flushPendingProtocolNotifications(); |
| 95 void didCommitLoadForLocalFrame(LocalFrame*); | 95 void didCommitLoadForLocalFrame(LocalFrame*); |
| 96 String state(); | 96 String state(); |
| 97 | 97 |
| 98 DECLARE_TRACE(); | 98 DECLARE_TRACE(); |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 RawPtrWillBeMember<InstrumentingAgents> m_instrumentingAgents; | 101 RawPtrWillBeMember<InstrumentingAgents> m_instrumentingAgents; |
| 102 RefPtr<JSONObject> m_state; | 102 RefPtr<protocol::DictionaryValue> m_state; |
| 103 WillBeHeapVector<OwnPtrWillBeMember<InspectorAgent>> m_agents; | 103 WillBeHeapVector<OwnPtrWillBeMember<InspectorAgent>> m_agents; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 template<typename AgentClass, typename FrontendClass> | 106 template<typename AgentClass, typename FrontendClass> |
| 107 class InspectorBaseAgent : public InspectorAgent { | 107 class InspectorBaseAgent : public InspectorAgent { |
| 108 public: | 108 public: |
| 109 ~InspectorBaseAgent() override { } | 109 ~InspectorBaseAgent() override { } |
| 110 | 110 |
| 111 void setFrontend(protocol::Frontend* frontend) override | 111 void setFrontend(protocol::Frontend* frontend) override |
| 112 { | 112 { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 inline bool asBool(const bool* const b) | 143 inline bool asBool(const bool* const b) |
| 144 { | 144 { |
| 145 return b ? *b : false; | 145 return b ? *b : false; |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace blink | 148 } // namespace blink |
| 149 | 149 |
| 150 #endif // !defined(InspectorBaseAgent_h) | 150 #endif // !defined(InspectorBaseAgent_h) |
| OLD | NEW |