Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: Source/core/inspector/InspectorBaseAgent.h

Issue 16934003: Inspector: replace generic discardAgents logic with explicit call to discard a listener. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/inspector/InspectorBaseAgent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 class InspectorBaseAgentInterface { 46 class InspectorBaseAgentInterface {
47 public: 47 public:
48 InspectorBaseAgentInterface(const String&, InstrumentingAgents*, InspectorCo mpositeState*); 48 InspectorBaseAgentInterface(const String&, InstrumentingAgents*, InspectorCo mpositeState*);
49 virtual ~InspectorBaseAgentInterface(); 49 virtual ~InspectorBaseAgentInterface();
50 50
51 virtual void setFrontend(InspectorFrontend*) { } 51 virtual void setFrontend(InspectorFrontend*) { }
52 virtual void clearFrontend() { } 52 virtual void clearFrontend() { }
53 virtual void restore() { } 53 virtual void restore() { }
54 virtual void registerInDispatcher(InspectorBackendDispatcher*) = 0; 54 virtual void registerInDispatcher(InspectorBackendDispatcher*) = 0;
55 virtual void discardAgent() { }
56 55
57 String name() { return m_name; } 56 String name() { return m_name; }
58 57
59 virtual void reportMemoryUsage(MemoryObjectInfo*) const; 58 virtual void reportMemoryUsage(MemoryObjectInfo*) const;
60 59
61 protected: 60 protected:
62 InstrumentingAgents* m_instrumentingAgents; 61 InstrumentingAgents* m_instrumentingAgents;
63 InspectorState* m_state; 62 InspectorState* m_state;
64 63
65 private: 64 private:
66 String m_name; 65 String m_name;
67 }; 66 };
68 67
69 class InspectorAgentRegistry { 68 class InspectorAgentRegistry {
70 public: 69 public:
71 void append(PassOwnPtr<InspectorBaseAgentInterface>); 70 void append(PassOwnPtr<InspectorBaseAgentInterface>);
72 71
73 void setFrontend(InspectorFrontend*); 72 void setFrontend(InspectorFrontend*);
74 void clearFrontend(); 73 void clearFrontend();
75 void restore(); 74 void restore();
76 void registerInDispatcher(InspectorBackendDispatcher*); 75 void registerInDispatcher(InspectorBackendDispatcher*);
77 void discardAgents();
78 76
79 private: 77 private:
80 Vector<OwnPtr<InspectorBaseAgentInterface> > m_agents; 78 Vector<OwnPtr<InspectorBaseAgentInterface> > m_agents;
81 }; 79 };
82 80
83 template<typename T> 81 template<typename T>
84 class InspectorBaseAgent : public InspectorBaseAgentInterface { 82 class InspectorBaseAgent : public InspectorBaseAgentInterface {
85 public: 83 public:
86 virtual ~InspectorBaseAgent() { } 84 virtual ~InspectorBaseAgent() { }
87 85
88 virtual void registerInDispatcher(InspectorBackendDispatcher* dispatcher) 86 virtual void registerInDispatcher(InspectorBackendDispatcher* dispatcher)
89 { 87 {
90 dispatcher->registerAgent(static_cast<T*>(this)); 88 dispatcher->registerAgent(static_cast<T*>(this));
91 } 89 }
92 90
93 protected: 91 protected:
94 InspectorBaseAgent(const String& name, InstrumentingAgents* instrumentingAge nts, InspectorCompositeState* inspectorState) 92 InspectorBaseAgent(const String& name, InstrumentingAgents* instrumentingAge nts, InspectorCompositeState* inspectorState)
95 : InspectorBaseAgentInterface(name, instrumentingAgents, inspectorState) 93 : InspectorBaseAgentInterface(name, instrumentingAgents, inspectorState)
96 { 94 {
97 } 95 }
98 }; 96 };
99 97
100 } // namespace WebCore 98 } // namespace WebCore
101 99
102 #endif // !defined(InspectorBaseAgent_h) 100 #endif // !defined(InspectorBaseAgent_h)
OLDNEW
« no previous file with comments | « no previous file | Source/core/inspector/InspectorBaseAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698