diff options
Diffstat (limited to 'Source/WebCore/inspector/InspectorController.cpp')
-rw-r--r-- | Source/WebCore/inspector/InspectorController.cpp | 417 |
1 files changed, 209 insertions, 208 deletions
diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp index 197eff2a5..2d05e5182 100644 --- a/Source/WebCore/inspector/InspectorController.cpp +++ b/Source/WebCore/inspector/InspectorController.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2014, 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -31,36 +32,29 @@ #include "config.h" #include "InspectorController.h" -#if ENABLE(INSPECTOR) - #include "CommandLineAPIHost.h" +#include "CommonVM.h" #include "DOMWrapperWorld.h" #include "GraphicsContext.h" -#include "IdentifiersFactory.h" #include "InspectorApplicationCacheAgent.h" #include "InspectorCSSAgent.h" -#include "InspectorCanvasAgent.h" #include "InspectorClient.h" #include "InspectorDOMAgent.h" #include "InspectorDOMDebuggerAgent.h" #include "InspectorDOMStorageAgent.h" #include "InspectorDatabaseAgent.h" #include "InspectorFrontendClient.h" -#include "InspectorHeapProfilerAgent.h" #include "InspectorIndexedDBAgent.h" -#include "InspectorInputAgent.h" #include "InspectorInstrumentation.h" #include "InspectorLayerTreeAgent.h" #include "InspectorMemoryAgent.h" -#include "InspectorOverlay.h" +#include "InspectorNetworkAgent.h" #include "InspectorPageAgent.h" -#include "InspectorProfilerAgent.h" -#include "InspectorResourceAgent.h" +#include "InspectorReplayAgent.h" #include "InspectorTimelineAgent.h" -#include "InspectorWebBackendDispatchers.h" -#include "InspectorWebFrontendDispatchers.h" #include "InspectorWorkerAgent.h" #include "InstrumentingAgents.h" +#include "JSDOMBindingSecurity.h" #include "JSDOMWindow.h" #include "JSDOMWindowCustom.h" #include "JSMainThreadExecState.h" @@ -68,13 +62,25 @@ #include "Page.h" #include "PageConsoleAgent.h" #include "PageDebuggerAgent.h" -#include "PageInjectedScriptHost.h" -#include "PageInjectedScriptManager.h" +#include "PageHeapAgent.h" #include "PageRuntimeAgent.h" +#include "PageScriptDebugServer.h" #include "Settings.h" +#include "WebInjectedScriptHost.h" +#include "WebInjectedScriptManager.h" +#include <inspector/IdentifiersFactory.h> #include <inspector/InspectorBackendDispatcher.h> +#include <inspector/InspectorBackendDispatchers.h> +#include <inspector/InspectorFrontendDispatchers.h> +#include <inspector/InspectorFrontendRouter.h> #include <inspector/agents/InspectorAgent.h> +#include <inspector/agents/InspectorScriptProfilerAgent.h> #include <runtime/JSLock.h> +#include <wtf/Stopwatch.h> + +#if ENABLE(REMOTE_INSPECTOR) +#include "PageDebuggable.h" +#endif using namespace JSC; using namespace Inspector; @@ -83,91 +89,99 @@ namespace WebCore { InspectorController::InspectorController(Page& page, InspectorClient* inspectorClient) : m_instrumentingAgents(InstrumentingAgents::create(*this)) - , m_injectedScriptManager(std::make_unique<PageInjectedScriptManager>(*this, PageInjectedScriptHost::create())) + , m_injectedScriptManager(std::make_unique<WebInjectedScriptManager>(*this, WebInjectedScriptHost::create())) + , m_frontendRouter(FrontendRouter::create()) + , m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef())) , m_overlay(std::make_unique<InspectorOverlay>(page, inspectorClient)) - , m_inspectorFrontendChannel(nullptr) + , m_executionStopwatch(Stopwatch::create()) + , m_scriptDebugServer(page) , m_page(page) , m_inspectorClient(inspectorClient) - , m_isUnderTest(false) -#if ENABLE(REMOTE_INSPECTOR) - , m_hasRemoteFrontend(false) -#endif { ASSERT_ARG(inspectorClient, inspectorClient); - auto inspectorAgentPtr = std::make_unique<InspectorAgent>(); + AgentContext baseContext = { + *this, + *m_injectedScriptManager, + m_frontendRouter.get(), + m_backendDispatcher.get() + }; + + WebAgentContext webContext = { + baseContext, + m_instrumentingAgents.get() + }; + + PageAgentContext pageContext = { + webContext, + m_page + }; + + auto inspectorAgentPtr = std::make_unique<InspectorAgent>(pageContext); m_inspectorAgent = inspectorAgentPtr.get(); m_instrumentingAgents->setInspectorAgent(m_inspectorAgent); - m_agents.append(std::move(inspectorAgentPtr)); + m_agents.append(WTFMove(inspectorAgentPtr)); - auto pageAgentPtr = std::make_unique<InspectorPageAgent>(m_instrumentingAgents.get(), &page, inspectorClient, m_overlay.get()); + auto pageAgentPtr = std::make_unique<InspectorPageAgent>(pageContext, inspectorClient, m_overlay.get()); InspectorPageAgent* pageAgent = pageAgentPtr.get(); m_pageAgent = pageAgentPtr.get(); - m_agents.append(std::move(pageAgentPtr)); + m_agents.append(WTFMove(pageAgentPtr)); - auto runtimeAgentPtr = std::make_unique<PageRuntimeAgent>(m_injectedScriptManager.get(), &page, pageAgent); + auto runtimeAgentPtr = std::make_unique<PageRuntimeAgent>(pageContext, pageAgent); PageRuntimeAgent* runtimeAgent = runtimeAgentPtr.get(); m_instrumentingAgents->setPageRuntimeAgent(runtimeAgent); - m_agents.append(std::move(runtimeAgentPtr)); + m_agents.append(WTFMove(runtimeAgentPtr)); - auto domAgentPtr = std::make_unique<InspectorDOMAgent>(m_instrumentingAgents.get(), pageAgent, m_injectedScriptManager.get(), m_overlay.get()); + auto domAgentPtr = std::make_unique<InspectorDOMAgent>(pageContext, pageAgent, m_overlay.get()); m_domAgent = domAgentPtr.get(); - m_agents.append(std::move(domAgentPtr)); + m_agents.append(WTFMove(domAgentPtr)); - m_agents.append(std::make_unique<InspectorCSSAgent>(m_instrumentingAgents.get(), m_domAgent)); + m_agents.append(std::make_unique<InspectorCSSAgent>(pageContext, m_domAgent)); -#if ENABLE(SQL_DATABASE) - auto databaseAgentPtr = std::make_unique<InspectorDatabaseAgent>(m_instrumentingAgents.get()); + auto databaseAgentPtr = std::make_unique<InspectorDatabaseAgent>(pageContext); InspectorDatabaseAgent* databaseAgent = databaseAgentPtr.get(); - m_agents.append(std::move(databaseAgentPtr)); -#endif + m_agents.append(WTFMove(databaseAgentPtr)); + + m_agents.append(std::make_unique<InspectorNetworkAgent>(pageContext, pageAgent)); #if ENABLE(INDEXED_DATABASE) - m_agents.append(std::make_unique<InspectorIndexedDBAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get(), pageAgent)); + m_agents.append(std::make_unique<InspectorIndexedDBAgent>(pageContext, pageAgent)); #endif - auto domStorageAgentPtr = std::make_unique<InspectorDOMStorageAgent>(m_instrumentingAgents.get(), m_pageAgent); - InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get(); - m_agents.append(std::move(domStorageAgentPtr)); - - auto memoryAgentPtr = std::make_unique<InspectorMemoryAgent>(m_instrumentingAgents.get()); - m_memoryAgent = memoryAgentPtr.get(); - m_agents.append(std::move(memoryAgentPtr)); - - m_agents.append(std::make_unique<InspectorTimelineAgent>(m_instrumentingAgents.get(), pageAgent, m_memoryAgent, InspectorTimelineAgent::PageInspector, inspectorClient)); - m_agents.append(std::make_unique<InspectorApplicationCacheAgent>(m_instrumentingAgents.get(), pageAgent)); - - auto resourceAgentPtr = std::make_unique<InspectorResourceAgent>(m_instrumentingAgents.get(), pageAgent, inspectorClient); - m_resourceAgent = resourceAgentPtr.get(); - m_agents.append(std::move(resourceAgentPtr)); - - auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get(), m_domAgent); - InspectorConsoleAgent* consoleAgent = consoleAgentPtr.get(); - m_agents.append(std::move(consoleAgentPtr)); +#if ENABLE(RESOURCE_USAGE) + m_agents.append(std::make_unique<InspectorMemoryAgent>(pageContext)); +#endif - auto debuggerAgentPtr = std::make_unique<PageDebuggerAgent>(m_injectedScriptManager.get(), m_instrumentingAgents.get(), pageAgent, m_overlay.get()); - m_debuggerAgent = debuggerAgentPtr.get(); - m_agents.append(std::move(debuggerAgentPtr)); +#if ENABLE(WEB_REPLAY) + m_agents.append(std::make_unique<InspectorReplayAgent>(pageContext)); +#endif - auto domDebuggerAgentPtr = std::make_unique<InspectorDOMDebuggerAgent>(m_instrumentingAgents.get(), m_domAgent, m_debuggerAgent); - m_domDebuggerAgent = domDebuggerAgentPtr.get(); - m_agents.append(std::move(domDebuggerAgentPtr)); + auto domStorageAgentPtr = std::make_unique<InspectorDOMStorageAgent>(pageContext, m_pageAgent); + InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get(); + m_agents.append(WTFMove(domStorageAgentPtr)); - auto profilerAgentPtr = InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent, &page, m_injectedScriptManager.get()); - m_profilerAgent = profilerAgentPtr.get(); - m_agents.append(std::move(profilerAgentPtr)); + auto heapAgentPtr = std::make_unique<PageHeapAgent>(pageContext); + InspectorHeapAgent* heapAgent = heapAgentPtr.get(); + m_agents.append(WTFMove(heapAgentPtr)); - m_agents.append(std::make_unique<InspectorHeapProfilerAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get())); + auto scriptProfilerAgentPtr = std::make_unique<InspectorScriptProfilerAgent>(pageContext); + InspectorScriptProfilerAgent* scriptProfilerAgent = scriptProfilerAgentPtr.get(); + m_agents.append(WTFMove(scriptProfilerAgentPtr)); - m_agents.append(std::make_unique<InspectorWorkerAgent>(m_instrumentingAgents.get())); + auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(pageContext, heapAgent, m_domAgent); + WebConsoleAgent* consoleAgent = consoleAgentPtr.get(); + m_instrumentingAgents->setWebConsoleAgent(consoleAgentPtr.get()); + m_agents.append(WTFMove(consoleAgentPtr)); - m_agents.append(std::make_unique<InspectorCanvasAgent>(m_instrumentingAgents.get(), pageAgent, m_injectedScriptManager.get())); + auto debuggerAgentPtr = std::make_unique<PageDebuggerAgent>(pageContext, pageAgent, m_overlay.get()); + PageDebuggerAgent* debuggerAgent = debuggerAgentPtr.get(); + m_agents.append(WTFMove(debuggerAgentPtr)); - m_agents.append(std::make_unique<InspectorInputAgent>(m_instrumentingAgents.get(), &page)); - -#if USE(ACCELERATED_COMPOSITING) - m_agents.append(std::make_unique<InspectorLayerTreeAgent>(m_instrumentingAgents.get())); -#endif + m_agents.append(std::make_unique<InspectorTimelineAgent>(pageContext, scriptProfilerAgent, heapAgent, pageAgent)); + m_agents.append(std::make_unique<InspectorDOMDebuggerAgent>(pageContext, m_domAgent, debuggerAgent)); + m_agents.append(std::make_unique<InspectorApplicationCacheAgent>(pageContext, pageAgent)); + m_agents.append(std::make_unique<InspectorLayerTreeAgent>(pageContext)); + m_agents.append(std::make_unique<InspectorWorkerAgent>(pageContext)); ASSERT(m_injectedScriptManager->commandLineAPIHost()); if (CommandLineAPIHost* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost()) { @@ -175,137 +189,157 @@ InspectorController::InspectorController(Page& page, InspectorClient* inspectorC , consoleAgent , m_domAgent , domStorageAgent -#if ENABLE(SQL_DATABASE) , databaseAgent -#endif ); } - - runtimeAgent->setScriptDebugServer(&m_debuggerAgent->scriptDebugServer()); } InspectorController::~InspectorController() { m_instrumentingAgents->reset(); - m_agents.discardAgents(); ASSERT(!m_inspectorClient); } void InspectorController::inspectedPageDestroyed() { - disconnectFrontend(InspectorDisconnectReason::InspectedTargetDestroyed); m_injectedScriptManager->disconnect(); - m_inspectorClient->inspectorDestroyed(); + + // Clean up resources and disconnect local and remote frontends. + disconnectAllFrontends(); + + // Disconnect the client. + m_inspectorClient->inspectedPageDestroyed(); m_inspectorClient = nullptr; + + m_agents.discardValues(); } -void InspectorController::setInspectorFrontendClient(std::unique_ptr<InspectorFrontendClient> inspectorFrontendClient) +void InspectorController::setInspectorFrontendClient(InspectorFrontendClient* inspectorFrontendClient) { - m_inspectorFrontendClient = std::move(inspectorFrontendClient); + m_inspectorFrontendClient = inspectorFrontendClient; } bool InspectorController::hasLocalFrontend() const { -#if ENABLE(REMOTE_INSPECTOR) - return hasFrontend() && !m_hasRemoteFrontend; -#else - return hasFrontend(); -#endif + return m_frontendRouter->hasLocalFrontend(); } bool InspectorController::hasRemoteFrontend() const { -#if ENABLE(REMOTE_INSPECTOR) - return m_hasRemoteFrontend; -#else - return false; -#endif + return m_frontendRouter->hasRemoteFrontend(); } -bool InspectorController::hasInspectorFrontendClient() const +unsigned InspectorController::inspectionLevel() const { - return m_inspectorFrontendClient.get(); + return m_inspectorFrontendClient ? m_inspectorFrontendClient->inspectionLevel() : 0; } -void InspectorController::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld& world) +void InspectorController::didClearWindowObjectInWorld(Frame& frame, DOMWrapperWorld& world) { if (&world != &mainThreadNormalWorld()) return; - if (frame->isMainFrame()) + if (frame.isMainFrame()) m_injectedScriptManager->discardInjectedScripts(); // If the page is supposed to serve as InspectorFrontend notify inspector frontend // client that it's cleared so that the client can expose inspector bindings. - if (m_inspectorFrontendClient && frame->isMainFrame()) + if (m_inspectorFrontendClient && frame.isMainFrame()) m_inspectorFrontendClient->windowObjectCleared(); } -void InspectorController::connectFrontend(InspectorFrontendChannel* frontendChannel) +void InspectorController::connectFrontend(Inspector::FrontendChannel* frontendChannel, bool isAutomaticInspection) { - ASSERT(frontendChannel); + ASSERT_ARG(frontendChannel, frontendChannel); ASSERT(m_inspectorClient); - ASSERT(!m_inspectorFrontendChannel); - ASSERT(!m_inspectorBackendDispatcher); - m_inspectorFrontendChannel = frontendChannel; - m_inspectorBackendDispatcher = InspectorBackendDispatcher::create(frontendChannel); + bool connectedFirstFrontend = !m_frontendRouter->hasFrontends(); + m_isAutomaticInspection = isAutomaticInspection; - m_agents.didCreateFrontendAndBackend(frontendChannel, m_inspectorBackendDispatcher.get()); + m_frontendRouter->connectFrontend(frontendChannel); - InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.get()); InspectorInstrumentation::frontendCreated(); + if (connectedFirstFrontend) { + InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.get()); + m_agents.didCreateFrontendAndBackend(&m_frontendRouter.get(), &m_backendDispatcher.get()); + } + #if ENABLE(REMOTE_INSPECTOR) - if (!m_hasRemoteFrontend) + if (!m_frontendRouter->hasRemoteFrontend()) m_page.remoteInspectorInformationDidChange(); #endif } -void InspectorController::disconnectFrontend(InspectorDisconnectReason reason) +void InspectorController::disconnectFrontend(FrontendChannel* frontendChannel) { - if (!m_inspectorFrontendChannel) - return; + m_frontendRouter->disconnectFrontend(frontendChannel); + m_isAutomaticInspection = false; - m_agents.willDestroyFrontendAndBackend(reason); + InspectorInstrumentation::frontendDeleted(); - m_inspectorBackendDispatcher->clearFrontend(); - m_inspectorBackendDispatcher.clear(); - m_inspectorFrontendChannel = nullptr; + bool disconnectedLastFrontend = !m_frontendRouter->hasFrontends(); + if (disconnectedLastFrontend) { + // Notify agents first. + m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectorDestroyed); - // relese overlay page resources - m_overlay->freePage(); - InspectorInstrumentation::frontendDeleted(); - InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get()); + // Destroy the inspector overlay's page. + m_overlay->freePage(); + + // Unplug all instrumentations since they aren't needed now. + InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get()); + } #if ENABLE(REMOTE_INSPECTOR) - if (!m_hasRemoteFrontend) + if (!m_frontendRouter->hasFrontends()) m_page.remoteInspectorInformationDidChange(); #endif } -void InspectorController::show() +void InspectorController::disconnectAllFrontends() { - ASSERT(!hasRemoteFrontend()); + // If the local frontend page was destroyed, close the window. + if (m_inspectorFrontendClient) + m_inspectorFrontendClient->closeWindow(); - if (!enabled()) + // The frontend should call setInspectorFrontendClient(nullptr) under closeWindow(). + ASSERT(!m_inspectorFrontendClient); + + if (!m_frontendRouter->hasFrontends()) return; - if (m_inspectorFrontendChannel) - m_inspectorClient->bringFrontendToFront(); - else { - InspectorFrontendChannel* frontendChannel = m_inspectorClient->openInspectorFrontend(this); - if (frontendChannel) - connectFrontend(frontendChannel); - } + for (unsigned i = 0; i < m_frontendRouter->frontendCount(); ++i) + InspectorInstrumentation::frontendDeleted(); + + // Unplug all instrumentations to prevent further agent callbacks. + InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get()); + + // Notify agents first, since they may need to use InspectorClient. + m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectedTargetDestroyed); + + // Destroy the inspector overlay's page. + m_overlay->freePage(); + + // Disconnect any remaining remote frontends. + m_frontendRouter->disconnectAllFrontends(); + m_isAutomaticInspection = false; + +#if ENABLE(REMOTE_INSPECTOR) + m_page.remoteInspectorInformationDidChange(); +#endif } -void InspectorController::close() +void InspectorController::show() { - if (!m_inspectorFrontendChannel) + ASSERT(!m_frontendRouter->hasRemoteFrontend()); + + if (!enabled()) return; - disconnectFrontend(InspectorDisconnectReason::InspectorDestroyed); - m_inspectorClient->closeInspectorFrontend(); + + if (m_frontendRouter->hasLocalFrontend()) + m_inspectorClient->bringFrontendToFront(); + else if (Inspector::FrontendChannel* frontendChannel = m_inspectorClient->openLocalFrontend(this)) + connectFrontend(frontendChannel); } void InspectorController::setProcessId(long processId) @@ -313,15 +347,20 @@ void InspectorController::setProcessId(long processId) IdentifiersFactory::setProcessId(processId); } -bool InspectorController::isUnderTest() +void InspectorController::setIsUnderTest(bool value) { - return m_isUnderTest; + if (value == m_isUnderTest) + return; + + m_isUnderTest = value; + + // <rdar://problem/26768628> Try to catch suspicious scenarios where we may have a dangling frontend while running tests. + RELEASE_ASSERT(!m_isUnderTest || !m_frontendRouter->hasFrontends()); } -void InspectorController::evaluateForTestInFrontend(long callId, const String& script) +void InspectorController::evaluateForTestInFrontend(const String& script) { - m_isUnderTest = true; - m_inspectorAgent->evaluateForTestInFrontend(callId, script); + m_inspectorAgent->evaluateForTestInFrontend(script); } void InspectorController::drawHighlight(GraphicsContext& context) const @@ -329,14 +368,14 @@ void InspectorController::drawHighlight(GraphicsContext& context) const m_overlay->paint(context); } -void InspectorController::getHighlight(Highlight* highlight) const +void InspectorController::getHighlight(Highlight& highlight, InspectorOverlay::CoordinateSystem coordinateSystem) const { - m_overlay->getHighlight(highlight); + m_overlay->getHighlight(highlight, coordinateSystem); } -PassRefPtr<InspectorObject> InspectorController::buildObjectForHighlightedNode() const +Ref<Inspector::Protocol::Array<Inspector::Protocol::OverlayTypes::NodeHighlightData>> InspectorController::buildObjectForHighlightedNodes() const { - return m_overlay->buildObjectForHighlightedNode(); + return m_overlay->buildObjectForHighlightedNodes(); } void InspectorController::inspect(Node* node) @@ -362,14 +401,13 @@ Page& InspectorController::inspectedPage() const void InspectorController::dispatchMessageFromFrontend(const String& message) { - if (m_inspectorBackendDispatcher) - m_inspectorBackendDispatcher->dispatch(message); + m_backendDispatcher->dispatch(message); } void InspectorController::hideHighlight() { - ErrorString error; - m_domAgent->hideHighlight(&error); + ErrorString unused; + m_domAgent->hideHighlight(unused); } Node* InspectorController::highlightedNode() const @@ -379,64 +417,14 @@ Node* InspectorController::highlightedNode() const void InspectorController::setIndicating(bool indicating) { - // FIXME: For non-iOS clients, we should have InspectorOverlay do something here. +#if !PLATFORM(IOS) + m_overlay->setIndicating(indicating); +#else if (indicating) - m_inspectorClient->indicate(); - else - m_inspectorClient->hideIndication(); -} - -bool InspectorController::profilerEnabled() const -{ - return m_profilerAgent->enabled(); -} - -void InspectorController::setProfilerEnabled(bool enable) -{ - ErrorString error; - if (enable) - m_profilerAgent->enable(&error); + m_inspectorClient->showInspectorIndication(); else - m_profilerAgent->disable(&error); -} - -void InspectorController::resume() -{ - if (m_debuggerAgent) { - ErrorString error; - m_debuggerAgent->resume(&error); - } -} - -void InspectorController::setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize) -{ - m_resourceAgent->setResourcesDataSizeLimitsFromInternals(maximumResourcesContentSize, maximumSingleResourceContentSize); -} - -void InspectorController::didBeginFrame() -{ - if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent()) - timelineAgent->didBeginFrame(); - if (InspectorCanvasAgent* canvasAgent = m_instrumentingAgents->inspectorCanvasAgent()) - canvasAgent->didBeginFrame(); -} - -void InspectorController::didCancelFrame() -{ - if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent()) - timelineAgent->didCancelFrame(); -} - -void InspectorController::willComposite() -{ - if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent()) - timelineAgent->willComposite(); -} - -void InspectorController::didComposite() -{ - if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent()) - timelineAgent->didComposite(); + m_inspectorClient->hideInspectorIndication(); +#endif } bool InspectorController::developerExtrasEnabled() const @@ -447,11 +435,12 @@ bool InspectorController::developerExtrasEnabled() const bool InspectorController::canAccessInspectedScriptState(JSC::ExecState* scriptState) const { JSLockHolder lock(scriptState); - JSDOMWindow* inspectedWindow = toJSDOMWindow(scriptState->lexicalGlobalObject()); + + JSDOMWindow* inspectedWindow = toJSDOMWindow(scriptState->vm(), scriptState->lexicalGlobalObject()); if (!inspectedWindow) return false; - return BindingSecurity::shouldAllowAccessToDOMWindow(scriptState, inspectedWindow->impl(), DoNotReportSecurityError); + return BindingSecurity::shouldAllowAccessToDOMWindow(scriptState, inspectedWindow->wrapped(), DoNotReportSecurityError); } InspectorFunctionCallHandler InspectorController::functionCallHandler() const @@ -464,20 +453,32 @@ InspectorEvaluateHandler InspectorController::evaluateHandler() const return WebCore::evaluateHandlerFromAnyThread; } -void InspectorController::willCallInjectedScriptFunction(JSC::ExecState* scriptState, const String& scriptName, int scriptLine) +void InspectorController::frontendInitialized() { - ScriptExecutionContext* scriptExecutionContext = scriptExecutionContextFromExecState(scriptState); - InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFunction(scriptExecutionContext, scriptName, scriptLine); - m_injectedScriptInstrumentationCookies.append(cookie); +#if ENABLE(REMOTE_INSPECTOR) + if (m_isAutomaticInspection) + m_page.inspectorDebuggable().unpauseForInitializedInspector(); +#endif } -void InspectorController::didCallInjectedScriptFunction() +Ref<Stopwatch> InspectorController::executionStopwatch() { - ASSERT(!m_injectedScriptInstrumentationCookies.isEmpty()); - InspectorInstrumentationCookie cookie = m_injectedScriptInstrumentationCookies.takeLast(); - InspectorInstrumentation::didCallFunction(cookie); + return m_executionStopwatch.copyRef(); } -} // namespace WebCore +PageScriptDebugServer& InspectorController::scriptDebugServer() +{ + return m_scriptDebugServer; +} -#endif // ENABLE(INSPECTOR) +JSC::VM& InspectorController::vm() +{ + return commonVM(); +} + +void InspectorController::didComposite(Frame& frame) +{ + InspectorInstrumentation::didComposite(frame); +} + +} // namespace WebCore |