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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/inspector/InspectorBaseAgent.h" | 32 #include "core/inspector/InspectorBaseAgent.h" |
33 | 33 |
34 #include "core/dom/WebCoreMemoryInstrumentation.h" | 34 #include "core/dom/WebCoreMemoryInstrumentation.h" |
35 #include "core/inspector/InspectorState.h" | 35 #include "core/inspector/InspectorState.h" |
36 #include "wtf/MemoryInstrumentationVector.h" | 36 #include "wtf/MemoryInstrumentationVector.h" |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 InspectorBaseAgentInterface::InspectorBaseAgentInterface(const String& name, Ins
trumentingAgents* instrumentingAgents, InspectorCompositeState* inspectorState) | 40 InspectorBaseAgent::InspectorBaseAgent(InstrumentingAgents* instrumentingAgents,
InspectorState* state) |
41 : m_instrumentingAgents(instrumentingAgents) | 41 : m_instrumentingAgents(instrumentingAgents) |
42 , m_state(inspectorState->createAgentState(name)) | 42 , m_state(state) |
43 , m_name(name) | |
44 { | 43 { |
45 } | 44 } |
46 | 45 |
47 InspectorBaseAgentInterface::~InspectorBaseAgentInterface() | 46 InspectorBaseAgent::~InspectorBaseAgent() |
48 { | 47 { |
49 } | 48 } |
50 | 49 |
51 void InspectorBaseAgentInterface::reportMemoryUsage(MemoryObjectInfo* memoryObje
ctInfo) const | 50 void InspectorBaseAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) c
onst |
52 { | 51 { |
53 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector); | 52 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector); |
54 info.addMember(m_name, "name"); | |
55 info.addWeakPointer(m_instrumentingAgents); | 53 info.addWeakPointer(m_instrumentingAgents); |
56 info.addWeakPointer(m_state); | 54 info.addWeakPointer(m_state); |
57 } | 55 } |
58 | 56 |
59 void InspectorAgentRegistry::append(PassOwnPtr<InspectorBaseAgentInterface> agen
t) | 57 InspectorBaseFactoryInterface::InspectorBaseFactoryInterface(const String& name,
InstrumentingAgents* instrumentingAgents, InspectorCompositeState* compositeSta
te) |
| 58 : m_instrumentingAgents(instrumentingAgents) |
| 59 , m_state(compositeState->createAgentState(name)) |
| 60 , m_frontend(0) |
60 { | 61 { |
61 m_agents.append(agent); | |
62 } | 62 } |
63 | 63 |
64 void InspectorAgentRegistry::setFrontend(InspectorFrontend* frontend) | 64 InspectorBaseFactoryInterface::~InspectorBaseFactoryInterface() |
65 { | 65 { |
66 for (size_t i = 0; i < m_agents.size(); i++) | |
67 m_agents[i]->setFrontend(frontend); | |
68 } | 66 } |
69 | 67 |
70 void InspectorAgentRegistry::clearFrontend() | 68 void InspectorBaseFactoryInterface::setAgent(PassRefPtr<InspectorBaseAgent> agen
t) |
71 { | 69 { |
72 for (size_t i = 0; i < m_agents.size(); i++) | 70 ASSERT(!m_agent); |
73 m_agents[i]->clearFrontend(); | 71 ASSERT(!m_frontend); |
| 72 m_agent = agent; |
74 } | 73 } |
75 | 74 |
76 void InspectorAgentRegistry::restore() | 75 void InspectorBaseFactoryInterface::setFrontend(InspectorFrontend* frontend) |
77 { | 76 { |
78 for (size_t i = 0; i < m_agents.size(); i++) | 77 m_frontend = frontend; |
79 m_agents[i]->restore(); | 78 m_agent->setFrontend(m_frontend); |
80 } | 79 } |
81 | 80 |
82 void InspectorAgentRegistry::registerInDispatcher(InspectorBackendDispatcher* di
spatcher) | 81 void InspectorBaseFactoryInterface::clearFrontend() |
83 { | 82 { |
84 for (size_t i = 0; i < m_agents.size(); i++) | 83 m_agent->clearFrontend(); |
85 m_agents[i]->registerInDispatcher(dispatcher); | 84 m_frontend = 0; |
86 } | 85 } |
87 | 86 |
88 void InspectorAgentRegistry::discardAgents() | 87 void InspectorBaseFactoryInterface::restore() |
89 { | 88 { |
90 for (size_t i = 0; i < m_agents.size(); i++) | 89 m_agent->restore(); |
91 m_agents[i]->discardAgent(); | |
92 } | 90 } |
93 | 91 |
94 void InspectorAgentRegistry::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf
o) const | 92 void InspectorBaseFactoryInterface::discardDependencies() |
| 93 { |
| 94 m_agent->discardAgent(); |
| 95 } |
| 96 |
| 97 void InspectorBaseFactoryInterface::reportMemoryUsage(MemoryObjectInfo* memoryOb
jectInfo) const |
95 { | 98 { |
96 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector); | 99 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector); |
97 info.addMember(&m_agents, "agents"); | 100 info.addMember(m_agent.get(), "agent"); |
| 101 } |
| 102 |
| 103 |
| 104 void InspectorFactoryRegistry::append(PassOwnPtr<InspectorBaseFactoryInterface>
agent) |
| 105 { |
| 106 m_controllers.append(agent); |
| 107 } |
| 108 |
| 109 void InspectorFactoryRegistry::setFrontend(InspectorFrontend* frontend) |
| 110 { |
| 111 for (size_t i = 0; i < m_controllers.size(); i++) |
| 112 m_controllers[i]->setFrontend(frontend); |
| 113 } |
| 114 |
| 115 void InspectorFactoryRegistry::clearFrontend() |
| 116 { |
| 117 for (size_t i = 0; i < m_controllers.size(); i++) |
| 118 m_controllers[i]->clearFrontend(); |
| 119 } |
| 120 |
| 121 void InspectorFactoryRegistry::restore() |
| 122 { |
| 123 for (size_t i = 0; i < m_controllers.size(); i++) |
| 124 m_controllers[i]->restore(); |
| 125 } |
| 126 |
| 127 void InspectorFactoryRegistry::registerInDispatcher(InspectorBackendDispatcher*
dispatcher) |
| 128 { |
| 129 for (size_t i = 0; i < m_controllers.size(); i++) |
| 130 m_controllers[i]->registerInDispatcher(dispatcher); |
| 131 } |
| 132 |
| 133 void InspectorFactoryRegistry::discardDependencies() |
| 134 { |
| 135 for (size_t i = 0; i < m_controllers.size(); i++) |
| 136 m_controllers[i]->discardDependencies(); |
| 137 } |
| 138 |
| 139 void InspectorFactoryRegistry::reportMemoryUsage(MemoryObjectInfo* memoryObjectI
nfo) const |
| 140 { |
| 141 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector); |
| 142 info.addMember(&m_controllers, "agent_controllers"); |
98 } | 143 } |
99 | 144 |
100 } // namespace WebCore | 145 } // namespace WebCore |
101 | 146 |
OLD | NEW |