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

Unified Diff: Source/core/inspector/InspectorBaseAgent.cpp

Issue 17030009: Inspector: wrapped inspector agent instances into factory-like wrappers (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorBaseAgent.h ('k') | Source/core/inspector/InspectorCSSAgent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorBaseAgent.cpp
diff --git a/Source/core/inspector/InspectorBaseAgent.cpp b/Source/core/inspector/InspectorBaseAgent.cpp
index c999790116ce5a8f59da9ebe2bc73b98565cf090..6d54218239fc9ee65e499a3152a8d2e28a08f466 100644
--- a/Source/core/inspector/InspectorBaseAgent.cpp
+++ b/Source/core/inspector/InspectorBaseAgent.cpp
@@ -37,64 +37,109 @@
namespace WebCore {
-InspectorBaseAgentInterface::InspectorBaseAgentInterface(const String& name, InstrumentingAgents* instrumentingAgents, InspectorCompositeState* inspectorState)
+InspectorBaseAgent::InspectorBaseAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state)
: m_instrumentingAgents(instrumentingAgents)
- , m_state(inspectorState->createAgentState(name))
- , m_name(name)
+ , m_state(state)
{
}
-InspectorBaseAgentInterface::~InspectorBaseAgentInterface()
+InspectorBaseAgent::~InspectorBaseAgent()
{
}
-void InspectorBaseAgentInterface::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+void InspectorBaseAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector);
- info.addMember(m_name, "name");
info.addWeakPointer(m_instrumentingAgents);
info.addWeakPointer(m_state);
}
-void InspectorAgentRegistry::append(PassOwnPtr<InspectorBaseAgentInterface> agent)
+InspectorBaseFactoryInterface::InspectorBaseFactoryInterface(const String& name, InstrumentingAgents* instrumentingAgents, InspectorCompositeState* compositeState)
+ : m_instrumentingAgents(instrumentingAgents)
+ , m_state(compositeState->createAgentState(name))
+ , m_frontend(0)
+{
+}
+
+InspectorBaseFactoryInterface::~InspectorBaseFactoryInterface()
+{
+}
+
+void InspectorBaseFactoryInterface::setAgent(PassRefPtr<InspectorBaseAgent> agent)
+{
+ ASSERT(!m_agent);
+ ASSERT(!m_frontend);
+ m_agent = agent;
+}
+
+void InspectorBaseFactoryInterface::setFrontend(InspectorFrontend* frontend)
+{
+ m_frontend = frontend;
+ m_agent->setFrontend(m_frontend);
+}
+
+void InspectorBaseFactoryInterface::clearFrontend()
+{
+ m_agent->clearFrontend();
+ m_frontend = 0;
+}
+
+void InspectorBaseFactoryInterface::restore()
+{
+ m_agent->restore();
+}
+
+void InspectorBaseFactoryInterface::discardDependencies()
+{
+ m_agent->discardAgent();
+}
+
+void InspectorBaseFactoryInterface::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector);
+ info.addMember(m_agent.get(), "agent");
+}
+
+
+void InspectorFactoryRegistry::append(PassOwnPtr<InspectorBaseFactoryInterface> agent)
{
- m_agents.append(agent);
+ m_controllers.append(agent);
}
-void InspectorAgentRegistry::setFrontend(InspectorFrontend* frontend)
+void InspectorFactoryRegistry::setFrontend(InspectorFrontend* frontend)
{
- for (size_t i = 0; i < m_agents.size(); i++)
- m_agents[i]->setFrontend(frontend);
+ for (size_t i = 0; i < m_controllers.size(); i++)
+ m_controllers[i]->setFrontend(frontend);
}
-void InspectorAgentRegistry::clearFrontend()
+void InspectorFactoryRegistry::clearFrontend()
{
- for (size_t i = 0; i < m_agents.size(); i++)
- m_agents[i]->clearFrontend();
+ for (size_t i = 0; i < m_controllers.size(); i++)
+ m_controllers[i]->clearFrontend();
}
-void InspectorAgentRegistry::restore()
+void InspectorFactoryRegistry::restore()
{
- for (size_t i = 0; i < m_agents.size(); i++)
- m_agents[i]->restore();
+ for (size_t i = 0; i < m_controllers.size(); i++)
+ m_controllers[i]->restore();
}
-void InspectorAgentRegistry::registerInDispatcher(InspectorBackendDispatcher* dispatcher)
+void InspectorFactoryRegistry::registerInDispatcher(InspectorBackendDispatcher* dispatcher)
{
- for (size_t i = 0; i < m_agents.size(); i++)
- m_agents[i]->registerInDispatcher(dispatcher);
+ for (size_t i = 0; i < m_controllers.size(); i++)
+ m_controllers[i]->registerInDispatcher(dispatcher);
}
-void InspectorAgentRegistry::discardAgents()
+void InspectorFactoryRegistry::discardDependencies()
{
- for (size_t i = 0; i < m_agents.size(); i++)
- m_agents[i]->discardAgent();
+ for (size_t i = 0; i < m_controllers.size(); i++)
+ m_controllers[i]->discardDependencies();
}
-void InspectorAgentRegistry::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+void InspectorFactoryRegistry::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector);
- info.addMember(&m_agents, "agents");
+ info.addMember(&m_controllers, "agent_controllers");
}
} // namespace WebCore
« no previous file with comments | « Source/core/inspector/InspectorBaseAgent.h ('k') | Source/core/inspector/InspectorCSSAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698