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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
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 "InspectorBackendDispatcher.h" | 34 #include "InspectorBackendDispatcher.h" |
| 35 #include "platform/heap/Handle.h" |
35 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
36 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
37 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
38 | 39 |
39 namespace WebCore { | 40 namespace WebCore { |
40 | 41 |
41 class InspectorFrontend; | 42 class InspectorFrontend; |
42 class InspectorCompositeState; | 43 class InspectorCompositeState; |
43 class InspectorState; | 44 class InspectorState; |
44 class InstrumentingAgents; | 45 class InstrumentingAgents; |
45 | 46 |
46 class InspectorAgent { | 47 class InspectorAgent : public NoBaseWillBeGarbageCollectedFinalized<InspectorAge
nt> { |
47 public: | 48 public: |
48 explicit InspectorAgent(const String&); | 49 explicit InspectorAgent(const String&); |
49 virtual ~InspectorAgent(); | 50 virtual ~InspectorAgent(); |
| 51 virtual void trace(Visitor*); |
50 | 52 |
51 virtual void init() { } | 53 virtual void init() { } |
52 virtual void setFrontend(InspectorFrontend*) { } | 54 virtual void setFrontend(InspectorFrontend*) { } |
53 virtual void clearFrontend() { } | 55 virtual void clearFrontend() { } |
54 virtual void restore() { } | 56 virtual void restore() { } |
55 virtual void registerInDispatcher(InspectorBackendDispatcher*) = 0; | 57 virtual void registerInDispatcher(InspectorBackendDispatcher*) = 0; |
56 virtual void discardAgent() { } | 58 virtual void discardAgent() { } |
57 virtual void didCommitLoadForMainFrame() { } | 59 virtual void didCommitLoadForMainFrame() { } |
58 virtual void flushPendingFrontendMessages() { } | 60 virtual void flushPendingFrontendMessages() { } |
59 | 61 |
60 String name() { return m_name; } | 62 String name() { return m_name; } |
61 void appended(InstrumentingAgents*, InspectorState*); | 63 void appended(InstrumentingAgents*, InspectorState*); |
62 | 64 |
63 protected: | 65 protected: |
64 InstrumentingAgents* m_instrumentingAgents; | 66 RawPtrWillBeMember<InstrumentingAgents> m_instrumentingAgents; |
65 InspectorState* m_state; | 67 InspectorState* m_state; |
66 | 68 |
67 private: | 69 private: |
68 String m_name; | 70 String m_name; |
69 }; | 71 }; |
70 | 72 |
71 class InspectorAgentRegistry { | 73 class InspectorAgentRegistry : public NoBaseWillBeGarbageCollectedFinalized<Insp
ectorAgentRegistry> { |
72 public: | 74 public: |
73 InspectorAgentRegistry(InstrumentingAgents*, InspectorCompositeState*); | 75 InspectorAgentRegistry(InstrumentingAgents*, InspectorCompositeState*); |
74 void append(PassOwnPtr<InspectorAgent>); | 76 void append(PassOwnPtrWillBeRawPtr<InspectorAgent>); |
75 | 77 |
76 void setFrontend(InspectorFrontend*); | 78 void setFrontend(InspectorFrontend*); |
77 void clearFrontend(); | 79 void clearFrontend(); |
78 void restore(); | 80 void restore(); |
79 void registerInDispatcher(InspectorBackendDispatcher*); | 81 void registerInDispatcher(InspectorBackendDispatcher*); |
80 void discardAgents(); | 82 void discardAgents(); |
81 void flushPendingFrontendMessages(); | 83 void flushPendingFrontendMessages(); |
82 | 84 |
| 85 void trace(Visitor*); |
| 86 |
83 private: | 87 private: |
84 InstrumentingAgents* m_instrumentingAgents; | 88 RawPtrWillBeMember<InstrumentingAgents> m_instrumentingAgents; |
85 InspectorCompositeState* m_inspectorState; | 89 InspectorCompositeState* m_inspectorState; |
86 Vector<OwnPtr<InspectorAgent> > m_agents; | 90 WillBeHeapVector<RawPtrWillBeMember<InspectorAgent> > m_agents; |
87 }; | 91 }; |
88 | 92 |
89 template<typename T> | 93 template<typename T> |
90 class InspectorBaseAgent : public InspectorAgent { | 94 class InspectorBaseAgent : public InspectorAgent { |
91 public: | 95 public: |
92 virtual ~InspectorBaseAgent() { } | 96 virtual ~InspectorBaseAgent() { } |
93 | 97 |
94 virtual void registerInDispatcher(InspectorBackendDispatcher* dispatcher) OV
ERRIDE FINAL | 98 virtual void registerInDispatcher(InspectorBackendDispatcher* dispatcher) OV
ERRIDE FINAL |
95 { | 99 { |
96 dispatcher->registerAgent(static_cast<T*>(this)); | 100 dispatcher->registerAgent(static_cast<T*>(this)); |
97 } | 101 } |
98 | 102 |
99 protected: | 103 protected: |
100 InspectorBaseAgent(const String& name) : InspectorAgent(name) | 104 InspectorBaseAgent(const String& name) : InspectorAgent(name) |
101 { | 105 { |
102 } | 106 } |
103 }; | 107 }; |
104 | 108 |
105 } // namespace WebCore | 109 } // namespace WebCore |
106 | 110 |
107 #endif // !defined(InspectorBaseAgent_h) | 111 #endif // !defined(InspectorBaseAgent_h) |
OLD | NEW |