Chromium Code Reviews| 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 "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 WebCore { | 41 namespace WebCore { |
| 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*); | |
|
haraken
2014/06/12 05:53:00
Add OVERRIDE.
keishi
2014/06/13 03:37:33
This is the base class.
| |
| 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; |
| 65 InspectorState* m_state; | 68 InspectorState* m_state; |
|
haraken
2014/06/12 05:53:00
This raw pointer looks safe because InspectorCompo
keishi
2014/06/13 03:37:33
Done.
| |
| 66 | 69 |
| 67 private: | 70 private: |
| 68 String m_name; | 71 String m_name; |
| 69 }; | 72 }; |
| 70 | 73 |
| 71 class InspectorAgentRegistry { | 74 class InspectorAgentRegistry : public NoBaseWillBeGarbageCollectedFinalized<Insp ectorAgentRegistry> { |
|
haraken
2014/06/12 05:53:00
Add FINAL.
keishi
2014/06/13 03:37:32
Done.
| |
| 72 public: | 75 public: |
| 73 InspectorAgentRegistry(InstrumentingAgents*, InspectorCompositeState*); | 76 InspectorAgentRegistry(InstrumentingAgents*, InspectorCompositeState*); |
| 74 void append(PassOwnPtr<InspectorAgent>); | 77 void append(PassOwnPtrWillBeRawPtr<InspectorAgent>); |
| 75 | 78 |
| 76 void setFrontend(InspectorFrontend*); | 79 void setFrontend(InspectorFrontend*); |
| 77 void clearFrontend(); | 80 void clearFrontend(); |
| 78 void restore(); | 81 void restore(); |
| 79 void registerInDispatcher(InspectorBackendDispatcher*); | 82 void registerInDispatcher(InspectorBackendDispatcher*); |
| 80 void discardAgents(); | 83 void discardAgents(); |
| 81 void flushPendingFrontendMessages(); | 84 void flushPendingFrontendMessages(); |
| 82 | 85 |
| 86 void trace(Visitor*); | |
| 87 | |
| 83 private: | 88 private: |
| 84 InstrumentingAgents* m_instrumentingAgents; | 89 RawPtrWillBeMember<InstrumentingAgents> m_instrumentingAgents; |
| 85 InspectorCompositeState* m_inspectorState; | 90 InspectorCompositeState* m_inspectorState; |
|
keishi
2014/06/11 14:10:53
SAFE: InspectorAgentRegistry and InspectorComposit
haraken
2014/06/12 05:53:00
I agree that this is safe, but it would be better
keishi
2014/06/13 03:37:33
Done.
| |
| 86 Vector<OwnPtr<InspectorAgent> > m_agents; | 91 WillBeHeapVector<OwnPtrWillBeMember<InspectorAgent> > m_agents; |
| 87 }; | 92 }; |
| 88 | 93 |
| 89 template<typename T> | 94 template<typename T> |
| 90 class InspectorBaseAgent : public InspectorAgent { | 95 class InspectorBaseAgent : public InspectorAgent { |
| 91 public: | 96 public: |
| 92 virtual ~InspectorBaseAgent() { } | 97 virtual ~InspectorBaseAgent() { } |
| 93 | 98 |
| 94 virtual void registerInDispatcher(InspectorBackendDispatcher* dispatcher) OV ERRIDE FINAL | 99 virtual void registerInDispatcher(InspectorBackendDispatcher* dispatcher) OV ERRIDE FINAL |
| 95 { | 100 { |
| 96 dispatcher->registerAgent(static_cast<T*>(this)); | 101 dispatcher->registerAgent(static_cast<T*>(this)); |
| 97 } | 102 } |
| 98 | 103 |
| 99 protected: | 104 protected: |
| 100 InspectorBaseAgent(const String& name) : InspectorAgent(name) | 105 InspectorBaseAgent(const String& name) : InspectorAgent(name) |
| 101 { | 106 { |
| 102 } | 107 } |
| 103 }; | 108 }; |
| 104 | 109 |
| 105 } // namespace WebCore | 110 } // namespace WebCore |
| 106 | 111 |
| 107 #endif // !defined(InspectorBaseAgent_h) | 112 #endif // !defined(InspectorBaseAgent_h) |
| OLD | NEW |