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