| 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 16 matching lines...) Expand all Loading... |
| 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" | |
| 38 #include "core/inspector/AsyncCallTracker.h" | 37 #include "core/inspector/AsyncCallTracker.h" |
| 39 #include "core/inspector/IdentifiersFactory.h" | 38 #include "core/inspector/IdentifiersFactory.h" |
| 40 #include "core/inspector/InjectedScriptHost.h" | 39 #include "core/inspector/InjectedScriptHost.h" |
| 41 #include "core/inspector/InjectedScriptManager.h" | 40 #include "core/inspector/InjectedScriptManager.h" |
| 42 #include "core/inspector/InspectorAnimationAgent.h" | 41 #include "core/inspector/InspectorAnimationAgent.h" |
| 43 #include "core/inspector/InspectorApplicationCacheAgent.h" | 42 #include "core/inspector/InspectorApplicationCacheAgent.h" |
| 44 #include "core/inspector/InspectorCSSAgent.h" | 43 #include "core/inspector/InspectorCSSAgent.h" |
| 45 #include "core/inspector/InspectorCanvasAgent.h" | 44 #include "core/inspector/InspectorCanvasAgent.h" |
| 46 #include "core/inspector/InspectorClient.h" | 45 #include "core/inspector/InspectorClient.h" |
| 47 #include "core/inspector/InspectorDOMAgent.h" | 46 #include "core/inspector/InspectorDOMAgent.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 77 InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
lient) | 76 InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
lient) |
| 78 : m_instrumentingAgents(InstrumentingAgents::create()) | 77 : m_instrumentingAgents(InstrumentingAgents::create()) |
| 79 , m_injectedScriptManager(InjectedScriptManager::createForPage()) | 78 , m_injectedScriptManager(InjectedScriptManager::createForPage()) |
| 80 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(inspectorClient))) | 79 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(inspectorClient))) |
| 81 , m_overlay(InspectorOverlay::create(page, inspectorClient)) | 80 , m_overlay(InspectorOverlay::create(page, inspectorClient)) |
| 82 , m_cssAgent(nullptr) | 81 , m_cssAgent(nullptr) |
| 83 , m_resourceAgent(nullptr) | 82 , m_resourceAgent(nullptr) |
| 84 , m_layerTreeAgent(nullptr) | 83 , m_layerTreeAgent(nullptr) |
| 85 , m_animationAgent(nullptr) | 84 , m_animationAgent(nullptr) |
| 86 , m_inspectorFrontendClient(nullptr) | 85 , 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(this, injectedScriptManager)
); | 95 m_agents.append(InspectorInspectorAgent::create(m_page, injectedScriptManage
r)); |
| 96 | 96 |
| 97 OwnPtrWillBeRawPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::crea
te(page, injectedScriptManager, inspectorClient, overlay)); | 97 OwnPtrWillBeRawPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::crea
te(m_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_pageAgent)); | 105 OwnPtrWillBeRawPtr<InspectorLayerTreeAgent> layerTreeAgentPtr(InspectorLayer
TreeAgent::create(m_page)); |
| 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_pageAgent)); | 116 m_agents.append(PageRuntimeAgent::create(injectedScriptManager, inspectorCli
ent, pageScriptDebugServer, m_page, m_pageAgent)); |
| 117 | 117 |
| 118 OwnPtrWillBeRawPtr<PageConsoleAgent> pageConsoleAgentPtr = PageConsoleAgent:
:create(injectedScriptManager, m_domAgent, m_pageAgent); | 118 OwnPtrWillBeRawPtr<PageConsoleAgent> pageConsoleAgentPtr = PageConsoleAgent:
:create(injectedScriptManager, m_domAgent, m_page); |
| 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(), m_pageAgent); | 121 OwnPtrWillBeRawPtr<InspectorTracingAgent> tracingAgentPtr = InspectorTracing
Agent::create(inspectorClient, workerAgentPtr.get(), page); |
| 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 Loading... |
| 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); |
| 152 visitor->trace(m_agents); | 153 visitor->trace(m_agents); |
| 153 } | 154 } |
| 154 | 155 |
| 155 PassOwnPtrWillBeRawPtr<InspectorController> InspectorController::create(Page* pa
ge, InspectorClient* client) | 156 PassOwnPtrWillBeRawPtr<InspectorController> InspectorController::create(Page* pa
ge, InspectorClient* client) |
| 156 { | 157 { |
| 157 return adoptPtrWillBeNoop(new InspectorController(page, client)); | 158 return adoptPtrWillBeNoop(new InspectorController(page, client)); |
| 158 } | 159 } |
| 159 | 160 |
| 160 void InspectorController::setTextAutosizingEnabled(bool enabled) | 161 void InspectorController::setTextAutosizingEnabled(bool enabled) |
| 161 { | 162 { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(debuggerAgent,
m_instrumentingAgents.get())); | 208 m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(debuggerAgent,
m_instrumentingAgents.get())); |
| 208 | 209 |
| 209 m_agents.append(InspectorDOMDebuggerAgent::create(m_domAgent, debuggerAgent)
); | 210 m_agents.append(InspectorDOMDebuggerAgent::create(m_domAgent, debuggerAgent)
); |
| 210 | 211 |
| 211 m_agents.append(InspectorProfilerAgent::create(injectedScriptManager, overla
y)); | 212 m_agents.append(InspectorProfilerAgent::create(injectedScriptManager, overla
y)); |
| 212 | 213 |
| 213 m_agents.append(InspectorHeapProfilerAgent::create(injectedScriptManager)); | 214 m_agents.append(InspectorHeapProfilerAgent::create(injectedScriptManager)); |
| 214 | 215 |
| 215 m_agents.append(InspectorCanvasAgent::create(m_pageAgent, injectedScriptMana
ger)); | 216 m_agents.append(InspectorCanvasAgent::create(m_pageAgent, injectedScriptMana
ger)); |
| 216 | 217 |
| 217 m_agents.append(InspectorInputAgent::create(m_pageAgent, m_inspectorClient))
; | 218 m_agents.append(InspectorInputAgent::create(m_page, m_inspectorClient)); |
| 218 } | 219 } |
| 219 | 220 |
| 220 void InspectorController::willBeDestroyed() | 221 void InspectorController::willBeDestroyed() |
| 221 { | 222 { |
| 222 #if ENABLE(ASSERT) | 223 #if ENABLE(ASSERT) |
| 223 Frame* frame = m_pageAgent->frameHost()->page().mainFrame(); | 224 ASSERT(m_page->mainFrame()); |
| 224 ASSERT(frame); | 225 if (m_page->mainFrame()->isLocalFrame()) |
| 225 if (frame->isLocalFrame()) | 226 ASSERT(m_page->deprecatedLocalMainFrame()->view()); |
| 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; |
| 232 m_instrumentingAgents->reset(); | 233 m_instrumentingAgents->reset(); |
| 233 m_agents.discardAgents(); | 234 m_agents.discardAgents(); |
| 234 if (m_inspectorFrontendClient) | 235 if (m_inspectorFrontendClient) |
| 235 m_inspectorFrontendClient->dispose(); | 236 m_inspectorFrontendClient->dispose(); |
| 236 } | 237 } |
| 237 | 238 |
| 238 void InspectorController::registerModuleAgent(PassOwnPtrWillBeRawPtr<InspectorAg
ent> agent) | 239 void InspectorController::registerModuleAgent(PassOwnPtrWillBeRawPtr<InspectorAg
ent> agent) |
| 239 { | 240 { |
| 240 m_agents.append(agent); | 241 m_agents.append(agent); |
| 241 } | 242 } |
| 242 | 243 |
| 243 void InspectorController::setInspectorFrontendClient(InspectorFrontendClient* in
spectorFrontendClient) | 244 void InspectorController::setInspectorFrontendClient(InspectorFrontendClient* in
spectorFrontendClient) |
| 244 { | 245 { |
| 245 m_inspectorFrontendClient = inspectorFrontendClient; | 246 m_inspectorFrontendClient = inspectorFrontendClient; |
| 246 } | 247 } |
| 247 | 248 |
| 248 void InspectorController::didClearDocumentOfWindowObject(LocalFrame* frame) | 249 void InspectorController::didClearDocumentOfWindowObject(LocalFrame* frame) |
| 249 { | 250 { |
| 250 // If the page is supposed to serve as InspectorFrontend notify inspector fr
ontend | 251 // If the page is supposed to serve as InspectorFrontend notify inspector fr
ontend |
| 251 // client that it's cleared so that the client can expose inspector bindings
. | 252 // client that it's cleared so that the client can expose inspector bindings
. |
| 252 if (m_inspectorFrontendClient && frame == m_pageAgent->inspectedFrame()) | 253 if (m_inspectorFrontendClient && frame == m_page->mainFrame()) |
| 253 m_inspectorFrontendClient->windowObjectCleared(); | 254 m_inspectorFrontendClient->windowObjectCleared(); |
| 254 } | 255 } |
| 255 | 256 |
| 256 void InspectorController::connectFrontend(const String& hostId, InspectorFronten
dChannel* frontendChannel) | 257 void InspectorController::connectFrontend(const String& hostId, InspectorFronten
dChannel* frontendChannel) |
| 257 { | 258 { |
| 258 ASSERT(frontendChannel); | 259 ASSERT(frontendChannel); |
| 259 m_hostId = hostId; | 260 m_hostId = hostId; |
| 260 | 261 |
| 261 initializeDeferredAgents(); | 262 initializeDeferredAgents(); |
| 262 m_resourceAgent->setHostId(hostId); | 263 m_resourceAgent->setHostId(hostId); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 m_layerTreeAgent->willAddPageOverlay(layer); | 530 m_layerTreeAgent->willAddPageOverlay(layer); |
| 530 } | 531 } |
| 531 | 532 |
| 532 void InspectorController::didRemovePageOverlay(const GraphicsLayer* layer) | 533 void InspectorController::didRemovePageOverlay(const GraphicsLayer* layer) |
| 533 { | 534 { |
| 534 if (m_layerTreeAgent) | 535 if (m_layerTreeAgent) |
| 535 m_layerTreeAgent->didRemovePageOverlay(layer); | 536 m_layerTreeAgent->didRemovePageOverlay(layer); |
| 536 } | 537 } |
| 537 | 538 |
| 538 } // namespace blink | 539 } // namespace blink |
| OLD | NEW |