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