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

Side by Side Diff: Source/core/inspector/InspectorController.cpp

Issue 898593002: DevTools: use per-LocalFrame instrumenting agents instead of per-Page ones. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed assertion Created 5 years, 10 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
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 16 matching lines...) Expand all
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 #include "config.h" 31 #include "config.h"
32 #include "core/inspector/InspectorController.h" 32 #include "core/inspector/InspectorController.h"
33 33
34 #include "bindings/core/v8/DOMWrapperWorld.h" 34 #include "bindings/core/v8/DOMWrapperWorld.h"
35 #include "core/InspectorBackendDispatcher.h" 35 #include "core/InspectorBackendDispatcher.h"
36 #include "core/InspectorFrontend.h" 36 #include "core/InspectorFrontend.h"
37 #include "core/frame/FrameHost.h"
37 #include "core/inspector/AsyncCallTracker.h" 38 #include "core/inspector/AsyncCallTracker.h"
38 #include "core/inspector/IdentifiersFactory.h" 39 #include "core/inspector/IdentifiersFactory.h"
39 #include "core/inspector/InjectedScriptHost.h" 40 #include "core/inspector/InjectedScriptHost.h"
40 #include "core/inspector/InjectedScriptManager.h" 41 #include "core/inspector/InjectedScriptManager.h"
41 #include "core/inspector/InspectorAnimationAgent.h" 42 #include "core/inspector/InspectorAnimationAgent.h"
42 #include "core/inspector/InspectorApplicationCacheAgent.h" 43 #include "core/inspector/InspectorApplicationCacheAgent.h"
43 #include "core/inspector/InspectorCSSAgent.h" 44 #include "core/inspector/InspectorCSSAgent.h"
44 #include "core/inspector/InspectorCanvasAgent.h" 45 #include "core/inspector/InspectorCanvasAgent.h"
45 #include "core/inspector/InspectorClient.h" 46 #include "core/inspector/InspectorClient.h"
46 #include "core/inspector/InspectorDOMAgent.h" 47 #include "core/inspector/InspectorDOMAgent.h"
(...skipping 29 matching lines...) Expand all
76 InspectorController::InspectorController(Page* page, InspectorClient* inspectorC lient) 77 InspectorController::InspectorController(Page* page, InspectorClient* inspectorC lient)
77 : m_instrumentingAgents(InstrumentingAgents::create()) 78 : m_instrumentingAgents(InstrumentingAgents::create())
78 , m_injectedScriptManager(InjectedScriptManager::createForPage()) 79 , m_injectedScriptManager(InjectedScriptManager::createForPage())
79 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(inspectorClient))) 80 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(inspectorClient)))
80 , m_overlay(InspectorOverlay::create(page, inspectorClient)) 81 , m_overlay(InspectorOverlay::create(page, inspectorClient))
81 , m_cssAgent(nullptr) 82 , m_cssAgent(nullptr)
82 , m_resourceAgent(nullptr) 83 , m_resourceAgent(nullptr)
83 , m_layerTreeAgent(nullptr) 84 , m_layerTreeAgent(nullptr)
84 , m_animationAgent(nullptr) 85 , m_animationAgent(nullptr)
85 , m_inspectorFrontendClient(nullptr) 86 , m_inspectorFrontendClient(nullptr)
86 , m_page(page)
87 , m_inspectorClient(inspectorClient) 87 , m_inspectorClient(inspectorClient)
88 , m_agents(m_instrumentingAgents.get(), m_state.get()) 88 , m_agents(m_instrumentingAgents.get(), m_state.get())
89 , m_isUnderTest(false) 89 , m_isUnderTest(false)
90 , m_deferredAgentsInitialized(false) 90 , m_deferredAgentsInitialized(false)
91 { 91 {
92 InjectedScriptManager* injectedScriptManager = m_injectedScriptManager.get() ; 92 InjectedScriptManager* injectedScriptManager = m_injectedScriptManager.get() ;
93 InspectorOverlay* overlay = m_overlay.get(); 93 InspectorOverlay* overlay = m_overlay.get();
94 94
95 m_agents.append(InspectorInspectorAgent::create(m_page, injectedScriptManage r)); 95 m_agents.append(InspectorInspectorAgent::create(this, injectedScriptManager) );
96 96
97 OwnPtrWillBeRawPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::crea te(m_page, injectedScriptManager, inspectorClient, overlay)); 97 OwnPtrWillBeRawPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::crea te(page, injectedScriptManager, inspectorClient, overlay));
98 m_pageAgent = pageAgentPtr.get(); 98 m_pageAgent = pageAgentPtr.get();
99 m_agents.append(pageAgentPtr.release()); 99 m_agents.append(pageAgentPtr.release());
100 100
101 OwnPtrWillBeRawPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create( m_pageAgent, injectedScriptManager, overlay)); 101 OwnPtrWillBeRawPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create( m_pageAgent, injectedScriptManager, overlay));
102 m_domAgent = domAgentPtr.get(); 102 m_domAgent = domAgentPtr.get();
103 m_agents.append(domAgentPtr.release()); 103 m_agents.append(domAgentPtr.release());
104 104
105 OwnPtrWillBeRawPtr<InspectorLayerTreeAgent> layerTreeAgentPtr(InspectorLayer TreeAgent::create(m_page)); 105 OwnPtrWillBeRawPtr<InspectorLayerTreeAgent> layerTreeAgentPtr(InspectorLayer TreeAgent::create(m_pageAgent));
106 m_layerTreeAgent = layerTreeAgentPtr.get(); 106 m_layerTreeAgent = layerTreeAgentPtr.get();
107 m_agents.append(layerTreeAgentPtr.release()); 107 m_agents.append(layerTreeAgentPtr.release());
108 108
109 OwnPtrWillBeRawPtr<InspectorTimelineAgent> timelineAgentPtr(InspectorTimelin eAgent::create(m_pageAgent, m_layerTreeAgent, 109 OwnPtrWillBeRawPtr<InspectorTimelineAgent> timelineAgentPtr(InspectorTimelin eAgent::create(m_pageAgent, m_layerTreeAgent,
110 overlay, InspectorTimelineAgent::PageInspector, inspectorClient)); 110 overlay, InspectorTimelineAgent::PageInspector, inspectorClient));
111 m_timelineAgent = timelineAgentPtr.get(); 111 m_timelineAgent = timelineAgentPtr.get();
112 m_agents.append(timelineAgentPtr.release()); 112 m_agents.append(timelineAgentPtr.release());
113 113
114 PageScriptDebugServer* pageScriptDebugServer = &PageScriptDebugServer::share d(); 114 PageScriptDebugServer* pageScriptDebugServer = &PageScriptDebugServer::share d();
115 115
116 m_agents.append(PageRuntimeAgent::create(injectedScriptManager, inspectorCli ent, pageScriptDebugServer, m_page, m_pageAgent)); 116 m_agents.append(PageRuntimeAgent::create(injectedScriptManager, inspectorCli ent, pageScriptDebugServer, m_pageAgent));
117 117
118 OwnPtrWillBeRawPtr<PageConsoleAgent> pageConsoleAgentPtr = PageConsoleAgent: :create(injectedScriptManager, m_domAgent, m_page); 118 OwnPtrWillBeRawPtr<PageConsoleAgent> pageConsoleAgentPtr = PageConsoleAgent: :create(injectedScriptManager, m_domAgent, m_pageAgent);
119 OwnPtrWillBeRawPtr<InspectorWorkerAgent> workerAgentPtr = InspectorWorkerAge nt::create(pageConsoleAgentPtr.get()); 119 OwnPtrWillBeRawPtr<InspectorWorkerAgent> workerAgentPtr = InspectorWorkerAge nt::create(pageConsoleAgentPtr.get());
120 120
121 OwnPtrWillBeRawPtr<InspectorTracingAgent> tracingAgentPtr = InspectorTracing Agent::create(inspectorClient, workerAgentPtr.get(), page); 121 OwnPtrWillBeRawPtr<InspectorTracingAgent> tracingAgentPtr = InspectorTracing Agent::create(inspectorClient, workerAgentPtr.get(), m_pageAgent);
122 m_tracingAgent = tracingAgentPtr.get(); 122 m_tracingAgent = tracingAgentPtr.get();
123 m_agents.append(tracingAgentPtr.release()); 123 m_agents.append(tracingAgentPtr.release());
124 124
125 m_agents.append(workerAgentPtr.release()); 125 m_agents.append(workerAgentPtr.release());
126 m_agents.append(pageConsoleAgentPtr.release()); 126 m_agents.append(pageConsoleAgentPtr.release());
127 127
128 ASSERT_ARG(inspectorClient, inspectorClient); 128 ASSERT_ARG(inspectorClient, inspectorClient);
129 m_injectedScriptManager->injectedScriptHost()->init(m_instrumentingAgents.ge t(), pageScriptDebugServer); 129 m_injectedScriptManager->injectedScriptHost()->init(m_instrumentingAgents.ge t(), pageScriptDebugServer);
130 } 130 }
131 131
(...skipping 10 matching lines...) Expand all
142 visitor->trace(m_asyncCallTracker); 142 visitor->trace(m_asyncCallTracker);
143 visitor->trace(m_domAgent); 143 visitor->trace(m_domAgent);
144 visitor->trace(m_animationAgent); 144 visitor->trace(m_animationAgent);
145 visitor->trace(m_pageAgent); 145 visitor->trace(m_pageAgent);
146 visitor->trace(m_timelineAgent); 146 visitor->trace(m_timelineAgent);
147 visitor->trace(m_cssAgent); 147 visitor->trace(m_cssAgent);
148 visitor->trace(m_resourceAgent); 148 visitor->trace(m_resourceAgent);
149 visitor->trace(m_layerTreeAgent); 149 visitor->trace(m_layerTreeAgent);
150 visitor->trace(m_tracingAgent); 150 visitor->trace(m_tracingAgent);
151 visitor->trace(m_inspectorBackendDispatcher); 151 visitor->trace(m_inspectorBackendDispatcher);
152 visitor->trace(m_page);
153 visitor->trace(m_agents); 152 visitor->trace(m_agents);
154 } 153 }
155 154
156 PassOwnPtrWillBeRawPtr<InspectorController> InspectorController::create(Page* pa ge, InspectorClient* client) 155 PassOwnPtrWillBeRawPtr<InspectorController> InspectorController::create(Page* pa ge, InspectorClient* client)
157 { 156 {
158 return adoptPtrWillBeNoop(new InspectorController(page, client)); 157 return adoptPtrWillBeNoop(new InspectorController(page, client));
159 } 158 }
160 159
161 void InspectorController::setTextAutosizingEnabled(bool enabled) 160 void InspectorController::setTextAutosizingEnabled(bool enabled)
162 { 161 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(debuggerAgent, m_instrumentingAgents.get())); 207 m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(debuggerAgent, m_instrumentingAgents.get()));
209 208
210 m_agents.append(InspectorDOMDebuggerAgent::create(m_domAgent, debuggerAgent) ); 209 m_agents.append(InspectorDOMDebuggerAgent::create(m_domAgent, debuggerAgent) );
211 210
212 m_agents.append(InspectorProfilerAgent::create(injectedScriptManager, overla y)); 211 m_agents.append(InspectorProfilerAgent::create(injectedScriptManager, overla y));
213 212
214 m_agents.append(InspectorHeapProfilerAgent::create(injectedScriptManager)); 213 m_agents.append(InspectorHeapProfilerAgent::create(injectedScriptManager));
215 214
216 m_agents.append(InspectorCanvasAgent::create(m_pageAgent, injectedScriptMana ger)); 215 m_agents.append(InspectorCanvasAgent::create(m_pageAgent, injectedScriptMana ger));
217 216
218 m_agents.append(InspectorInputAgent::create(m_page, m_inspectorClient)); 217 m_agents.append(InspectorInputAgent::create(m_pageAgent, m_inspectorClient)) ;
219 } 218 }
220 219
221 void InspectorController::willBeDestroyed() 220 void InspectorController::willBeDestroyed()
222 { 221 {
223 #if ENABLE(ASSERT) 222 #if ENABLE(ASSERT)
224 ASSERT(m_page->mainFrame()); 223 Frame* frame = m_pageAgent->frameHost()->page().mainFrame();
225 if (m_page->mainFrame()->isLocalFrame()) 224 ASSERT(frame);
226 ASSERT(m_page->deprecatedLocalMainFrame()->view()); 225 if (frame->isLocalFrame())
226 ASSERT(m_pageAgent->inspectedFrame()->view());
227 #endif 227 #endif
228 228
229 disconnectFrontend(); 229 disconnectFrontend();
230 m_injectedScriptManager->disconnect(); 230 m_injectedScriptManager->disconnect();
231 m_inspectorClient = 0; 231 m_inspectorClient = 0;
232 m_page = nullptr;
233 m_instrumentingAgents->reset(); 232 m_instrumentingAgents->reset();
234 m_agents.discardAgents(); 233 m_agents.discardAgents();
235 if (m_inspectorFrontendClient) 234 if (m_inspectorFrontendClient)
236 m_inspectorFrontendClient->dispose(); 235 m_inspectorFrontendClient->dispose();
237 } 236 }
238 237
239 void InspectorController::registerModuleAgent(PassOwnPtrWillBeRawPtr<InspectorAg ent> agent) 238 void InspectorController::registerModuleAgent(PassOwnPtrWillBeRawPtr<InspectorAg ent> agent)
240 { 239 {
241 m_agents.append(agent); 240 m_agents.append(agent);
242 } 241 }
243 242
244 void InspectorController::setInspectorFrontendClient(InspectorFrontendClient* in spectorFrontendClient) 243 void InspectorController::setInspectorFrontendClient(InspectorFrontendClient* in spectorFrontendClient)
245 { 244 {
246 m_inspectorFrontendClient = inspectorFrontendClient; 245 m_inspectorFrontendClient = inspectorFrontendClient;
247 } 246 }
248 247
249 void InspectorController::didClearDocumentOfWindowObject(LocalFrame* frame) 248 void InspectorController::didClearDocumentOfWindowObject(LocalFrame* frame)
250 { 249 {
251 // If the page is supposed to serve as InspectorFrontend notify inspector fr ontend 250 // If the page is supposed to serve as InspectorFrontend notify inspector fr ontend
252 // client that it's cleared so that the client can expose inspector bindings . 251 // client that it's cleared so that the client can expose inspector bindings .
253 if (m_inspectorFrontendClient && frame == m_page->mainFrame()) 252 if (m_inspectorFrontendClient && frame == m_pageAgent->inspectedFrame())
254 m_inspectorFrontendClient->windowObjectCleared(); 253 m_inspectorFrontendClient->windowObjectCleared();
255 } 254 }
256 255
257 void InspectorController::connectFrontend(const String& hostId, InspectorFronten dChannel* frontendChannel) 256 void InspectorController::connectFrontend(const String& hostId, InspectorFronten dChannel* frontendChannel)
258 { 257 {
259 ASSERT(frontendChannel); 258 ASSERT(frontendChannel);
260 m_hostId = hostId; 259 m_hostId = hostId;
261 260
262 initializeDeferredAgents(); 261 initializeDeferredAgents();
263 m_resourceAgent->setHostId(hostId); 262 m_resourceAgent->setHostId(hostId);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 m_layerTreeAgent->willAddPageOverlay(layer); 529 m_layerTreeAgent->willAddPageOverlay(layer);
531 } 530 }
532 531
533 void InspectorController::didRemovePageOverlay(const GraphicsLayer* layer) 532 void InspectorController::didRemovePageOverlay(const GraphicsLayer* layer)
534 { 533 {
535 if (m_layerTreeAgent) 534 if (m_layerTreeAgent)
536 m_layerTreeAgent->didRemovePageOverlay(layer); 535 m_layerTreeAgent->didRemovePageOverlay(layer);
537 } 536 }
538 537
539 } // namespace blink 538 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorController.h ('k') | Source/core/inspector/InspectorDOMAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698