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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 explicit InspectorAgent(const String&); | 48 explicit InspectorAgent(const String&); |
49 virtual ~InspectorAgent(); | 49 virtual ~InspectorAgent(); |
50 | 50 |
51 virtual void init() { } | 51 virtual void init() { } |
52 virtual void setFrontend(InspectorFrontend*) { } | 52 virtual void setFrontend(InspectorFrontend*) { } |
53 virtual void clearFrontend() { } | 53 virtual void clearFrontend() { } |
54 virtual void restore() { } | 54 virtual void restore() { } |
55 virtual void registerInDispatcher(InspectorBackendDispatcher*) = 0; | 55 virtual void registerInDispatcher(InspectorBackendDispatcher*) = 0; |
56 virtual void discardAgent() { } | 56 virtual void discardAgent() { } |
57 virtual void didCommitLoadForMainFrame() { } | 57 virtual void didCommitLoadForMainFrame() { } |
58 virtual void flushPendingFrontendMessages() { } | |
59 | 58 |
60 String name() { return m_name; } | 59 String name() { return m_name; } |
61 void appended(InstrumentingAgents*, InspectorState*); | 60 void appended(InstrumentingAgents*, InspectorState*); |
62 | 61 |
63 protected: | 62 protected: |
64 InstrumentingAgents* m_instrumentingAgents; | 63 InstrumentingAgents* m_instrumentingAgents; |
65 InspectorState* m_state; | 64 InspectorState* m_state; |
66 | 65 |
67 private: | 66 private: |
68 String m_name; | 67 String m_name; |
69 }; | 68 }; |
70 | 69 |
71 class InspectorAgentRegistry { | 70 class InspectorAgentRegistry { |
72 public: | 71 public: |
73 InspectorAgentRegistry(InstrumentingAgents*, InspectorCompositeState*); | 72 InspectorAgentRegistry(InstrumentingAgents*, InspectorCompositeState*); |
74 void append(PassOwnPtr<InspectorAgent>); | 73 void append(PassOwnPtr<InspectorAgent>); |
75 | 74 |
76 void setFrontend(InspectorFrontend*); | 75 void setFrontend(InspectorFrontend*); |
77 void clearFrontend(); | 76 void clearFrontend(); |
78 void restore(); | 77 void restore(); |
79 void registerInDispatcher(InspectorBackendDispatcher*); | 78 void registerInDispatcher(InspectorBackendDispatcher*); |
80 void discardAgents(); | 79 void discardAgents(); |
81 void flushPendingFrontendMessages(); | |
82 | 80 |
83 private: | 81 private: |
84 InstrumentingAgents* m_instrumentingAgents; | 82 InstrumentingAgents* m_instrumentingAgents; |
85 InspectorCompositeState* m_inspectorState; | 83 InspectorCompositeState* m_inspectorState; |
86 Vector<OwnPtr<InspectorAgent> > m_agents; | 84 Vector<OwnPtr<InspectorAgent> > m_agents; |
87 }; | 85 }; |
88 | 86 |
89 template<typename T> | 87 template<typename T> |
90 class InspectorBaseAgent : public InspectorAgent { | 88 class InspectorBaseAgent : public InspectorAgent { |
91 public: | 89 public: |
92 virtual ~InspectorBaseAgent() { } | 90 virtual ~InspectorBaseAgent() { } |
93 | 91 |
94 virtual void registerInDispatcher(InspectorBackendDispatcher* dispatcher) OV
ERRIDE FINAL | 92 virtual void registerInDispatcher(InspectorBackendDispatcher* dispatcher) OV
ERRIDE FINAL |
95 { | 93 { |
96 dispatcher->registerAgent(static_cast<T*>(this)); | 94 dispatcher->registerAgent(static_cast<T*>(this)); |
97 } | 95 } |
98 | 96 |
99 protected: | 97 protected: |
100 InspectorBaseAgent(const String& name) : InspectorAgent(name) | 98 InspectorBaseAgent(const String& name) : InspectorAgent(name) |
101 { | 99 { |
102 } | 100 } |
103 }; | 101 }; |
104 | 102 |
105 } // namespace WebCore | 103 } // namespace WebCore |
106 | 104 |
107 #endif // !defined(InspectorBaseAgent_h) | 105 #endif // !defined(InspectorBaseAgent_h) |
OLD | NEW |