[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
pfeldman at chromium.org
pfeldman at chromium.org
Sun Feb 20 23:39:09 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit f73e2772b5270269ccae0c42dc675e4950a9ad86
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Jan 23 09:36:21 2011 +0000
2011-01-22 Ilya Tikhonovsky <loislo at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: next step in splitting InspectorController.
Splitting InspectorController is a bit tricky process.
As a first step I'll do the next things:
1) rename existing InspectorController to InspectorAgent;
2) s/nspectorController/nspectorAgent/g everywhere in WebCore/inspector but InspectorInstrumentation;
3) create a fake InspectorController derived from the InspectorAgent for the rest of WebCore and WebKit;
The second step is a migration of a small set of functions described in bug 52510 from InspectorAgent to InspectorController.
As far as the second step will have significant changes in the functions' implementation I'll do it as a separate patch.
https://bugs.webkit.org/show_bug.cgi?id=52955
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.exp.in:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSInjectedScriptHostCustom.cpp:
(WebCore::JSInjectedScriptHost::nodeForId):
(WebCore::JSInjectedScriptHost::selectDOMStorage):
* bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
(WebCore::V8InjectedScriptHost::nodeForIdCallback):
* inspector/CodeGeneratorInspector.pm:
* inspector/InjectedScriptHost.cpp:
(WebCore::InjectedScriptHost::InjectedScriptHost):
(WebCore::InjectedScriptHost::clearConsoleMessages):
(WebCore::InjectedScriptHost::databaseForId):
(WebCore::InjectedScriptHost::selectDatabase):
(WebCore::InjectedScriptHost::selectDOMStorage):
(WebCore::InjectedScriptHost::injectedScriptForMainFrame):
(WebCore::InjectedScriptHost::inspectorDOMAgent):
(WebCore::InjectedScriptHost::frontend):
(WebCore::InjectedScriptHost::didCreateWorker):
(WebCore::InjectedScriptHost::didDestroyWorker):
* inspector/InjectedScriptHost.h:
(WebCore::InjectedScriptHost::create):
(WebCore::InjectedScriptHost::inspectorAgent):
(WebCore::InjectedScriptHost::disconnectController):
* inspector/InspectorAgent.cpp: Copied from Source/WebCore/inspector/InspectorController.cpp.
(WebCore::InspectorAgent::InspectorAgent):
(WebCore::InspectorAgent::~InspectorAgent):
(WebCore::InspectorAgent::inspectedPageDestroyed):
(WebCore::InspectorAgent::enabled):
(WebCore::InspectorAgent::inspectorStartsAttached):
(WebCore::InspectorAgent::setInspectorStartsAttached):
(WebCore::InspectorAgent::setInspectorAttachedHeight):
(WebCore::InspectorAgent::inspectorAttachedHeight):
(WebCore::InspectorAgent::searchingForNodeInPage):
(WebCore::InspectorAgent::restoreInspectorStateFromCookie):
(WebCore::InspectorAgent::inspect):
(WebCore::InspectorAgent::focusNode):
(WebCore::InspectorAgent::highlight):
(WebCore::InspectorAgent::highlightDOMNode):
(WebCore::InspectorAgent::highlightFrame):
(WebCore::InspectorAgent::hideHighlight):
(WebCore::InspectorAgent::mouseDidMoveOverElement):
(WebCore::InspectorAgent::handleMousePress):
(WebCore::InspectorAgent::setInspectorFrontendClient):
(WebCore::InspectorAgent::didClearWindowObjectInWorld):
(WebCore::InspectorAgent::setSearchingForNode):
(WebCore::InspectorAgent::connectFrontend):
(WebCore::InspectorAgent::show):
(WebCore::InspectorAgent::showPanel):
(WebCore::InspectorAgent::close):
(WebCore::InspectorAgent::disconnectFrontend):
(WebCore::InspectorAgent::resourceAgent):
(WebCore::InspectorAgent::releaseFrontendLifetimeAgents):
(WebCore::InspectorAgent::populateScriptObjects):
(WebCore::InspectorAgent::pushDataCollectedOffline):
(WebCore::InspectorAgent::restoreDebugger):
(WebCore::InspectorAgent::restoreProfiler):
(WebCore::InspectorAgent::unbindAllResources):
(WebCore::InspectorAgent::didCommitLoad):
(WebCore::InspectorAgent::mainResourceFiredDOMContentEvent):
(WebCore::InspectorAgent::mainResourceFiredLoadEvent):
(WebCore::InspectorAgent::isMainResourceLoader):
(WebCore::InspectorAgent::willSendRequest):
(WebCore::InspectorAgent::ensureSettingsLoaded):
(WebCore::InspectorAgent::startTimelineProfiler):
(WebCore::InspectorAgent::stopTimelineProfiler):
(WebCore::PostWorkerNotificationToFrontendTask::create):
(WebCore::PostWorkerNotificationToFrontendTask::PostWorkerNotificationToFrontendTask):
(WebCore::PostWorkerNotificationToFrontendTask::performTask):
(WebCore::InspectorAgent::postWorkerNotificationToFrontend):
(WebCore::InspectorAgent::didCreateWorker):
(WebCore::InspectorAgent::didDestroyWorker):
(WebCore::InspectorAgent::didOpenDatabase):
(WebCore::InspectorAgent::getCookies):
(WebCore::InspectorAgent::buildArrayForCookies):
(WebCore::InspectorAgent::buildObjectForCookie):
(WebCore::InspectorAgent::deleteCookie):
(WebCore::InspectorAgent::didUseDOMStorage):
(WebCore::InspectorAgent::didCreateWebSocket):
(WebCore::InspectorAgent::willSendWebSocketHandshakeRequest):
(WebCore::InspectorAgent::didReceiveWebSocketHandshakeResponse):
(WebCore::InspectorAgent::didCloseWebSocket):
(WebCore::InspectorAgent::isRecordingUserInitiatedProfile):
(WebCore::InspectorAgent::startUserInitiatedProfiling):
(WebCore::InspectorAgent::stopUserInitiatedProfiling):
(WebCore::InspectorAgent::profilerEnabled):
(WebCore::InspectorAgent::enableProfiler):
(WebCore::InspectorAgent::disableProfiler):
(WebCore::InspectorAgent::showAndEnableDebugger):
(WebCore::InspectorAgent::enableDebugger):
(WebCore::InspectorAgent::disableDebugger):
(WebCore::InspectorAgent::resume):
(WebCore::InspectorAgent::setAllBrowserBreakpoints):
(WebCore::InspectorAgent::evaluateForTestInFrontend):
(WebCore::InspectorAgent::didEvaluateForTestInFrontend):
(WebCore::quadToPath):
(WebCore::drawOutlinedQuad):
(WebCore::drawOutlinedQuadWithClip):
(WebCore::drawHighlightForBox):
(WebCore::drawHighlightForLineBoxesOrSVGRenderer):
(WebCore::convertFromFrameToMainFrame):
(WebCore::frameToMainFrameOffset):
(WebCore::InspectorAgent::drawNodeHighlight):
(WebCore::InspectorAgent::drawElementTitle):
(WebCore::InspectorAgent::openInInspectedWindow):
(WebCore::InspectorAgent::addScriptToEvaluateOnLoad):
(WebCore::InspectorAgent::removeAllScriptsToEvaluateOnLoad):
(WebCore::InspectorAgent::setInspectorExtensionAPI):
(WebCore::InspectorAgent::inspectedURL):
(WebCore::InspectorAgent::reloadPage):
(WebCore::InspectorAgent::setExtraHeaders):
* inspector/InspectorAgent.h: Copied from Source/WebCore/inspector/InspectorController.h.
(WebCore::InspectorAgent::inspectorBackendDispatcher):
(WebCore::InspectorAgent::inspectorClient):
(WebCore::InspectorAgent::injectedScriptHost):
(WebCore::InspectorAgent::inspectedPage):
(WebCore::InspectorAgent::hideDOMNodeHighlight):
(WebCore::InspectorAgent::hideFrameHighlight):
(WebCore::InspectorAgent::frontend):
(WebCore::InspectorAgent::inspectorController):
(WebCore::InspectorAgent::inspectorAgent):
(WebCore::InspectorAgent::consoleAgent):
(WebCore::InspectorAgent::cssAgent):
(WebCore::InspectorAgent::domAgent):
(WebCore::InspectorAgent::injectedScriptAgent):
(WebCore::InspectorAgent::runtimeAgent):
(WebCore::InspectorAgent::timelineAgent):
(WebCore::InspectorAgent::databaseAgent):
(WebCore::InspectorAgent::domStorageAgent):
(WebCore::InspectorAgent::fileSystemAgent):
(WebCore::InspectorAgent::browserDebuggerAgent):
(WebCore::InspectorAgent::debuggerAgent):
(WebCore::InspectorAgent::profilerAgent):
(WebCore::InspectorAgent::applicationCacheAgent):
(WebCore::InspectorAgent::hasInspectorFrontendClient):
(WebCore::InspectorAgent::hasFrontend):
(WebCore::InspectorAgent::startProfiling):
(WebCore::InspectorAgent::stopProfiling):
(WebCore::InspectorAgent::debuggerEnabled):
(WebCore::InspectorAgent::state):
(WebCore::InspectorAgent::settings):
* inspector/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent):
(WebCore::InspectorApplicationCacheAgent::getApplicationCaches):
* inspector/InspectorApplicationCacheAgent.h:
* inspector/InspectorBrowserDebuggerAgent.cpp:
(WebCore::InspectorBrowserDebuggerAgent::InspectorBrowserDebuggerAgent):
(WebCore::InspectorBrowserDebuggerAgent::inspectedURLChanged):
(WebCore::InspectorBrowserDebuggerAgent::restoreStickyBreakpoint):
(WebCore::InspectorBrowserDebuggerAgent::setDOMBreakpoint):
(WebCore::InspectorBrowserDebuggerAgent::removeDOMBreakpoint):
(WebCore::InspectorBrowserDebuggerAgent::willInsertDOMNode):
(WebCore::InspectorBrowserDebuggerAgent::willRemoveDOMNode):
(WebCore::InspectorBrowserDebuggerAgent::willModifyDOMAttr):
(WebCore::InspectorBrowserDebuggerAgent::descriptionForDOMEvent):
(WebCore::InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded):
(WebCore::InspectorBrowserDebuggerAgent::willSendXMLHttpRequest):
* inspector/InspectorBrowserDebuggerAgent.h:
(WebCore::InspectorBrowserDebuggerAgent::create):
* inspector/InspectorConsoleAgent.cpp:
(WebCore::InspectorConsoleAgent::InspectorConsoleAgent):
(WebCore::InspectorConsoleAgent::~InspectorConsoleAgent):
(WebCore::InspectorConsoleAgent::clearConsoleMessages):
(WebCore::InspectorConsoleAgent::addMessageToConsole):
(WebCore::InspectorConsoleAgent::resourceRetrievedByXMLHttpRequest):
(WebCore::InspectorConsoleAgent::didReceiveResponse):
(WebCore::InspectorConsoleAgent::didFailLoading):
(WebCore::InspectorConsoleAgent::setMonitoringXHREnabled):
(WebCore::InspectorConsoleAgent::setConsoleMessagesEnabled):
(WebCore::InspectorConsoleAgent::addConsoleMessage):
* inspector/InspectorConsoleAgent.h:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
* inspector/InspectorController.h:
* inspector/InspectorDatabaseAgent.cpp:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::create):
(WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
(WebCore::InspectorDebuggerAgent::~InspectorDebuggerAgent):
(WebCore::InspectorDebuggerAgent::evaluateOnCallFrame):
(WebCore::InspectorDebuggerAgent::getCompletionsOnCallFrame):
(WebCore::InspectorDebuggerAgent::currentCallFrames):
* inspector/InspectorDebuggerAgent.h:
* inspector/InspectorFileSystemAgent.cpp:
(WebCore::InspectorFileSystemAgentCallbacks::didOpenFileSystem):
(WebCore::InspectorFileSystemAgent::InspectorFileSystemAgent):
(WebCore::InspectorFileSystemAgent::stop):
(WebCore::InspectorFileSystemAgent::getFileSystemPathAsync):
(WebCore::InspectorFileSystemAgent::didGetFileSystemPath):
(WebCore::InspectorFileSystemAgent::didGetFileSystemError):
* inspector/InspectorFileSystemAgent.h:
(WebCore::InspectorFileSystemAgent::create):
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::setExtensionAPI):
* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::create):
(WebCore::InspectorProfilerAgent::InspectorProfilerAgent):
(WebCore::InspectorProfilerAgent::addProfileFinishedMessageToConsole):
(WebCore::InspectorProfilerAgent::addStartProfilingMessageToConsole):
(WebCore::InspectorProfilerAgent::startUserInitiatedProfiling):
(WebCore::InspectorProfilerAgent::stopUserInitiatedProfiling):
* inspector/InspectorProfilerAgent.h:
2011-01-22 Ilya Tikhonovsky <loislo at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: next step in splitting InspectorController.
#include "InspectorController.h" was added.
https://bugs.webkit.org/show_bug.cgi?id=52955
* WebCoreSupport/InspectorServerQt.cpp:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76459 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index 95d8790..05da5bb 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -1153,6 +1153,7 @@ SET(WebCore_SOURCES
inspector/ConsoleMessage.cpp
inspector/InjectedScript.cpp
inspector/InjectedScriptHost.cpp
+ inspector/InspectorAgent.cpp
inspector/InspectorApplicationCacheAgent.cpp
inspector/InspectorBrowserDebuggerAgent.cpp
inspector/InspectorCSSAgent.cpp
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index bd83048..651ce72 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,229 @@
+2011-01-22 Ilya Tikhonovsky <loislo at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: next step in splitting InspectorController.
+
+ Splitting InspectorController is a bit tricky process.
+
+ As a first step I'll do the next things:
+ 1) rename existing InspectorController to InspectorAgent;
+ 2) s/nspectorController/nspectorAgent/g everywhere in WebCore/inspector but InspectorInstrumentation;
+ 3) create a fake InspectorController derived from the InspectorAgent for the rest of WebCore and WebKit;
+
+ The second step is a migration of a small set of functions described in bug 52510 from InspectorAgent to InspectorController.
+
+ As far as the second step will have significant changes in the functions' implementation I'll do it as a separate patch.
+
+ https://bugs.webkit.org/show_bug.cgi?id=52955
+
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.exp.in:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::JSInjectedScriptHost::nodeForId):
+ (WebCore::JSInjectedScriptHost::selectDOMStorage):
+ * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+ (WebCore::V8InjectedScriptHost::nodeForIdCallback):
+ * inspector/CodeGeneratorInspector.pm:
+ * inspector/InjectedScriptHost.cpp:
+ (WebCore::InjectedScriptHost::InjectedScriptHost):
+ (WebCore::InjectedScriptHost::clearConsoleMessages):
+ (WebCore::InjectedScriptHost::databaseForId):
+ (WebCore::InjectedScriptHost::selectDatabase):
+ (WebCore::InjectedScriptHost::selectDOMStorage):
+ (WebCore::InjectedScriptHost::injectedScriptForMainFrame):
+ (WebCore::InjectedScriptHost::inspectorDOMAgent):
+ (WebCore::InjectedScriptHost::frontend):
+ (WebCore::InjectedScriptHost::didCreateWorker):
+ (WebCore::InjectedScriptHost::didDestroyWorker):
+ * inspector/InjectedScriptHost.h:
+ (WebCore::InjectedScriptHost::create):
+ (WebCore::InjectedScriptHost::inspectorAgent):
+ (WebCore::InjectedScriptHost::disconnectController):
+ * inspector/InspectorAgent.cpp: Copied from Source/WebCore/inspector/InspectorController.cpp.
+ (WebCore::InspectorAgent::InspectorAgent):
+ (WebCore::InspectorAgent::~InspectorAgent):
+ (WebCore::InspectorAgent::inspectedPageDestroyed):
+ (WebCore::InspectorAgent::enabled):
+ (WebCore::InspectorAgent::inspectorStartsAttached):
+ (WebCore::InspectorAgent::setInspectorStartsAttached):
+ (WebCore::InspectorAgent::setInspectorAttachedHeight):
+ (WebCore::InspectorAgent::inspectorAttachedHeight):
+ (WebCore::InspectorAgent::searchingForNodeInPage):
+ (WebCore::InspectorAgent::restoreInspectorStateFromCookie):
+ (WebCore::InspectorAgent::inspect):
+ (WebCore::InspectorAgent::focusNode):
+ (WebCore::InspectorAgent::highlight):
+ (WebCore::InspectorAgent::highlightDOMNode):
+ (WebCore::InspectorAgent::highlightFrame):
+ (WebCore::InspectorAgent::hideHighlight):
+ (WebCore::InspectorAgent::mouseDidMoveOverElement):
+ (WebCore::InspectorAgent::handleMousePress):
+ (WebCore::InspectorAgent::setInspectorFrontendClient):
+ (WebCore::InspectorAgent::didClearWindowObjectInWorld):
+ (WebCore::InspectorAgent::setSearchingForNode):
+ (WebCore::InspectorAgent::connectFrontend):
+ (WebCore::InspectorAgent::show):
+ (WebCore::InspectorAgent::showPanel):
+ (WebCore::InspectorAgent::close):
+ (WebCore::InspectorAgent::disconnectFrontend):
+ (WebCore::InspectorAgent::resourceAgent):
+ (WebCore::InspectorAgent::releaseFrontendLifetimeAgents):
+ (WebCore::InspectorAgent::populateScriptObjects):
+ (WebCore::InspectorAgent::pushDataCollectedOffline):
+ (WebCore::InspectorAgent::restoreDebugger):
+ (WebCore::InspectorAgent::restoreProfiler):
+ (WebCore::InspectorAgent::unbindAllResources):
+ (WebCore::InspectorAgent::didCommitLoad):
+ (WebCore::InspectorAgent::mainResourceFiredDOMContentEvent):
+ (WebCore::InspectorAgent::mainResourceFiredLoadEvent):
+ (WebCore::InspectorAgent::isMainResourceLoader):
+ (WebCore::InspectorAgent::willSendRequest):
+ (WebCore::InspectorAgent::ensureSettingsLoaded):
+ (WebCore::InspectorAgent::startTimelineProfiler):
+ (WebCore::InspectorAgent::stopTimelineProfiler):
+ (WebCore::PostWorkerNotificationToFrontendTask::create):
+ (WebCore::PostWorkerNotificationToFrontendTask::PostWorkerNotificationToFrontendTask):
+ (WebCore::PostWorkerNotificationToFrontendTask::performTask):
+ (WebCore::InspectorAgent::postWorkerNotificationToFrontend):
+ (WebCore::InspectorAgent::didCreateWorker):
+ (WebCore::InspectorAgent::didDestroyWorker):
+ (WebCore::InspectorAgent::didOpenDatabase):
+ (WebCore::InspectorAgent::getCookies):
+ (WebCore::InspectorAgent::buildArrayForCookies):
+ (WebCore::InspectorAgent::buildObjectForCookie):
+ (WebCore::InspectorAgent::deleteCookie):
+ (WebCore::InspectorAgent::didUseDOMStorage):
+ (WebCore::InspectorAgent::didCreateWebSocket):
+ (WebCore::InspectorAgent::willSendWebSocketHandshakeRequest):
+ (WebCore::InspectorAgent::didReceiveWebSocketHandshakeResponse):
+ (WebCore::InspectorAgent::didCloseWebSocket):
+ (WebCore::InspectorAgent::isRecordingUserInitiatedProfile):
+ (WebCore::InspectorAgent::startUserInitiatedProfiling):
+ (WebCore::InspectorAgent::stopUserInitiatedProfiling):
+ (WebCore::InspectorAgent::profilerEnabled):
+ (WebCore::InspectorAgent::enableProfiler):
+ (WebCore::InspectorAgent::disableProfiler):
+ (WebCore::InspectorAgent::showAndEnableDebugger):
+ (WebCore::InspectorAgent::enableDebugger):
+ (WebCore::InspectorAgent::disableDebugger):
+ (WebCore::InspectorAgent::resume):
+ (WebCore::InspectorAgent::setAllBrowserBreakpoints):
+ (WebCore::InspectorAgent::evaluateForTestInFrontend):
+ (WebCore::InspectorAgent::didEvaluateForTestInFrontend):
+ (WebCore::quadToPath):
+ (WebCore::drawOutlinedQuad):
+ (WebCore::drawOutlinedQuadWithClip):
+ (WebCore::drawHighlightForBox):
+ (WebCore::drawHighlightForLineBoxesOrSVGRenderer):
+ (WebCore::convertFromFrameToMainFrame):
+ (WebCore::frameToMainFrameOffset):
+ (WebCore::InspectorAgent::drawNodeHighlight):
+ (WebCore::InspectorAgent::drawElementTitle):
+ (WebCore::InspectorAgent::openInInspectedWindow):
+ (WebCore::InspectorAgent::addScriptToEvaluateOnLoad):
+ (WebCore::InspectorAgent::removeAllScriptsToEvaluateOnLoad):
+ (WebCore::InspectorAgent::setInspectorExtensionAPI):
+ (WebCore::InspectorAgent::inspectedURL):
+ (WebCore::InspectorAgent::reloadPage):
+ (WebCore::InspectorAgent::setExtraHeaders):
+ * inspector/InspectorAgent.h: Copied from Source/WebCore/inspector/InspectorController.h.
+ (WebCore::InspectorAgent::inspectorBackendDispatcher):
+ (WebCore::InspectorAgent::inspectorClient):
+ (WebCore::InspectorAgent::injectedScriptHost):
+ (WebCore::InspectorAgent::inspectedPage):
+ (WebCore::InspectorAgent::hideDOMNodeHighlight):
+ (WebCore::InspectorAgent::hideFrameHighlight):
+ (WebCore::InspectorAgent::frontend):
+ (WebCore::InspectorAgent::inspectorController):
+ (WebCore::InspectorAgent::inspectorAgent):
+ (WebCore::InspectorAgent::consoleAgent):
+ (WebCore::InspectorAgent::cssAgent):
+ (WebCore::InspectorAgent::domAgent):
+ (WebCore::InspectorAgent::injectedScriptAgent):
+ (WebCore::InspectorAgent::runtimeAgent):
+ (WebCore::InspectorAgent::timelineAgent):
+ (WebCore::InspectorAgent::databaseAgent):
+ (WebCore::InspectorAgent::domStorageAgent):
+ (WebCore::InspectorAgent::fileSystemAgent):
+ (WebCore::InspectorAgent::browserDebuggerAgent):
+ (WebCore::InspectorAgent::debuggerAgent):
+ (WebCore::InspectorAgent::profilerAgent):
+ (WebCore::InspectorAgent::applicationCacheAgent):
+ (WebCore::InspectorAgent::hasInspectorFrontendClient):
+ (WebCore::InspectorAgent::hasFrontend):
+ (WebCore::InspectorAgent::startProfiling):
+ (WebCore::InspectorAgent::stopProfiling):
+ (WebCore::InspectorAgent::debuggerEnabled):
+ (WebCore::InspectorAgent::state):
+ (WebCore::InspectorAgent::settings):
+ * inspector/InspectorApplicationCacheAgent.cpp:
+ (WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent):
+ (WebCore::InspectorApplicationCacheAgent::getApplicationCaches):
+ * inspector/InspectorApplicationCacheAgent.h:
+ * inspector/InspectorBrowserDebuggerAgent.cpp:
+ (WebCore::InspectorBrowserDebuggerAgent::InspectorBrowserDebuggerAgent):
+ (WebCore::InspectorBrowserDebuggerAgent::inspectedURLChanged):
+ (WebCore::InspectorBrowserDebuggerAgent::restoreStickyBreakpoint):
+ (WebCore::InspectorBrowserDebuggerAgent::setDOMBreakpoint):
+ (WebCore::InspectorBrowserDebuggerAgent::removeDOMBreakpoint):
+ (WebCore::InspectorBrowserDebuggerAgent::willInsertDOMNode):
+ (WebCore::InspectorBrowserDebuggerAgent::willRemoveDOMNode):
+ (WebCore::InspectorBrowserDebuggerAgent::willModifyDOMAttr):
+ (WebCore::InspectorBrowserDebuggerAgent::descriptionForDOMEvent):
+ (WebCore::InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded):
+ (WebCore::InspectorBrowserDebuggerAgent::willSendXMLHttpRequest):
+ * inspector/InspectorBrowserDebuggerAgent.h:
+ (WebCore::InspectorBrowserDebuggerAgent::create):
+ * inspector/InspectorConsoleAgent.cpp:
+ (WebCore::InspectorConsoleAgent::InspectorConsoleAgent):
+ (WebCore::InspectorConsoleAgent::~InspectorConsoleAgent):
+ (WebCore::InspectorConsoleAgent::clearConsoleMessages):
+ (WebCore::InspectorConsoleAgent::addMessageToConsole):
+ (WebCore::InspectorConsoleAgent::resourceRetrievedByXMLHttpRequest):
+ (WebCore::InspectorConsoleAgent::didReceiveResponse):
+ (WebCore::InspectorConsoleAgent::didFailLoading):
+ (WebCore::InspectorConsoleAgent::setMonitoringXHREnabled):
+ (WebCore::InspectorConsoleAgent::setConsoleMessagesEnabled):
+ (WebCore::InspectorConsoleAgent::addConsoleMessage):
+ * inspector/InspectorConsoleAgent.h:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ * inspector/InspectorController.h:
+ * inspector/InspectorDatabaseAgent.cpp:
+ * inspector/InspectorDebuggerAgent.cpp:
+ (WebCore::InspectorDebuggerAgent::create):
+ (WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
+ (WebCore::InspectorDebuggerAgent::~InspectorDebuggerAgent):
+ (WebCore::InspectorDebuggerAgent::evaluateOnCallFrame):
+ (WebCore::InspectorDebuggerAgent::getCompletionsOnCallFrame):
+ (WebCore::InspectorDebuggerAgent::currentCallFrames):
+ * inspector/InspectorDebuggerAgent.h:
+ * inspector/InspectorFileSystemAgent.cpp:
+ (WebCore::InspectorFileSystemAgentCallbacks::didOpenFileSystem):
+ (WebCore::InspectorFileSystemAgent::InspectorFileSystemAgent):
+ (WebCore::InspectorFileSystemAgent::stop):
+ (WebCore::InspectorFileSystemAgent::getFileSystemPathAsync):
+ (WebCore::InspectorFileSystemAgent::didGetFileSystemPath):
+ (WebCore::InspectorFileSystemAgent::didGetFileSystemError):
+ * inspector/InspectorFileSystemAgent.h:
+ (WebCore::InspectorFileSystemAgent::create):
+ * inspector/InspectorFrontendHost.cpp:
+ (WebCore::InspectorFrontendHost::setExtensionAPI):
+ * inspector/InspectorProfilerAgent.cpp:
+ (WebCore::InspectorProfilerAgent::create):
+ (WebCore::InspectorProfilerAgent::InspectorProfilerAgent):
+ (WebCore::InspectorProfilerAgent::addProfileFinishedMessageToConsole):
+ (WebCore::InspectorProfilerAgent::addStartProfilingMessageToConsole):
+ (WebCore::InspectorProfilerAgent::startUserInitiatedProfiling):
+ (WebCore::InspectorProfilerAgent::stopUserInitiatedProfiling):
+ * inspector/InspectorProfilerAgent.h:
+
2011-01-22 Chris Rogers <crogers at google.com>
Rubber-stamped by Anders Carlsson.
diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am
index c312af1..7aac0c7 100644
--- a/Source/WebCore/GNUmakefile.am
+++ b/Source/WebCore/GNUmakefile.am
@@ -1951,6 +1951,8 @@ webcore_sources += \
Source/WebCore/inspector/InjectedScript.h \
Source/WebCore/inspector/InjectedScriptHost.cpp \
Source/WebCore/inspector/InjectedScriptHost.h \
+ Source/WebCore/inspector/InspectorAgent.cpp \
+ Source/WebCore/inspector/InspectorAgent.h \
Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp \
Source/WebCore/inspector/InspectorApplicationCacheAgent.h \
Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp \
diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in
index 250b629..eabcaa9 100644
--- a/Source/WebCore/WebCore.exp.in
+++ b/Source/WebCore/WebCore.exp.in
@@ -1356,29 +1356,25 @@ __ZN7WebCore22GeolocationServiceMock8setErrorEN3WTF10PassRefPtrINS_13PositionErr
#endif
#if ENABLE(INSPECTOR)
+__ZN7WebCore14InspectorAgent4showEv
+__ZN7WebCore14InspectorAgent5closeEv
+__ZN7WebCore14InspectorAgent9showPanelERKN3WTF6StringE
+__ZN7WebCore14InspectorAgent12ConsolePanelE
+__ZN7WebCore14InspectorAgent13ProfilesPanelE
+__ZN7WebCore14InspectorAgent14enableProfilerEbb
+__ZN7WebCore14InspectorAgent15disableDebuggerEb
+__ZN7WebCore14InspectorAgent15disableProfilerEb
+__ZN7WebCore14InspectorAgent18disconnectFrontendEv
+__ZN7WebCore14InspectorAgent20stopTimelineProfilerEv
+__ZN7WebCore14InspectorAgent21showAndEnableDebuggerEv
+__ZN7WebCore14InspectorAgent21startTimelineProfilerEv
+__ZN7WebCore14InspectorAgent23inspectorStartsAttachedEv
+__ZN7WebCore14InspectorAgent25evaluateForTestInFrontendElRKN3WTF6StringE
+__ZN7WebCore14InspectorAgent26setInspectorFrontendClientEN3WTF10PassOwnPtrINS_23InspectorFrontendClientEEE
+__ZN7WebCore14InspectorAgent26setInspectorStartsAttachedEb
+__ZN7WebCore14InspectorAgent26stopUserInitiatedProfilingEv
+__ZN7WebCore14InspectorAgent27startUserInitiatedProfilingEv
__ZN7WebCore15InspectorClient31doDispatchMessageOnFrontendPageEPNS_4PageERKN3WTF6StringE
-__ZN7WebCore19InspectorController12ConsolePanelE
-__ZN7WebCore19InspectorController12ScriptsPanelE
-__ZN7WebCore19InspectorController13ProfilesPanelE
-__ZN7WebCore19InspectorController21showAndEnableDebuggerEv
-__ZN7WebCore19InspectorController14enableProfilerEbb
-__ZN7WebCore19InspectorController15disableDebuggerEb
-__ZN7WebCore19InspectorController15disableProfilerEb
-__ZN7WebCore19InspectorController18disconnectFrontendEv
-__ZN7WebCore19InspectorController20stopTimelineProfilerEv
-__ZN7WebCore19InspectorController21startTimelineProfilerEv
-__ZN7WebCore19InspectorController23inspectorStartsAttachedEv
-__ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKN3WTF6StringE
-__ZN7WebCore19InspectorController26setInspectorFrontendClientEN3WTF10PassOwnPtrINS_23InspectorFrontendClientEEE
-__ZN7WebCore19InspectorController26setInspectorStartsAttachedEb
-__ZN7WebCore19InspectorController27startUserInitiatedProfilingEv
-__ZN7WebCore19InspectorController26stopUserInitiatedProfilingEv
-__ZNK7WebCore19InspectorController31isRecordingUserInitiatedProfileEv
-__ZNK7WebCore19InspectorController15profilerEnabledEv
-__ZN7WebCore19InspectorController4showEv
-__ZN7WebCore19InspectorController5closeEv
-__ZN7WebCore19InspectorController7inspectEPNS_4NodeE
-__ZN7WebCore19InspectorController9showPanelERKN3WTF6StringE
__ZN7WebCore28InspectorFrontendClientLocal12moveWindowByEff
__ZN7WebCore28InspectorFrontendClientLocal14frontendLoadedEv
__ZN7WebCore28InspectorFrontendClientLocal15canAttachWindowEv
@@ -1390,8 +1386,9 @@ __ZN7WebCore28InspectorFrontendClientLocal26changeAttachedWindowHeightEj
__ZN7WebCore28InspectorFrontendClientLocal27restoreAttachedWindowHeightEv
__ZN7WebCore28InspectorFrontendClientLocalC2EPNS_19InspectorControllerEPNS_4PageE
__ZN7WebCore28InspectorFrontendClientLocalD2Ev
-__ZNK7WebCore19InspectorController17drawNodeHighlightERNS_15GraphicsContextE
-__ZNK7WebCore19InspectorController7enabledEv
+__ZNK7WebCore14InspectorAgent15profilerEnabledEv
+__ZNK7WebCore14InspectorAgent17drawNodeHighlightERNS_15GraphicsContextE
+__ZNK7WebCore14InspectorAgent31isRecordingUserInitiatedProfileEv
#endif
#if ENABLE(JAVA_BRIDGE)
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index 0a418e6..3198bde 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -2006,6 +2006,8 @@
'inspector/InjectedScript.h',
'inspector/InjectedScriptHost.cpp',
'inspector/InjectedScriptHost.h',
+ 'inspector/InspectorAgent.cpp',
+ 'inspector/InspectorAgent.h',
'inspector/InspectorApplicationCacheAgent.cpp',
'inspector/InspectorApplicationCacheAgent.h',
'inspector/InspectorBrowserDebuggerAgent.cpp',
diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro
index de4ec77..0bdc5df 100644
--- a/Source/WebCore/WebCore.pro
+++ b/Source/WebCore/WebCore.pro
@@ -1042,6 +1042,7 @@ SOURCES += \
inspector/ConsoleMessage.cpp \
inspector/InjectedScript.cpp \
inspector/InjectedScriptHost.cpp \
+ inspector/InspectorAgent.cpp \
inspector/InspectorApplicationCacheAgent.cpp \
inspector/InspectorBrowserDebuggerAgent.cpp \
inspector/InspectorCSSAgent.cpp \
@@ -1940,6 +1941,7 @@ HEADERS += \
inspector/ConsoleMessage.h \
inspector/InjectedScript.h \
inspector/InjectedScriptHost.h \
+ inspector/InspectorAgent.h \
inspector/InspectorApplicationCacheAgent.h \
inspector/InspectorBrowserDebuggerAgent.h \
inspector/InspectorConsoleAgent.h \
diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index f3550c7..5690008 100755
--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -65074,6 +65074,14 @@
>
</File>
<File
+ RelativePath="..\inspector\InspectorAgent.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\InspectorAgent.h"
+ >
+ </File>
+ <File
RelativePath="..\inspector\InspectorApplicationCacheAgent.cpp"
>
</File>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 4cf6439..f38f1a7 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1265,6 +1265,8 @@
4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959280A39DACC00220FE5 /* MediaQueryExp.h */; };
4F1534DE11B532EC0021FD86 /* EditingBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1534DD11B532EC0021FD86 /* EditingBehavior.h */; settings = {ATTRIBUTES = (Private, ); }; };
4F1534E011B533020021FD86 /* EditingBehaviorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1534DF11B533020021FD86 /* EditingBehaviorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 4F2D205412EAE7B3005C2874 /* InspectorAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F2D205212EAE7B3005C2874 /* InspectorAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 4F2D205512EAE7B3005C2874 /* InspectorAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F2D205312EAE7B3005C2874 /* InspectorAgent.cpp */; };
4F3289B511A42AAB005ABE7E /* InspectorValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F3289B311A42AAB005ABE7E /* InspectorValues.cpp */; };
4F3289B611A42AAB005ABE7E /* InspectorValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F3289B411A42AAB005ABE7E /* InspectorValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
4F4F5FFB11CBD2E100A186BF /* InspectorFrontend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F4F5FFA11CBD2D200A186BF /* InspectorFrontend.cpp */; };
@@ -7667,6 +7669,8 @@
4E1959280A39DACC00220FE5 /* MediaQueryExp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQueryExp.h; sourceTree = "<group>"; };
4F1534DD11B532EC0021FD86 /* EditingBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBehavior.h; sourceTree = "<group>"; };
4F1534DF11B533020021FD86 /* EditingBehaviorTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBehaviorTypes.h; sourceTree = "<group>"; };
+ 4F2D205212EAE7B3005C2874 /* InspectorAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAgent.h; sourceTree = "<group>"; };
+ 4F2D205312EAE7B3005C2874 /* InspectorAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAgent.cpp; sourceTree = "<group>"; };
4F3289B311A42AAB005ABE7E /* InspectorValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorValues.cpp; sourceTree = "<group>"; };
4F3289B411A42AAB005ABE7E /* InspectorValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorValues.h; sourceTree = "<group>"; };
4F4F5FFA11CBD2D200A186BF /* InspectorFrontend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorFrontend.cpp; sourceTree = "<group>"; };
@@ -12969,6 +12973,8 @@
7A0E76F710BF08ED00A0276E /* InjectedScriptHost.h */,
7A0E76F810BF08ED00A0276E /* InjectedScriptHost.idl */,
7A563F9512DF5C9100F4536D /* InjectedScriptSource.js */,
+ 4F2D205212EAE7B3005C2874 /* InspectorAgent.h */,
+ 4F2D205312EAE7B3005C2874 /* InspectorAgent.cpp */,
B885E8D211E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp */,
B885E8D311E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h */,
F3D4C47612E07663003DA150 /* InspectorBrowserDebuggerAgent.cpp */,
@@ -22415,6 +22421,7 @@
E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
BC8AE34F12EA096A00EB3AE6 /* ScrollableArea.h in Headers */,
+ 4F2D205412EAE7B3005C2874 /* InspectorAgent.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -25110,6 +25117,7 @@
E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
BC8AE34E12EA096A00EB3AE6 /* ScrollableArea.cpp in Sources */,
+ 4F2D205512EAE7B3005C2874 /* InspectorAgent.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index 971098d..dd36c2e 100644
--- a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -46,7 +46,7 @@
#include "FrameLoader.h"
#include "InjectedScript.h"
#include "InjectedScriptHost.h"
-#include "InspectorController.h"
+#include "InspectorAgent.h"
#include "InspectorValues.h"
#include "JSDOMWindow.h"
#include "JSDOMWindowCustom.h"
@@ -128,8 +128,7 @@ JSValue JSInjectedScriptHost::nodeForId(ExecState* exec)
if (!node)
return jsUndefined();
- InspectorController* ic = impl()->inspectorController();
- if (!ic)
+ if (!impl()->inspectorAgent())
return jsUndefined();
JSLock lock(SilenceAssertionsOnly);
@@ -177,8 +176,7 @@ JSValue JSInjectedScriptHost::selectDOMStorage(ExecState* exec)
{
if (exec->argumentCount() < 1)
return jsUndefined();
- InspectorController* ic = impl()->inspectorController();
- if (!ic)
+ if (!impl()->inspectorAgent())
return jsUndefined();
Storage* storage = toStorage(exec->argument(0));
diff --git a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 6bd5abb..ce1732b 100644
--- a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -36,7 +36,6 @@
#include "Frame.h"
#include "InjectedScript.h"
#include "InjectedScriptHost.h"
-#include "InspectorController.h"
#include "InspectorValues.h"
#include "Node.h"
#include "Page.h"
@@ -147,8 +146,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Argument
if (!node)
return v8::Undefined();
- InspectorController* ic = host->inspectorController();
- if (!ic)
+ if (!host->inspectorAgent())
return v8::Undefined();
return toV8(node);
diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.pm b/Source/WebCore/inspector/CodeGeneratorInspector.pm
index e215a91..2ab5ecf 100644
--- a/Source/WebCore/inspector/CodeGeneratorInspector.pm
+++ b/Source/WebCore/inspector/CodeGeneratorInspector.pm
@@ -60,7 +60,7 @@ $typeTransform{"InjectedScript"} = {
"domainAccessor" => "m_inspectorAgent->injectedScriptAgent()",
};
$typeTransform{"Inspector"} = {
- "forwardHeader" => "InspectorController.h", # FIXME: Temporary solution until extracting the real InspectorAgent from InspectorController.
+ "forwardHeader" => "InspectorAgent.h",
"domainAccessor" => "m_inspectorAgent",
};
$typeTransform{"Network"} = {
@@ -269,7 +269,6 @@ sub GenerateInterface
$backendClassName = $className . "BackendDispatcher";
$backendJSStubName = $className . "BackendStub";
my @backendHead;
- push(@backendHead, " typedef InspectorController InspectorAgent;"); # FIXME: Temporary substitution until extracting InspectorAgent from InspectorController.
push(@backendHead, " ${backendClassName}(InspectorAgent* inspectorAgent) : m_inspectorAgent(inspectorAgent) { }");
push(@backendHead, " void reportProtocolError(const long callId, const String& errorText) const;");
push(@backendHead, " void dispatch(const String& message);");
diff --git a/Source/WebCore/inspector/InjectedScriptHost.cpp b/Source/WebCore/inspector/InjectedScriptHost.cpp
index d67adaf..fbb4dbf 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.cpp
+++ b/Source/WebCore/inspector/InjectedScriptHost.cpp
@@ -39,9 +39,9 @@
#include "HTMLFrameOwnerElement.h"
#include "InjectedScript.h"
#include "InjectedScriptSource.h"
+#include "InspectorAgent.h"
#include "InspectorClient.h"
#include "InspectorConsoleAgent.h"
-#include "InspectorController.h"
#include "InspectorDOMAgent.h"
#include "InspectorDOMStorageAgent.h"
#include "InspectorDatabaseAgent.h"
@@ -69,8 +69,8 @@ using namespace std;
namespace WebCore {
-InjectedScriptHost::InjectedScriptHost(InspectorController* inspectorController)
- : m_inspectorController(inspectorController)
+InjectedScriptHost::InjectedScriptHost(InspectorAgent* inspectorAgent)
+ : m_inspectorAgent(inspectorAgent)
, m_nextInjectedScriptId(1)
, m_lastWorkerId(1 << 31) // Distinguish ids of fake workers from real ones, to minimize the chances they overlap.
{
@@ -89,8 +89,8 @@ void InjectedScriptHost::evaluateOnSelf(const String& functionBody, PassRefPtr<I
void InjectedScriptHost::clearConsoleMessages()
{
- if (m_inspectorController)
- m_inspectorController->consoleAgent()->clearConsoleMessages();
+ if (m_inspectorAgent)
+ m_inspectorAgent->consoleAgent()->clearConsoleMessages();
}
void InjectedScriptHost::copyText(const String& text)
@@ -130,23 +130,23 @@ long InjectedScriptHost::inspectedNode(unsigned long num)
#if ENABLE(DATABASE)
Database* InjectedScriptHost::databaseForId(long databaseId)
{
- if (m_inspectorController && m_inspectorController->databaseAgent())
- return m_inspectorController->databaseAgent()->databaseForId(databaseId);
+ if (m_inspectorAgent && m_inspectorAgent->databaseAgent())
+ return m_inspectorAgent->databaseAgent()->databaseForId(databaseId);
return 0;
}
void InjectedScriptHost::selectDatabase(Database* database)
{
- if (m_inspectorController && m_inspectorController->databaseAgent())
- m_inspectorController->databaseAgent()->selectDatabase(database);
+ if (m_inspectorAgent && m_inspectorAgent->databaseAgent())
+ m_inspectorAgent->databaseAgent()->selectDatabase(database);
}
#endif
#if ENABLE(DOM_STORAGE)
void InjectedScriptHost::selectDOMStorage(Storage* storage)
{
- if (m_inspectorController && m_inspectorController->domStorageAgent())
- m_inspectorController->domStorageAgent()->selectDOMStorage(storage);
+ if (m_inspectorAgent && m_inspectorAgent->domStorageAgent())
+ m_inspectorAgent->domStorageAgent()->selectDOMStorage(storage);
}
#endif
@@ -166,7 +166,7 @@ InjectedScript InjectedScriptHost::injectedScriptForObjectId(InspectorObject* ob
InjectedScript InjectedScriptHost::injectedScriptForMainFrame()
{
- return injectedScriptFor(mainWorldScriptState(m_inspectorController->inspectedPage()->mainFrame()));
+ return injectedScriptFor(mainWorldScriptState(m_inspectorAgent->inspectedPage()->mainFrame()));
}
void InjectedScriptHost::discardInjectedScripts()
@@ -192,16 +192,16 @@ void InjectedScriptHost::releaseWrapperObjectGroup(long injectedScriptId, const
InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent()
{
- if (!m_inspectorController)
+ if (!m_inspectorAgent)
return 0;
- return m_inspectorController->domAgent();
+ return m_inspectorAgent->domAgent();
}
InspectorFrontend* InjectedScriptHost::frontend()
{
- if (!m_inspectorController)
+ if (!m_inspectorAgent)
return 0;
- return m_inspectorController->frontend();
+ return m_inspectorAgent->frontend();
}
String InjectedScriptHost::injectedScriptSource()
@@ -223,14 +223,14 @@ long InjectedScriptHost::nextWorkerId()
void InjectedScriptHost::didCreateWorker(long id, const String& url, bool isSharedWorker)
{
- if (m_inspectorController)
- m_inspectorController->didCreateWorker(id, url, isSharedWorker);
+ if (m_inspectorAgent)
+ m_inspectorAgent->didCreateWorker(id, url, isSharedWorker);
}
void InjectedScriptHost::didDestroyWorker(long id)
{
- if (m_inspectorController)
- m_inspectorController->didDestroyWorker(id);
+ if (m_inspectorAgent)
+ m_inspectorAgent->didDestroyWorker(id);
}
#endif // ENABLE(WORKERS)
diff --git a/Source/WebCore/inspector/InjectedScriptHost.h b/Source/WebCore/inspector/InjectedScriptHost.h
index 108f118..f51f8da 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.h
+++ b/Source/WebCore/inspector/InjectedScriptHost.h
@@ -31,7 +31,7 @@
#define InjectedScriptHost_h
#include "Console.h"
-#include "InspectorController.h"
+#include "InspectorAgent.h"
#include "PlatformString.h"
#include "ScriptState.h"
@@ -52,9 +52,9 @@ class Storage;
class InjectedScriptHost : public RefCounted<InjectedScriptHost>
{
public:
- static PassRefPtr<InjectedScriptHost> create(InspectorController* inspectorController)
+ static PassRefPtr<InjectedScriptHost> create(InspectorAgent* inspectorAgent)
{
- return adoptRef(new InjectedScriptHost(inspectorController));
+ return adoptRef(new InjectedScriptHost(inspectorAgent));
}
~InjectedScriptHost();
@@ -62,8 +62,8 @@ public:
// Part of the protocol.
void evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result);
- InspectorController* inspectorController() { return m_inspectorController; }
- void disconnectController() { m_inspectorController = 0; }
+ InspectorAgent* inspectorAgent() { return m_inspectorAgent; }
+ void disconnectController() { m_inspectorAgent = 0; }
void clearConsoleMessages();
@@ -96,14 +96,14 @@ public:
static bool canAccessInspectedWindow(ScriptState*);
private:
- InjectedScriptHost(InspectorController* inspectorController);
+ InjectedScriptHost(InspectorAgent*);
InspectorDOMAgent* inspectorDOMAgent();
InspectorFrontend* frontend();
String injectedScriptSource();
ScriptObject createInjectedScript(const String& source, ScriptState* scriptState, long id);
void discardInjectedScript(ScriptState*);
- InspectorController* m_inspectorController;
+ InspectorAgent* m_inspectorAgent;
long m_nextInjectedScriptId;
long m_lastWorkerId;
typedef HashMap<long, InjectedScript> IdToInjectedScriptMap;
diff --git a/Source/WebCore/inspector/InspectorAgent.cpp b/Source/WebCore/inspector/InspectorAgent.cpp
new file mode 100644
index 0000000..60c3ff8
--- /dev/null
+++ b/Source/WebCore/inspector/InspectorAgent.cpp
@@ -0,0 +1,1414 @@
+/*
+ * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Matt Lilek <webkit at mattlilek.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorAgent.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "CachedResource.h"
+#include "CachedResourceLoader.h"
+#include "Chrome.h"
+#include "Cookie.h"
+#include "CookieJar.h"
+#include "DOMWindow.h"
+#include "DOMWrapperWorld.h"
+#include "Document.h"
+#include "DocumentLoader.h"
+#include "Element.h"
+#include "FloatConversion.h"
+#include "FloatQuad.h"
+#include "FloatRect.h"
+#include "Frame.h"
+#include "FrameLoadRequest.h"
+#include "FrameLoader.h"
+#include "FrameTree.h"
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "HTMLFrameOwnerElement.h"
+#include "HTTPHeaderMap.h"
+#include "HitTestResult.h"
+#include "InjectedScript.h"
+#include "InjectedScriptHost.h"
+#include "InspectorBackendDispatcher.h"
+#include "InspectorBrowserDebuggerAgent.h"
+#include "InspectorCSSAgent.h"
+#include "InspectorClient.h"
+#include "InspectorConsoleAgent.h"
+#include "InspectorController.h"
+#include "InspectorDOMAgent.h"
+#include "InspectorDOMStorageResource.h"
+#include "InspectorDatabaseResource.h"
+#include "InspectorDebuggerAgent.h"
+#include "InspectorFrontend.h"
+#include "InspectorFrontendClient.h"
+#include "InspectorInstrumentation.h"
+#include "InspectorProfilerAgent.h"
+#include "InspectorResourceAgent.h"
+#include "InspectorRuntimeAgent.h"
+#include "InspectorSettings.h"
+#include "InspectorState.h"
+#include "InspectorTimelineAgent.h"
+#include "InspectorValues.h"
+#include "InspectorWorkerResource.h"
+#include "IntRect.h"
+#include "Page.h"
+#include "ProgressTracker.h"
+#include "Range.h"
+#include "RenderInline.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
+#include "ScriptArguments.h"
+#include "ScriptCallStack.h"
+#include "ScriptFunctionCall.h"
+#include "ScriptObject.h"
+#include "ScriptProfile.h"
+#include "ScriptProfiler.h"
+#include "ScriptSourceCode.h"
+#include "ScriptState.h"
+#include "SecurityOrigin.h"
+#include "Settings.h"
+#include "SharedBuffer.h"
+#include "TextEncoding.h"
+#include "TextIterator.h"
+#include "TextRun.h"
+#include "UserGestureIndicator.h"
+#include "WindowFeatures.h"
+#include <wtf/CurrentTime.h>
+#include <wtf/ListHashSet.h>
+#include <wtf/RefCounted.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/UnusedParam.h>
+#include <wtf/text/StringConcatenate.h>
+
+#if ENABLE(DATABASE)
+#include "Database.h"
+#include "InspectorDatabaseAgent.h"
+#endif
+
+#if ENABLE(DOM_STORAGE)
+#include "InspectorDOMStorageAgent.h"
+#include "Storage.h"
+#include "StorageArea.h"
+#endif
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+#include "InspectorApplicationCacheAgent.h"
+#endif
+
+#if ENABLE(FILE_SYSTEM)
+#include "InspectorFileSystemAgent.h"
+#endif
+
+using namespace std;
+
+namespace WebCore {
+
+const char* const InspectorAgent::ElementsPanel = "elements";
+const char* const InspectorAgent::ConsolePanel = "console";
+const char* const InspectorAgent::ScriptsPanel = "scripts";
+const char* const InspectorAgent::ProfilesPanel = "profiles";
+
+InspectorAgent::InspectorAgent(InspectorController* inspectorController, Page* page, InspectorClient* client)
+ : m_inspectorController(inspectorController)
+ , m_inspectedPage(page)
+ , m_client(client)
+ , m_openingFrontend(false)
+ , m_cssAgent(new InspectorCSSAgent())
+ , m_state(new InspectorState(client))
+ , m_inspectorBackendDispatcher(new InspectorBackendDispatcher(this))
+ , m_injectedScriptHost(InjectedScriptHost::create(this))
+ , m_consoleAgent(new InspectorConsoleAgent(this))
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ , m_attachDebuggerWhenShown(false)
+ , m_profilerAgent(InspectorProfilerAgent::create(this))
+#endif
+{
+ ASSERT_ARG(page, page);
+ ASSERT_ARG(client, client);
+ InspectorInstrumentation::bindInspectorAgent(m_inspectedPage, this);
+}
+
+InspectorAgent::~InspectorAgent()
+{
+ // These should have been cleared in inspectedPageDestroyed().
+ ASSERT(!m_client);
+ ASSERT(!m_inspectedPage);
+ ASSERT(!m_highlightedNode);
+}
+
+void InspectorAgent::inspectedPageDestroyed()
+{
+ if (m_frontend)
+ m_frontend->disconnectFromBackend();
+
+ hideHighlight();
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ m_debuggerAgent.clear();
+ m_browserDebuggerAgent.clear();
+#endif
+
+ ASSERT(m_inspectedPage);
+ InspectorInstrumentation::unbindInspectorAgent(m_inspectedPage);
+ m_inspectedPage = 0;
+
+ releaseFrontendLifetimeAgents();
+ m_injectedScriptHost->disconnectController();
+
+ m_client->inspectorDestroyed();
+ m_client = 0;
+}
+
+bool InspectorAgent::enabled() const
+{
+ if (!m_inspectedPage)
+ return false;
+ return m_inspectedPage->settings()->developerExtrasEnabled();
+}
+
+bool InspectorAgent::inspectorStartsAttached()
+{
+ return m_settings->getBoolean(InspectorSettings::InspectorStartsAttached);
+}
+
+void InspectorAgent::setInspectorStartsAttached(bool attached)
+{
+ m_settings->setBoolean(InspectorSettings::InspectorStartsAttached, attached);
+}
+
+void InspectorAgent::setInspectorAttachedHeight(long height)
+{
+ m_settings->setLong(InspectorSettings::InspectorAttachedHeight, height);
+}
+
+long InspectorAgent::inspectorAttachedHeight() const
+{
+ return m_settings->getLong(InspectorSettings::InspectorAttachedHeight);
+}
+
+bool InspectorAgent::searchingForNodeInPage() const
+{
+ return m_state->getBoolean(InspectorState::searchingForNode);
+}
+
+void InspectorAgent::restoreInspectorStateFromCookie(const String& inspectorStateCookie)
+{
+ m_state->restoreFromInspectorCookie(inspectorStateCookie);
+
+ if (!m_frontend) {
+ connectFrontend();
+ m_frontend->frontendReused();
+ m_frontend->inspectedURLChanged(inspectedURL().string());
+ m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
+ pushDataCollectedOffline();
+ }
+
+ m_resourceAgent = InspectorResourceAgent::restore(m_inspectedPage, m_state.get(), m_frontend.get());
+
+ if (m_state->getBoolean(InspectorState::timelineProfilerEnabled))
+ startTimelineProfiler();
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ restoreDebugger();
+ restoreProfiler(ProfilerRestoreResetAgent);
+ if (m_state->getBoolean(InspectorState::userInitiatedProfiling))
+ startUserInitiatedProfiling();
+#endif
+}
+
+void InspectorAgent::inspect(Node* node)
+{
+ if (!enabled())
+ return;
+
+ show();
+
+ if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE)
+ node = node->parentNode();
+ m_nodeToFocus = node;
+
+ if (!m_frontend)
+ return;
+
+ focusNode();
+}
+
+void InspectorAgent::focusNode()
+{
+ if (!enabled())
+ return;
+
+ ASSERT(m_frontend);
+ ASSERT(m_nodeToFocus);
+
+ long id = m_domAgent->pushNodePathToFrontend(m_nodeToFocus.get());
+ m_frontend->updateFocusedNode(id);
+ m_nodeToFocus = 0;
+}
+
+void InspectorAgent::highlight(Node* node)
+{
+ if (!enabled())
+ return;
+ ASSERT_ARG(node, node);
+ m_highlightedNode = node;
+ m_client->highlight(node);
+}
+
+void InspectorAgent::highlightDOMNode(long nodeId)
+{
+ Node* node = 0;
+ if (m_domAgent && (node = m_domAgent->nodeForId(nodeId)))
+ highlight(node);
+}
+
+void InspectorAgent::highlightFrame(unsigned long frameId)
+{
+ Frame* mainFrame = m_inspectedPage->mainFrame();
+ for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext(mainFrame)) {
+ if (reinterpret_cast<uintptr_t>(frame) == frameId && frame->ownerElement()) {
+ highlight(frame->ownerElement());
+ return;
+ }
+ }
+}
+
+void InspectorAgent::hideHighlight()
+{
+ if (!enabled())
+ return;
+ m_highlightedNode = 0;
+ m_client->hideHighlight();
+}
+
+void InspectorAgent::mouseDidMoveOverElement(const HitTestResult& result, unsigned)
+{
+ if (!enabled() || !searchingForNodeInPage())
+ return;
+
+ Node* node = result.innerNode();
+ while (node && node->nodeType() == Node::TEXT_NODE)
+ node = node->parentNode();
+ if (node)
+ highlight(node);
+}
+
+bool InspectorAgent::handleMousePress()
+{
+ if (!enabled() || !searchingForNodeInPage())
+ return false;
+
+ if (m_highlightedNode) {
+ RefPtr<Node> node = m_highlightedNode;
+ setSearchingForNode(false);
+ inspect(node.get());
+ }
+ return true;
+}
+
+void InspectorAgent::setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient> client)
+{
+ ASSERT(!m_inspectorFrontendClient);
+ m_inspectorFrontendClient = client;
+}
+
+void InspectorAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
+{
+ if (world != mainThreadNormalWorld())
+ return;
+
+ // If the page is supposed to serve as InspectorFrontend notify inspetor frontend
+ // client that it's cleared so that the client can expose inspector bindings.
+ if (m_inspectorFrontendClient && frame == m_inspectedPage->mainFrame())
+ m_inspectorFrontendClient->windowObjectCleared();
+
+ if (enabled()) {
+ if (m_frontend && frame == m_inspectedPage->mainFrame())
+ m_injectedScriptHost->discardInjectedScripts();
+ if (m_scriptsToEvaluateOnLoad.size()) {
+ ScriptState* scriptState = mainWorldScriptState(frame);
+ for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin();
+ it != m_scriptsToEvaluateOnLoad.end(); ++it) {
+ m_injectedScriptHost->injectScript(*it, scriptState);
+ }
+ }
+ }
+ if (!m_inspectorExtensionAPI.isEmpty())
+ m_injectedScriptHost->injectScript(m_inspectorExtensionAPI, mainWorldScriptState(frame));
+}
+
+void InspectorAgent::setSearchingForNode(bool enabled)
+{
+ if (searchingForNodeInPage() == enabled)
+ return;
+ m_state->setBoolean(InspectorState::searchingForNode, enabled);
+ if (!enabled)
+ hideHighlight();
+}
+
+void InspectorAgent::setSearchingForNode(bool enabled, bool* newState)
+{
+ *newState = enabled;
+ setSearchingForNode(enabled);
+}
+
+void InspectorAgent::connectFrontend()
+{
+ m_openingFrontend = false;
+ releaseFrontendLifetimeAgents();
+ m_frontend = new InspectorFrontend(m_client);
+ m_domAgent = InspectorDOMAgent::create(m_injectedScriptHost.get(), m_frontend.get());
+ m_runtimeAgent = InspectorRuntimeAgent::create(m_injectedScriptHost.get());
+ m_cssAgent->setDOMAgent(m_domAgent.get());
+
+#if ENABLE(DATABASE)
+ m_databaseAgent = InspectorDatabaseAgent::create(&m_databaseResources, m_frontend.get());
+#endif
+
+#if ENABLE(DOM_STORAGE)
+ m_domStorageAgent = InspectorDOMStorageAgent::create(&m_domStorageResources, m_frontend.get());
+#endif
+
+ if (m_timelineAgent)
+ m_timelineAgent->resetFrontendProxyObject(m_frontend.get());
+
+ m_consoleAgent->setFrontend(m_frontend.get());
+
+ // Initialize Web Inspector title.
+ m_frontend->inspectedURLChanged(inspectedURL().string());
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ m_applicationCacheAgent = new InspectorApplicationCacheAgent(this, m_frontend.get());
+#endif
+
+#if ENABLE(FILE_SYSTEM)
+ m_fileSystemAgent = InspectorFileSystemAgent::create(this, m_frontend.get());
+#endif
+
+ if (!InspectorInstrumentation::hasFrontends())
+ ScriptController::setCaptureCallStackForUncaughtExceptions(true);
+ InspectorInstrumentation::frontendCreated();
+}
+
+void InspectorAgent::show()
+{
+ if (!enabled())
+ return;
+
+ if (m_openingFrontend)
+ return;
+
+ if (m_frontend)
+ m_frontend->bringToFront();
+ else {
+ m_openingFrontend = true;
+ m_client->openInspectorFrontend(inspectorController());
+ }
+}
+
+void InspectorAgent::showPanel(const String& panel)
+{
+ if (!enabled())
+ return;
+
+ show();
+
+ if (!m_frontend) {
+ m_showAfterVisible = panel;
+ return;
+ }
+ m_frontend->showPanel(panel);
+}
+
+void InspectorAgent::close()
+{
+ if (!m_frontend)
+ return;
+ m_frontend->disconnectFromBackend();
+ disconnectFrontend();
+}
+
+void InspectorAgent::disconnectFrontend()
+{
+ if (!m_frontend)
+ return;
+
+ m_frontend.clear();
+
+ InspectorInstrumentation::frontendDeleted();
+ if (!InspectorInstrumentation::hasFrontends())
+ ScriptController::setCaptureCallStackForUncaughtExceptions(false);
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ // If the window is being closed with the debugger enabled,
+ // remember this state to re-enable debugger on the next window
+ // opening.
+ bool debuggerWasEnabled = debuggerEnabled();
+ disableDebugger();
+ m_attachDebuggerWhenShown = debuggerWasEnabled;
+#endif
+ setSearchingForNode(false);
+ unbindAllResources();
+ stopTimelineProfiler();
+
+ hideHighlight();
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ m_profilerAgent->setFrontend(0);
+ m_profilerAgent->stopUserInitiatedProfiling(true);
+#endif
+ m_consoleAgent->setFrontend(0);
+
+ releaseFrontendLifetimeAgents();
+ m_timelineAgent.clear();
+ m_extraHeaders.clear();
+}
+
+InspectorResourceAgent* InspectorAgent::resourceAgent()
+{
+ if (!m_resourceAgent && m_frontend)
+ m_resourceAgent = InspectorResourceAgent::create(m_inspectedPage, m_state.get(), m_frontend.get());
+ return m_resourceAgent.get();
+}
+
+void InspectorAgent::releaseFrontendLifetimeAgents()
+{
+ m_resourceAgent.clear();
+ m_runtimeAgent.clear();
+
+ // This should be invoked prior to m_domAgent destruction.
+ m_cssAgent->setDOMAgent(0);
+
+ // m_domAgent is RefPtr. Remove DOM listeners first to ensure that there are
+ // no references to the DOM agent from the DOM tree.
+ if (m_domAgent)
+ m_domAgent->reset();
+ m_domAgent.clear();
+
+#if ENABLE(DATABASE)
+ if (m_databaseAgent)
+ m_databaseAgent->clearFrontend();
+ m_databaseAgent.clear();
+#endif
+
+#if ENABLE(DOM_STORAGE)
+ m_domStorageAgent.clear();
+#endif
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ m_applicationCacheAgent.clear();
+#endif
+
+#if ENABLE(FILE_SYSTEM)
+ if (m_fileSystemAgent)
+ m_fileSystemAgent->stop();
+ m_fileSystemAgent.clear();
+#endif
+}
+
+void InspectorAgent::populateScriptObjects()
+{
+ ASSERT(m_frontend);
+ if (!m_frontend)
+ return;
+
+ if (!m_showAfterVisible.isEmpty()) {
+ showPanel(m_showAfterVisible);
+ m_showAfterVisible = "";
+ }
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ if (m_profilerAgent->enabled())
+ m_frontend->profilerWasEnabled();
+#endif
+
+ pushDataCollectedOffline();
+
+ if (m_nodeToFocus)
+ focusNode();
+
+ // Dispatch pending frontend commands
+ for (Vector<pair<long, String> >::iterator it = m_pendingEvaluateTestCommands.begin(); it != m_pendingEvaluateTestCommands.end(); ++it)
+ m_frontend->evaluateForTestInFrontend((*it).first, (*it).second);
+ m_pendingEvaluateTestCommands.clear();
+
+ restoreDebugger();
+ restoreProfiler(ProfilerRestoreNoAction);
+}
+
+void InspectorAgent::pushDataCollectedOffline()
+{
+ m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
+
+#if ENABLE(DATABASE)
+ DatabaseResourcesMap::iterator databasesEnd = m_databaseResources.end();
+ for (DatabaseResourcesMap::iterator it = m_databaseResources.begin(); it != databasesEnd; ++it)
+ it->second->bind(m_frontend.get());
+#endif
+#if ENABLE(DOM_STORAGE)
+ DOMStorageResourcesMap::iterator domStorageEnd = m_domStorageResources.end();
+ for (DOMStorageResourcesMap::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it)
+ it->second->bind(m_frontend.get());
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS)
+ WorkersMap::iterator workersEnd = m_workers.end();
+ for (WorkersMap::iterator it = m_workers.begin(); it != workersEnd; ++it) {
+ InspectorWorkerResource* worker = it->second.get();
+ m_frontend->didCreateWorker(worker->id(), worker->url(), worker->isSharedWorker());
+ }
+#endif
+}
+
+void InspectorAgent::restoreDebugger()
+{
+ ASSERT(m_frontend);
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ if (InspectorDebuggerAgent::isDebuggerAlwaysEnabled() || m_attachDebuggerWhenShown || m_settings->getBoolean(InspectorSettings::DebuggerAlwaysEnabled)) {
+ enableDebugger(false);
+ m_attachDebuggerWhenShown = false;
+ }
+#endif
+}
+
+void InspectorAgent::restoreProfiler(ProfilerRestoreAction action)
+{
+ ASSERT(m_frontend);
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ m_profilerAgent->setFrontend(m_frontend.get());
+ if (!ScriptProfiler::isProfilerAlwaysEnabled() && m_settings->getBoolean(InspectorSettings::ProfilerAlwaysEnabled))
+ enableProfiler();
+ if (action == ProfilerRestoreResetAgent)
+ m_profilerAgent->resetFrontendProfiles();
+#endif
+}
+
+void InspectorAgent::unbindAllResources()
+{
+#if ENABLE(DATABASE)
+ DatabaseResourcesMap::iterator databasesEnd = m_databaseResources.end();
+ for (DatabaseResourcesMap::iterator it = m_databaseResources.begin(); it != databasesEnd; ++it)
+ it->second->unbind();
+#endif
+#if ENABLE(DOM_STORAGE)
+ DOMStorageResourcesMap::iterator domStorageEnd = m_domStorageResources.end();
+ for (DOMStorageResourcesMap::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it)
+ it->second->unbind();
+#endif
+ if (m_timelineAgent)
+ m_timelineAgent->reset();
+}
+
+void InspectorAgent::didCommitLoad(DocumentLoader* loader)
+{
+ if (!enabled())
+ return;
+
+ if (m_resourceAgent)
+ m_resourceAgent->didCommitLoad(loader);
+
+ ASSERT(m_inspectedPage);
+
+ if (loader->frame() == m_inspectedPage->mainFrame()) {
+ if (m_frontend)
+ m_frontend->inspectedURLChanged(loader->url().string());
+
+ m_injectedScriptHost->discardInjectedScripts();
+ m_consoleAgent->reset();
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ if (m_debuggerAgent) {
+ m_debuggerAgent->clearForPageNavigation();
+ if (m_browserDebuggerAgent)
+ m_browserDebuggerAgent->inspectedURLChanged(inspectedURL());
+ }
+#endif
+
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+ m_profilerAgent->stopUserInitiatedProfiling(true);
+ m_profilerAgent->resetState();
+#endif
+
+ // unbindAllResources should be called before database and DOM storage
+ // resources are cleared so that it has a chance to unbind them.
+ unbindAllResources();
+
+ if (m_frontend) {
+ m_frontend->reset();
+ m_domAgent->reset();
+ m_cssAgent->reset();
+ }
+#if ENABLE(WORKERS)
+ m_workers.clear();
+#endif
+#if ENABLE(DATABASE)
+ m_databaseResources.clear();
+#endif
+#if ENABLE(DOM_STORAGE)
+ m_domStorageResources.clear();
+#endif
+
+ if (m_frontend)
+ m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
+ }
+}
+
+void InspectorAgent::mainResourceFiredDOMContentEvent(DocumentLoader* loader, const KURL& url)
+{
+ if (!enabled() || !isMainResourceLoader(loader, url))
+ return;
+
+ if (m_timelineAgent)
+ m_timelineAgent->didMarkDOMContentEvent();
+ if (m_frontend)
+ m_frontend->domContentEventFired(currentTime());
+}
+
+void InspectorAgent::mainResourceFiredLoadEvent(DocumentLoader* loader, const KURL& url)
+{
+ if (!enabled() || !isMainResourceLoader(loader, url))
+ return;
+
+ if (m_timelineAgent)
+ m_timelineAgent->didMarkLoadEvent();
+ if (m_frontend)
+ m_frontend->loadEventFired(currentTime());
+}
+
+bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl)
+{
+ return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL();
+}
+
+void InspectorAgent::willSendRequest(ResourceRequest& request)
+{
+ if (!enabled())
+ return;
+
+ if (m_frontend) {
+ // Only enable load timing and raw headers if front-end is attached, as otherwise we may produce overhead.
+ request.setReportLoadTiming(true);
+ request.setReportRawHeaders(true);
+
+ if (m_extraHeaders) {
+ HTTPHeaderMap::const_iterator end = m_extraHeaders->end();
+ for (HTTPHeaderMap::const_iterator it = m_extraHeaders->begin(); it != end; ++it)
+ request.setHTTPHeaderField(it->first, it->second);
+ }
+ }
+}
+
+void InspectorAgent::ensureSettingsLoaded()
+{
+ if (m_settings)
+ return;
+ m_settings = new InspectorSettings(m_client);
+ m_state->setBoolean(InspectorState::monitoringXHR, m_settings->getBoolean(InspectorSettings::MonitoringXHREnabled));
+}
+
+void InspectorAgent::startTimelineProfiler()
+{
+ if (!enabled())
+ return;
+
+ if (m_timelineAgent)
+ return;
+
+ m_timelineAgent = new InspectorTimelineAgent(m_frontend.get());
+ if (m_frontend)
+ m_frontend->timelineProfilerWasStarted();
+
+ m_state->setBoolean(InspectorState::timelineProfilerEnabled, true);
+}
+
+void InspectorAgent::stopTimelineProfiler()
+{
+ if (!enabled())
+ return;
+
+ if (!m_timelineAgent)
+ return;
+
+ m_timelineAgent = 0;
+ if (m_frontend)
+ m_frontend->timelineProfilerWasStopped();
+
+ m_state->setBoolean(InspectorState::timelineProfilerEnabled, false);
+}
+
+#if ENABLE(WORKERS)
+class PostWorkerNotificationToFrontendTask : public ScriptExecutionContext::Task {
+public:
+ static PassOwnPtr<PostWorkerNotificationToFrontendTask> create(PassRefPtr<InspectorWorkerResource> worker, InspectorAgent::WorkerAction action)
+ {
+ return new PostWorkerNotificationToFrontendTask(worker, action);
+ }
+
+private:
+ PostWorkerNotificationToFrontendTask(PassRefPtr<InspectorWorkerResource> worker, InspectorAgent::WorkerAction action)
+ : m_worker(worker)
+ , m_action(action)
+ {
+ }
+
+ virtual void performTask(ScriptExecutionContext* scriptContext)
+ {
+ if (scriptContext->isDocument()) {
+ if (InspectorAgent* inspector = static_cast<Document*>(scriptContext)->page()->inspectorController())
+ inspector->postWorkerNotificationToFrontend(*m_worker, m_action);
+ }
+ }
+
+private:
+ RefPtr<InspectorWorkerResource> m_worker;
+ InspectorAgent::WorkerAction m_action;
+};
+
+void InspectorAgent::postWorkerNotificationToFrontend(const InspectorWorkerResource& worker, InspectorAgent::WorkerAction action)
+{
+ if (!m_frontend)
+ return;
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ switch (action) {
+ case InspectorAgent::WorkerCreated:
+ m_frontend->didCreateWorker(worker.id(), worker.url(), worker.isSharedWorker());
+ break;
+ case InspectorAgent::WorkerDestroyed:
+ m_frontend->didDestroyWorker(worker.id());
+ break;
+ }
+#endif
+}
+
+void InspectorAgent::didCreateWorker(intptr_t id, const String& url, bool isSharedWorker)
+{
+ if (!enabled())
+ return;
+
+ RefPtr<InspectorWorkerResource> workerResource(InspectorWorkerResource::create(id, url, isSharedWorker));
+ m_workers.set(id, workerResource);
+ if (m_inspectedPage && m_frontend)
+ m_inspectedPage->mainFrame()->document()->postTask(PostWorkerNotificationToFrontendTask::create(workerResource, InspectorAgent::WorkerCreated));
+}
+
+void InspectorAgent::didDestroyWorker(intptr_t id)
+{
+ if (!enabled())
+ return;
+
+ WorkersMap::iterator workerResource = m_workers.find(id);
+ if (workerResource == m_workers.end())
+ return;
+ if (m_inspectedPage && m_frontend)
+ m_inspectedPage->mainFrame()->document()->postTask(PostWorkerNotificationToFrontendTask::create(workerResource->second, InspectorAgent::WorkerDestroyed));
+ m_workers.remove(workerResource);
+}
+#endif // ENABLE(WORKERS)
+
+#if ENABLE(DATABASE)
+void InspectorAgent::didOpenDatabase(PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
+{
+ if (!enabled())
+ return;
+
+ RefPtr<InspectorDatabaseResource> resource = InspectorDatabaseResource::create(database, domain, name, version);
+
+ m_databaseResources.set(resource->id(), resource);
+
+ // Resources are only bound while visible.
+ if (m_frontend)
+ resource->bind(m_frontend.get());
+}
+#endif
+
+void InspectorAgent::getCookies(RefPtr<InspectorArray>* cookies, WTF::String* cookiesString)
+{
+ // If we can get raw cookies.
+ ListHashSet<Cookie> rawCookiesList;
+
+ // If we can't get raw cookies - fall back to String representation
+ String stringCookiesList;
+
+ // Return value to getRawCookies should be the same for every call because
+ // the return value is platform/network backend specific, and the call will
+ // always return the same true/false value.
+ bool rawCookiesImplemented = false;
+
+ for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
+ Document* document = frame->document();
+ const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
+ CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
+ for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
+ Vector<Cookie> docCookiesList;
+ rawCookiesImplemented = getRawCookies(document, KURL(ParsedURLString, it->second->url()), docCookiesList);
+
+ if (!rawCookiesImplemented) {
+ // FIXME: We need duplication checking for the String representation of cookies.
+ ExceptionCode ec = 0;
+ stringCookiesList += document->cookie(ec);
+ // Exceptions are thrown by cookie() in sandboxed frames. That won't happen here
+ // because "document" is the document of the main frame of the page.
+ ASSERT(!ec);
+ } else {
+ int cookiesSize = docCookiesList.size();
+ for (int i = 0; i < cookiesSize; i++) {
+ if (!rawCookiesList.contains(docCookiesList[i]))
+ rawCookiesList.add(docCookiesList[i]);
+ }
+ }
+ }
+ }
+
+ if (rawCookiesImplemented)
+ *cookies = buildArrayForCookies(rawCookiesList);
+ else
+ *cookiesString = stringCookiesList;
+}
+
+PassRefPtr<InspectorArray> InspectorAgent::buildArrayForCookies(ListHashSet<Cookie>& cookiesList)
+{
+ RefPtr<InspectorArray> cookies = InspectorArray::create();
+
+ ListHashSet<Cookie>::iterator end = cookiesList.end();
+ ListHashSet<Cookie>::iterator it = cookiesList.begin();
+ for (int i = 0; it != end; ++it, i++)
+ cookies->pushObject(buildObjectForCookie(*it));
+
+ return cookies;
+}
+
+PassRefPtr<InspectorObject> InspectorAgent::buildObjectForCookie(const Cookie& cookie)
+{
+ RefPtr<InspectorObject> value = InspectorObject::create();
+ value->setString("name", cookie.name);
+ value->setString("value", cookie.value);
+ value->setString("domain", cookie.domain);
+ value->setString("path", cookie.path);
+ value->setNumber("expires", cookie.expires);
+ value->setNumber("size", (cookie.name.length() + cookie.value.length()));
+ value->setBoolean("httpOnly", cookie.httpOnly);
+ value->setBoolean("secure", cookie.secure);
+ value->setBoolean("session", cookie.session);
+ return value;
+}
+
+void InspectorAgent::deleteCookie(const String& cookieName, const String& domain)
+{
+ for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
+ Document* document = frame->document();
+ if (document->url().host() != domain)
+ continue;
+ const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
+ CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
+ for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it)
+ WebCore::deleteCookie(document, KURL(ParsedURLString, it->second->url()), cookieName);
+ }
+}
+
+#if ENABLE(DOM_STORAGE)
+void InspectorAgent::didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame)
+{
+ if (!enabled())
+ return;
+
+ DOMStorageResourcesMap::iterator domStorageEnd = m_domStorageResources.end();
+ for (DOMStorageResourcesMap::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it)
+ if (it->second->isSameHostAndType(frame, isLocalStorage))
+ return;
+
+ RefPtr<Storage> domStorage = Storage::create(frame, storageArea);
+ RefPtr<InspectorDOMStorageResource> resource = InspectorDOMStorageResource::create(domStorage.get(), isLocalStorage, frame);
+
+ m_domStorageResources.set(resource->id(), resource);
+
+ // Resources are only bound while visible.
+ if (m_frontend)
+ resource->bind(m_frontend.get());
+}
+#endif
+
+#if ENABLE(WEB_SOCKETS)
+void InspectorAgent::didCreateWebSocket(unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
+{
+ if (!enabled())
+ return;
+ ASSERT(m_inspectedPage);
+
+ if (m_resourceAgent)
+ m_resourceAgent->didCreateWebSocket(identifier, requestURL);
+ UNUSED_PARAM(documentURL);
+}
+
+void InspectorAgent::willSendWebSocketHandshakeRequest(unsigned long identifier, const WebSocketHandshakeRequest& request)
+{
+ if (m_resourceAgent)
+ m_resourceAgent->willSendWebSocketHandshakeRequest(identifier, request);
+}
+
+void InspectorAgent::didReceiveWebSocketHandshakeResponse(unsigned long identifier, const WebSocketHandshakeResponse& response)
+{
+ if (m_resourceAgent)
+ m_resourceAgent->didReceiveWebSocketHandshakeResponse(identifier, response);
+}
+
+void InspectorAgent::didCloseWebSocket(unsigned long identifier)
+{
+ if (m_resourceAgent)
+ m_resourceAgent->didCloseWebSocket(identifier);
+}
+#endif // ENABLE(WEB_SOCKETS)
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+bool InspectorAgent::isRecordingUserInitiatedProfile() const
+{
+ return m_profilerAgent->isRecordingUserInitiatedProfile();
+}
+
+void InspectorAgent::startUserInitiatedProfiling()
+{
+ if (!enabled())
+ return;
+ m_profilerAgent->startUserInitiatedProfiling();
+ m_state->setBoolean(InspectorState::userInitiatedProfiling, true);
+}
+
+void InspectorAgent::stopUserInitiatedProfiling()
+{
+ if (!enabled())
+ return;
+ m_profilerAgent->stopUserInitiatedProfiling();
+ m_state->setBoolean(InspectorState::userInitiatedProfiling, false);
+}
+
+bool InspectorAgent::profilerEnabled() const
+{
+ return enabled() && m_profilerAgent->enabled();
+}
+
+void InspectorAgent::enableProfiler(bool always, bool skipRecompile)
+{
+ if (always)
+ m_settings->setBoolean(InspectorSettings::ProfilerAlwaysEnabled, true);
+ m_profilerAgent->enable(skipRecompile);
+}
+
+void InspectorAgent::disableProfiler(bool always)
+{
+ if (always)
+ m_settings->setBoolean(InspectorSettings::ProfilerAlwaysEnabled, false);
+ m_profilerAgent->disable();
+}
+#endif
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+void InspectorAgent::showAndEnableDebugger()
+{
+ if (!enabled())
+ return;
+
+ if (debuggerEnabled())
+ return;
+
+ if (!m_frontend) {
+ m_attachDebuggerWhenShown = true;
+ showPanel(ScriptsPanel);
+ } else
+ enableDebugger(false);
+}
+
+void InspectorAgent::enableDebugger(bool always)
+{
+ ASSERT(!debuggerEnabled());
+ if (always)
+ m_settings->setBoolean(InspectorSettings::DebuggerAlwaysEnabled, true);
+
+ ASSERT(m_inspectedPage);
+
+ m_debuggerAgent = InspectorDebuggerAgent::create(this, m_frontend.get());
+ m_browserDebuggerAgent = InspectorBrowserDebuggerAgent::create(this);
+ m_browserDebuggerAgent->inspectedURLChanged(inspectedURL());
+
+ m_frontend->debuggerWasEnabled();
+}
+
+void InspectorAgent::disableDebugger(bool always)
+{
+ if (!enabled())
+ return;
+
+ if (always)
+ m_settings->setBoolean(InspectorSettings::DebuggerAlwaysEnabled, false);
+
+ ASSERT(m_inspectedPage);
+
+ m_debuggerAgent.clear();
+ m_browserDebuggerAgent.clear();
+
+ m_attachDebuggerWhenShown = false;
+
+ if (m_frontend)
+ m_frontend->debuggerWasDisabled();
+}
+
+void InspectorAgent::resume()
+{
+ if (m_debuggerAgent)
+ m_debuggerAgent->resume();
+}
+
+void InspectorAgent::setAllBrowserBreakpoints(PassRefPtr<InspectorObject> breakpoints)
+{
+ m_state->setObject(InspectorState::browserBreakpoints, breakpoints);
+}
+#endif
+
+void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script)
+{
+ if (m_frontend)
+ m_frontend->evaluateForTestInFrontend(callId, script);
+ else
+ m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script));
+}
+
+void InspectorAgent::didEvaluateForTestInFrontend(long callId, const String& jsonResult)
+{
+ ScriptState* scriptState = scriptStateFromPage(debuggerWorld(), m_inspectedPage);
+ ScriptObject window;
+ ScriptGlobalObject::get(scriptState, "window", window);
+ ScriptFunctionCall function(window, "didEvaluateForTestInFrontend");
+ function.appendArgument(callId);
+ function.appendArgument(jsonResult);
+ function.call();
+}
+
+static Path quadToPath(const FloatQuad& quad)
+{
+ Path quadPath;
+ quadPath.moveTo(quad.p1());
+ quadPath.addLineTo(quad.p2());
+ quadPath.addLineTo(quad.p3());
+ quadPath.addLineTo(quad.p4());
+ quadPath.closeSubpath();
+ return quadPath;
+}
+
+static void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, const Color& fillColor)
+{
+ static const int outlineThickness = 2;
+ static const Color outlineColor(62, 86, 180, 228);
+
+ Path quadPath = quadToPath(quad);
+
+ // Clip out the quad, then draw with a 2px stroke to get a pixel
+ // of outline (because inflating a quad is hard)
+ {
+ context.save();
+ context.clipOut(quadPath);
+
+ context.setStrokeThickness(outlineThickness);
+ context.setStrokeColor(outlineColor, ColorSpaceDeviceRGB);
+ context.strokePath(quadPath);
+
+ context.restore();
+ }
+
+ // Now do the fill
+ context.setFillColor(fillColor, ColorSpaceDeviceRGB);
+ context.fillPath(quadPath);
+}
+
+static void drawOutlinedQuadWithClip(GraphicsContext& context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor)
+{
+ context.save();
+ Path clipQuadPath = quadToPath(clipQuad);
+ context.clipOut(clipQuadPath);
+ drawOutlinedQuad(context, quad, fillColor);
+ context.restore();
+}
+
+static void drawHighlightForBox(GraphicsContext& context, const FloatQuad& contentQuad, const FloatQuad& paddingQuad, const FloatQuad& borderQuad, const FloatQuad& marginQuad)
+{
+ static const Color contentBoxColor(125, 173, 217, 128);
+ static const Color paddingBoxColor(125, 173, 217, 160);
+ static const Color borderBoxColor(125, 173, 217, 192);
+ static const Color marginBoxColor(125, 173, 217, 228);
+
+ if (marginQuad != borderQuad)
+ drawOutlinedQuadWithClip(context, marginQuad, borderQuad, marginBoxColor);
+ if (borderQuad != paddingQuad)
+ drawOutlinedQuadWithClip(context, borderQuad, paddingQuad, borderBoxColor);
+ if (paddingQuad != contentQuad)
+ drawOutlinedQuadWithClip(context, paddingQuad, contentQuad, paddingBoxColor);
+
+ drawOutlinedQuad(context, contentQuad, contentBoxColor);
+}
+
+static void drawHighlightForLineBoxesOrSVGRenderer(GraphicsContext& context, const Vector<FloatQuad>& lineBoxQuads)
+{
+ static const Color lineBoxColor(125, 173, 217, 128);
+
+ for (size_t i = 0; i < lineBoxQuads.size(); ++i)
+ drawOutlinedQuad(context, lineBoxQuads[i], lineBoxColor);
+}
+
+static inline void convertFromFrameToMainFrame(Frame* frame, IntRect& rect)
+{
+ rect = frame->page()->mainFrame()->view()->windowToContents(frame->view()->contentsToWindow(rect));
+}
+
+static inline IntSize frameToMainFrameOffset(Frame* frame)
+{
+ IntPoint mainFramePoint = frame->page()->mainFrame()->view()->windowToContents(frame->view()->contentsToWindow(IntPoint()));
+ return mainFramePoint - IntPoint();
+}
+
+void InspectorAgent::drawNodeHighlight(GraphicsContext& context) const
+{
+ if (!m_highlightedNode)
+ return;
+
+ RenderObject* renderer = m_highlightedNode->renderer();
+ Frame* containingFrame = m_highlightedNode->document()->frame();
+ if (!renderer || !containingFrame)
+ return;
+
+ IntSize mainFrameOffset = frameToMainFrameOffset(containingFrame);
+ IntRect boundingBox = renderer->absoluteBoundingBoxRect(true);
+ boundingBox.move(mainFrameOffset);
+
+ IntRect titleReferenceBox = boundingBox;
+
+ ASSERT(m_inspectedPage);
+
+ FrameView* view = m_inspectedPage->mainFrame()->view();
+ FloatRect overlayRect = view->visibleContentRect();
+ if (!overlayRect.contains(boundingBox) && !boundingBox.contains(enclosingIntRect(overlayRect)))
+ overlayRect = view->visibleContentRect();
+ context.translate(-overlayRect.x(), -overlayRect.y());
+
+ // RenderSVGRoot should be highlighted through the isBox() code path, all other SVG elements should just dump their absoluteQuads().
+#if ENABLE(SVG)
+ bool isSVGRenderer = renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVGRoot();
+#else
+ bool isSVGRenderer = false;
+#endif
+
+ if (renderer->isBox() && !isSVGRenderer) {
+ RenderBox* renderBox = toRenderBox(renderer);
+
+ IntRect contentBox = renderBox->contentBoxRect();
+
+ IntRect paddingBox(contentBox.x() - renderBox->paddingLeft(), contentBox.y() - renderBox->paddingTop(),
+ contentBox.width() + renderBox->paddingLeft() + renderBox->paddingRight(), contentBox.height() + renderBox->paddingTop() + renderBox->paddingBottom());
+ IntRect borderBox(paddingBox.x() - renderBox->borderLeft(), paddingBox.y() - renderBox->borderTop(),
+ paddingBox.width() + renderBox->borderLeft() + renderBox->borderRight(), paddingBox.height() + renderBox->borderTop() + renderBox->borderBottom());
+ IntRect marginBox(borderBox.x() - renderBox->marginLeft(), borderBox.y() - renderBox->marginTop(),
+ borderBox.width() + renderBox->marginLeft() + renderBox->marginRight(), borderBox.height() + renderBox->marginTop() + renderBox->marginBottom());
+
+ titleReferenceBox = marginBox;
+ titleReferenceBox.move(mainFrameOffset);
+ titleReferenceBox.move(boundingBox.x(), boundingBox.y());
+
+ FloatQuad absContentQuad = renderBox->localToAbsoluteQuad(FloatRect(contentBox));
+ FloatQuad absPaddingQuad = renderBox->localToAbsoluteQuad(FloatRect(paddingBox));
+ FloatQuad absBorderQuad = renderBox->localToAbsoluteQuad(FloatRect(borderBox));
+ FloatQuad absMarginQuad = renderBox->localToAbsoluteQuad(FloatRect(marginBox));
+
+ absContentQuad.move(mainFrameOffset);
+ absPaddingQuad.move(mainFrameOffset);
+ absBorderQuad.move(mainFrameOffset);
+ absMarginQuad.move(mainFrameOffset);
+
+ drawHighlightForBox(context, absContentQuad, absPaddingQuad, absBorderQuad, absMarginQuad);
+ } else if (renderer->isRenderInline() || isSVGRenderer) {
+ // FIXME: We should show margins/padding/border for inlines.
+ Vector<FloatQuad> lineBoxQuads;
+ renderer->absoluteQuads(lineBoxQuads);
+ for (unsigned i = 0; i < lineBoxQuads.size(); ++i)
+ lineBoxQuads[i] += mainFrameOffset;
+
+ drawHighlightForLineBoxesOrSVGRenderer(context, lineBoxQuads);
+ }
+
+ // Draw node title if necessary.
+
+ if (!m_highlightedNode->isElementNode())
+ return;
+
+ WebCore::Settings* settings = containingFrame->settings();
+ drawElementTitle(context, titleReferenceBox, overlayRect, settings);
+}
+
+void InspectorAgent::drawElementTitle(GraphicsContext& context, const IntRect& boundingBox, const FloatRect& overlayRect, WebCore::Settings* settings) const
+{
+ static const int rectInflatePx = 4;
+ static const int fontHeightPx = 12;
+ static const int borderWidthPx = 1;
+ static const Color tooltipBackgroundColor(255, 255, 194, 255);
+ static const Color tooltipBorderColor(Color::black);
+ static const Color tooltipFontColor(Color::black);
+
+ Element* element = static_cast<Element*>(m_highlightedNode.get());
+ bool isXHTML = element->document()->isXHTMLDocument();
+ String nodeTitle = isXHTML ? element->nodeName() : element->nodeName().lower();
+ const AtomicString& idValue = element->getIdAttribute();
+ if (!idValue.isNull() && !idValue.isEmpty()) {
+ nodeTitle += "#";
+ nodeTitle += idValue;
+ }
+ if (element->hasClass() && element->isStyledElement()) {
+ const SpaceSplitString& classNamesString = static_cast<StyledElement*>(element)->classNames();
+ size_t classNameCount = classNamesString.size();
+ if (classNameCount) {
+ HashSet<AtomicString> usedClassNames;
+ for (size_t i = 0; i < classNameCount; ++i) {
+ const AtomicString& className = classNamesString[i];
+ if (usedClassNames.contains(className))
+ continue;
+ usedClassNames.add(className);
+ nodeTitle += ".";
+ nodeTitle += className;
+ }
+ }
+ }
+
+ Element* highlightedElement = m_highlightedNode->isElementNode() ? static_cast<Element*>(m_highlightedNode.get()) : 0;
+ nodeTitle += " [";
+ nodeTitle += String::number(highlightedElement ? highlightedElement->offsetWidth() : boundingBox.width());
+ nodeTitle.append(static_cast<UChar>(0x00D7)); // ×
+ nodeTitle += String::number(highlightedElement ? highlightedElement->offsetHeight() : boundingBox.height());
+ nodeTitle += "]";
+
+ FontDescription desc;
+ FontFamily family;
+ family.setFamily(settings->fixedFontFamily());
+ desc.setFamily(family);
+ desc.setComputedSize(fontHeightPx);
+ Font font = Font(desc, 0, 0);
+ font.update(0);
+
+ TextRun nodeTitleRun(nodeTitle);
+ IntPoint titleBasePoint = boundingBox.bottomLeft();
+ titleBasePoint.move(rectInflatePx, rectInflatePx);
+ IntRect titleRect = enclosingIntRect(font.selectionRectForText(nodeTitleRun, titleBasePoint, fontHeightPx));
+ titleRect.inflate(rectInflatePx);
+
+ // The initial offsets needed to compensate for a 1px-thick border stroke (which is not a part of the rectangle).
+ int dx = -borderWidthPx;
+ int dy = borderWidthPx;
+
+ // If the tip sticks beyond the right of overlayRect, right-align the tip with the said boundary.
+ if (titleRect.right() > overlayRect.right())
+ dx = overlayRect.right() - titleRect.right();
+
+ // If the tip sticks beyond the left of overlayRect, left-align the tip with the said boundary.
+ if (titleRect.x() + dx < overlayRect.x())
+ dx = overlayRect.x() - titleRect.x() - borderWidthPx;
+
+ // If the tip sticks beyond the bottom of overlayRect, show the tip at top of bounding box.
+ if (titleRect.bottom() > overlayRect.bottom()) {
+ dy = boundingBox.y() - titleRect.bottom() - borderWidthPx;
+ // If the tip still sticks beyond the bottom of overlayRect, bottom-align the tip with the said boundary.
+ if (titleRect.bottom() + dy > overlayRect.bottom())
+ dy = overlayRect.bottom() - titleRect.bottom();
+ }
+
+ // If the tip sticks beyond the top of overlayRect, show the tip at top of overlayRect.
+ if (titleRect.y() + dy < overlayRect.y())
+ dy = overlayRect.y() - titleRect.y() + borderWidthPx;
+
+ titleRect.move(dx, dy);
+ context.setStrokeColor(tooltipBorderColor, ColorSpaceDeviceRGB);
+ context.setStrokeThickness(borderWidthPx);
+ context.setFillColor(tooltipBackgroundColor, ColorSpaceDeviceRGB);
+ context.drawRect(titleRect);
+ context.setFillColor(tooltipFontColor, ColorSpaceDeviceRGB);
+ context.drawText(font, nodeTitleRun, IntPoint(titleRect.x() + rectInflatePx, titleRect.y() + font.fontMetrics().height()));
+}
+
+void InspectorAgent::openInInspectedWindow(const String& url)
+{
+ Frame* mainFrame = m_inspectedPage->mainFrame();
+
+ FrameLoadRequest request(mainFrame->document()->securityOrigin(), ResourceRequest(), "_blank");
+
+ bool created;
+ WindowFeatures windowFeatures;
+ Frame* newFrame = WebCore::createWindow(mainFrame, mainFrame, request, windowFeatures, created);
+ if (!newFrame)
+ return;
+
+ UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
+ newFrame->loader()->setOpener(mainFrame);
+ newFrame->page()->setOpenedByDOM();
+ newFrame->loader()->changeLocation(mainFrame->document()->securityOrigin(), newFrame->loader()->completeURL(url), "", false, false);
+}
+
+void InspectorAgent::addScriptToEvaluateOnLoad(const String& source)
+{
+ m_scriptsToEvaluateOnLoad.append(source);
+}
+
+void InspectorAgent::removeAllScriptsToEvaluateOnLoad()
+{
+ m_scriptsToEvaluateOnLoad.clear();
+}
+
+void InspectorAgent::setInspectorExtensionAPI(const String& source)
+{
+ m_inspectorExtensionAPI = source;
+}
+
+KURL InspectorAgent::inspectedURL() const
+{
+ return m_inspectedPage->mainFrame()->loader()->url();
+}
+
+void InspectorAgent::reloadPage()
+{
+ // FIXME: Why do we set the user gesture indicator here?
+ UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
+ m_inspectedPage->mainFrame()->navigationScheduler()->scheduleRefresh();
+}
+
+void InspectorAgent::setExtraHeaders(PassRefPtr<InspectorObject> headers)
+{
+ m_extraHeaders = adoptPtr(new HTTPHeaderMap());
+ InspectorObject::const_iterator end = headers->end();
+ for (InspectorObject::const_iterator it = headers->begin(); it != end; ++it) {
+ String value;
+ if (!it->second->asString(&value))
+ continue;
+ m_extraHeaders->add(it->first, value);
+ }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/InspectorAgent.h b/Source/WebCore/inspector/InspectorAgent.h
new file mode 100644
index 0000000..b252a20
--- /dev/null
+++ b/Source/WebCore/inspector/InspectorAgent.h
@@ -0,0 +1,369 @@
+/*
+ * Copyright (C) 2007, 2008, 2009, 2010 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 met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorAgent_h
+#define InspectorAgent_h
+
+#include "CharacterData.h"
+#include "Console.h"
+#include "Cookie.h"
+#include "Page.h"
+#include "PlatformString.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/ListHashSet.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
+
+namespace WebCore {
+
+class CachedResource;
+class CharacterData;
+class Database;
+class DOMWrapperWorld;
+class Document;
+class DocumentLoader;
+class FloatRect;
+class GraphicsContext;
+class HTTPHeaderMap;
+class HitTestResult;
+class InjectedScript;
+class InjectedScriptHost;
+class InspectorArray;
+class InspectorBackendDispatcher;
+class InspectorBrowserDebuggerAgent;
+class InspectorClient;
+class InspectorConsoleAgent;
+class InspectorController;
+class InspectorCSSAgent;
+class InspectorDOMAgent;
+class InspectorDOMStorageAgent;
+class InspectorDOMStorageResource;
+class InspectorDatabaseAgent;
+class InspectorDatabaseResource;
+class InspectorDebuggerAgent;
+class InspectorFrontend;
+class InspectorFrontendClient;
+class InspectorObject;
+class InspectorProfilerAgent;
+class InspectorResourceAgent;
+class InspectorRuntimeAgent;
+class InspectorSettings;
+class InspectorState;
+class InspectorStorageAgent;
+class InspectorTimelineAgent;
+class InspectorValue;
+class InspectorWorkerResource;
+class IntRect;
+class KURL;
+class Node;
+class Page;
+class ResourceRequest;
+class ResourceResponse;
+class ResourceError;
+class ScriptArguments;
+class ScriptCallStack;
+class ScriptProfile;
+class SharedBuffer;
+class StorageArea;
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+class InspectorApplicationCacheAgent;
+#endif
+
+#if ENABLE(FILE_SYSTEM)
+class InspectorFileSystemAgent;
+#endif
+
+#if ENABLE(WEB_SOCKETS)
+class WebSocketHandshakeRequest;
+class WebSocketHandshakeResponse;
+#endif
+
+class InspectorAgent {
+ WTF_MAKE_NONCOPYABLE(InspectorAgent);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ static const char* const ConsolePanel;
+ static const char* const ElementsPanel;
+ static const char* const ProfilesPanel;
+ static const char* const ScriptsPanel;
+
+ InspectorAgent(InspectorController*, Page*, InspectorClient*);
+ virtual ~InspectorAgent();
+
+ InspectorBackendDispatcher* inspectorBackendDispatcher() { return m_inspectorBackendDispatcher.get(); }
+ InspectorClient* inspectorClient() { return m_client; }
+ InjectedScriptHost* injectedScriptHost() { return m_injectedScriptHost.get(); }
+
+ void inspectedPageDestroyed();
+
+ bool enabled() const;
+
+ Page* inspectedPage() const { return m_inspectedPage; }
+ KURL inspectedURL() const;
+ void reloadPage();
+
+ void restoreInspectorStateFromCookie(const String& inspectorCookie);
+
+ void inspect(Node*);
+ void highlight(Node*);
+ void hideHighlight();
+ void highlightDOMNode(long nodeId);
+ void hideDOMNodeHighlight() { hideHighlight(); }
+
+ void highlightFrame(unsigned long frameId);
+ void hideFrameHighlight() { hideHighlight(); }
+
+ void show();
+ void showPanel(const String&);
+ void close();
+
+ void connectFrontend();
+ void reuseFrontend();
+ void disconnectFrontend();
+ InspectorFrontend* frontend() const { return m_frontend.get(); }
+
+ InspectorResourceAgent* resourceAgent();
+
+ InspectorController* inspectorController() { return m_inspectorController; };
+ InspectorAgent* inspectorAgent() { return this; }
+ InspectorConsoleAgent* consoleAgent() { return m_consoleAgent.get(); }
+ InspectorCSSAgent* cssAgent() { return m_cssAgent.get(); }
+ InspectorDOMAgent* domAgent() { return m_domAgent.get(); }
+ InjectedScriptHost* injectedScriptAgent() { return m_injectedScriptHost.get(); }
+ InspectorRuntimeAgent* runtimeAgent() { return m_runtimeAgent.get(); }
+ InspectorTimelineAgent* timelineAgent() { return m_timelineAgent.get(); }
+#if ENABLE(DATABASE)
+ InspectorDatabaseAgent* databaseAgent() { return m_databaseAgent.get(); }
+#endif
+#if ENABLE(DOM_STORAGE)
+ InspectorDOMStorageAgent* domStorageAgent() { return m_domStorageAgent.get(); }
+#endif
+#if ENABLE(FILE_SYSTEM)
+ InspectorFileSystemAgent* fileSystemAgent() { return m_fileSystemAgent.get(); }
+#endif
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ InspectorBrowserDebuggerAgent* browserDebuggerAgent() const { return m_browserDebuggerAgent.get(); }
+ InspectorDebuggerAgent* debuggerAgent() const { return m_debuggerAgent.get(); }
+ InspectorProfilerAgent* profilerAgent() const { return m_profilerAgent.get(); }
+#endif
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); }
+#endif
+
+
+ bool searchingForNodeInPage() const;
+ void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
+ bool handleMousePress();
+
+ void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient>);
+ bool hasInspectorFrontendClient() const { return m_inspectorFrontendClient; }
+
+ void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
+
+ void didCommitLoad(DocumentLoader*);
+
+ void setExtraHeaders(PassRefPtr<InspectorObject>);
+
+ void startTimelineProfiler();
+ void stopTimelineProfiler();
+
+ void getCookies(RefPtr<InspectorArray>* cookies, WTF::String* cookiesString);
+ void deleteCookie(const String& cookieName, const String& domain);
+
+ void mainResourceFiredLoadEvent(DocumentLoader*, const KURL&);
+ void mainResourceFiredDOMContentEvent(DocumentLoader*, const KURL&);
+
+#if ENABLE(WORKERS)
+ enum WorkerAction { WorkerCreated, WorkerDestroyed };
+
+ void postWorkerNotificationToFrontend(const InspectorWorkerResource&, WorkerAction);
+ void didCreateWorker(intptr_t, const String& url, bool isSharedWorker);
+ void didDestroyWorker(intptr_t);
+#endif
+
+#if ENABLE(DATABASE)
+ void didOpenDatabase(PassRefPtr<Database>, const String& domain, const String& name, const String& version);
+#endif
+
+#if ENABLE(DOM_STORAGE)
+ void didUseDOMStorage(StorageArea*, bool isLocalStorage, Frame*);
+#endif
+
+#if ENABLE(WEB_SOCKETS)
+ void didCreateWebSocket(unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
+ void willSendWebSocketHandshakeRequest(unsigned long identifier, const WebSocketHandshakeRequest&);
+ void didReceiveWebSocketHandshakeResponse(unsigned long identifier, const WebSocketHandshakeResponse&);
+ void didCloseWebSocket(unsigned long identifier);
+#endif
+
+ bool hasFrontend() const { return m_frontend; }
+
+ void drawNodeHighlight(GraphicsContext&) const;
+ void openInInspectedWindow(const String& url);
+ void drawElementTitle(GraphicsContext&, const IntRect& boundingBox, const FloatRect& overlayRect, WebCore::Settings*) const;
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ bool isRecordingUserInitiatedProfile() const;
+ void startProfiling() { startUserInitiatedProfiling(); }
+ void startUserInitiatedProfiling();
+ void stopProfiling() { stopUserInitiatedProfiling(); }
+ void stopUserInitiatedProfiling();
+ void enableProfiler(bool always = false, bool skipRecompile = false);
+ void disableProfiler(bool always = false);
+ bool profilerEnabled() const;
+
+ void showAndEnableDebugger();
+ void enableDebugger(bool always);
+ void disableDebugger(bool always = false);
+ bool debuggerEnabled() const { return m_debuggerAgent; }
+ void resume();
+
+ void setAllBrowserBreakpoints(PassRefPtr<InspectorObject>);
+#endif
+
+ // Generic code called from custom implementations.
+ void evaluateForTestInFrontend(long testCallId, const String& script);
+
+ void addScriptToEvaluateOnLoad(const String& source);
+ void removeAllScriptsToEvaluateOnLoad();
+ void setInspectorExtensionAPI(const String& source);
+
+ bool inspectorStartsAttached();
+ void setInspectorStartsAttached(bool);
+ void setInspectorAttachedHeight(long);
+ long inspectorAttachedHeight() const;
+
+ InspectorState* state() { return m_state.get(); }
+ InspectorSettings* settings() { return m_settings.get(); }
+
+ // InspectorAgent API
+ void getInspectorState(RefPtr<InspectorObject>* state);
+ void setMonitoringXHREnabled(bool enabled, bool* newState);
+ void populateScriptObjects();
+ // Following are used from InspectorBackend and internally.
+ void setSearchingForNode(bool enabled, bool* newState);
+ void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
+
+ // InspectorInstrumentation API
+ void ensureSettingsLoaded();
+ void willSendRequest(ResourceRequest&);
+
+private:
+ void pushDataCollectedOffline();
+ void restoreDebugger();
+ enum ProfilerRestoreAction {
+ ProfilerRestoreNoAction = 0,
+ ProfilerRestoreResetAgent = 1
+ };
+ void restoreProfiler(ProfilerRestoreAction);
+ void unbindAllResources();
+ void setSearchingForNode(bool enabled);
+
+ void releaseFrontendLifetimeAgents();
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ void toggleRecordButton(bool);
+#endif
+
+ PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie&);
+ PassRefPtr<InspectorArray> buildArrayForCookies(ListHashSet<Cookie>&);
+
+ void focusNode();
+ bool isMainResourceLoader(DocumentLoader*, const KURL& requestUrl);
+
+ InspectorController* m_inspectorController;
+ Page* m_inspectedPage;
+ InspectorClient* m_client;
+ OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
+ bool m_openingFrontend;
+ OwnPtr<InspectorFrontend> m_frontend;
+ OwnPtr<InspectorCSSAgent> m_cssAgent;
+ RefPtr<InspectorDOMAgent> m_domAgent;
+
+#if ENABLE(DATABASE)
+ RefPtr<InspectorDatabaseAgent> m_databaseAgent;
+#endif
+
+#if ENABLE(DOM_STORAGE)
+ RefPtr<InspectorDOMStorageAgent> m_domStorageAgent;
+#endif
+
+ OwnPtr<InspectorTimelineAgent> m_timelineAgent;
+ OwnPtr<InspectorState> m_state;
+ OwnPtr<InspectorSettings> m_settings;
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ OwnPtr<InspectorApplicationCacheAgent> m_applicationCacheAgent;
+#endif
+
+#if ENABLE(FILE_SYSTEM)
+ RefPtr<InspectorFileSystemAgent> m_fileSystemAgent;
+#endif
+
+ RefPtr<Node> m_nodeToFocus;
+ RefPtr<InspectorResourceAgent> m_resourceAgent;
+ OwnPtr<InspectorRuntimeAgent> m_runtimeAgent;
+
+#if ENABLE(DATABASE)
+ typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
+ DatabaseResourcesMap m_databaseResources;
+#endif
+#if ENABLE(DOM_STORAGE)
+ typedef HashMap<int, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
+ DOMStorageResourcesMap m_domStorageResources;
+#endif
+
+ String m_showAfterVisible;
+ RefPtr<Node> m_highlightedNode;
+ OwnPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
+ RefPtr<InjectedScriptHost> m_injectedScriptHost;
+ OwnPtr<InspectorConsoleAgent> m_consoleAgent;
+
+ Vector<pair<long, String> > m_pendingEvaluateTestCommands;
+ Vector<String> m_scriptsToEvaluateOnLoad;
+ String m_inspectorExtensionAPI;
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ bool m_attachDebuggerWhenShown;
+ OwnPtr<InspectorDebuggerAgent> m_debuggerAgent;
+ OwnPtr<InspectorBrowserDebuggerAgent> m_browserDebuggerAgent;
+ OwnPtr<InspectorProfilerAgent> m_profilerAgent;
+#endif
+ OwnPtr<HTTPHeaderMap> m_extraHeaders;
+#if ENABLE(WORKERS)
+ typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap;
+
+ WorkersMap m_workers;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // !defined(InspectorAgent_h)
diff --git a/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp b/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
index 1cca6fe..2776c56 100644
--- a/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
+++ b/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
@@ -32,7 +32,7 @@
#include "DocumentLoader.h"
#include "Frame.h"
#include "FrameLoader.h"
-#include "InspectorController.h"
+#include "InspectorAgent.h"
#include "InspectorFrontend.h"
#include "InspectorValues.h"
#include "NetworkStateNotifier.h"
@@ -41,8 +41,8 @@
namespace WebCore {
-InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InspectorController* inspectorController, InspectorFrontend* frontend)
- : m_inspectorController(inspectorController)
+InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InspectorAgent* inspectorAgent, InspectorFrontend* frontend)
+ : m_inspectorAgent(inspectorAgent)
, m_frontend(frontend)
{
}
@@ -61,7 +61,7 @@ void InspectorApplicationCacheAgent::networkStateChanged()
void InspectorApplicationCacheAgent::getApplicationCaches(RefPtr<InspectorValue>* applicationCaches)
{
- DocumentLoader* documentLoader = m_inspectorController->inspectedPage()->mainFrame()->loader()->documentLoader();
+ DocumentLoader* documentLoader = m_inspectorAgent->inspectedPage()->mainFrame()->loader()->documentLoader();
if (documentLoader) {
ApplicationCacheHost* host = documentLoader->applicationCacheHost();
ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo();
diff --git a/Source/WebCore/inspector/InspectorApplicationCacheAgent.h b/Source/WebCore/inspector/InspectorApplicationCacheAgent.h
index ac0acbf..b9352fe 100644
--- a/Source/WebCore/inspector/InspectorApplicationCacheAgent.h
+++ b/Source/WebCore/inspector/InspectorApplicationCacheAgent.h
@@ -35,7 +35,7 @@ namespace WebCore {
class Frame;
class InspectorArray;
-class InspectorController;
+class InspectorAgent;
class InspectorFrontend;
class InspectorObject;
class InspectorValue;
@@ -44,7 +44,7 @@ class ResourceResponse;
class InspectorApplicationCacheAgent {
WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent); WTF_MAKE_FAST_ALLOCATED;
public:
- InspectorApplicationCacheAgent(InspectorController* inspectorController, InspectorFrontend* frontend);
+ InspectorApplicationCacheAgent(InspectorAgent*, InspectorFrontend*);
~InspectorApplicationCacheAgent() { }
// Backend to Frontend
@@ -59,7 +59,7 @@ private:
PassRefPtr<InspectorArray> buildArrayForApplicationCacheResources(const ApplicationCacheHost::ResourceInfoList&);
PassRefPtr<InspectorObject> buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo&);
- InspectorController* m_inspectorController;
+ InspectorAgent* m_inspectorAgent;
InspectorFrontend* m_frontend;
};
diff --git a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp
index 023dc49..7ee7e81 100644
--- a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp
@@ -35,7 +35,7 @@
#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
#include "HTMLElement.h"
-#include "InspectorController.h"
+#include "InspectorAgent.h"
#include "InspectorDOMAgent.h"
#include "InspectorDebuggerAgent.h"
#include "InspectorState.h"
@@ -61,8 +61,8 @@ const int domBreakpointDerivedTypeShift = 16;
namespace WebCore {
-InspectorBrowserDebuggerAgent::InspectorBrowserDebuggerAgent(InspectorController* inspectorController)
- : m_inspectorController(inspectorController)
+InspectorBrowserDebuggerAgent::InspectorBrowserDebuggerAgent(InspectorAgent* inspectorAgent)
+ : m_inspectorAgent(inspectorAgent)
, m_hasXHRBreakpointWithEmptyURL(false)
{
}
@@ -77,7 +77,7 @@ void InspectorBrowserDebuggerAgent::inspectedURLChanged(const KURL& url)
m_XHRBreakpoints.clear();
m_hasXHRBreakpointWithEmptyURL = false;
- RefPtr<InspectorObject> allBreakpoints = m_inspectorController->state()->getObject(InspectorState::browserBreakpoints);
+ RefPtr<InspectorObject> allBreakpoints = m_inspectorAgent->state()->getObject(InspectorState::browserBreakpoints);
KURL urlCopy = url;
urlCopy.removeFragmentIdentifier();
RefPtr<InspectorArray> breakpoints = allBreakpoints->getArray(urlCopy);
@@ -112,7 +112,7 @@ void InspectorBrowserDebuggerAgent::restoreStickyBreakpoint(PassRefPtr<Inspector
if (!condition->getString("eventName", &eventName))
return;
setEventListenerBreakpoint(eventName);
- } else if (type == javaScriptBreakpointType && m_inspectorController->debuggerAgent()) {
+ } else if (type == javaScriptBreakpointType && m_inspectorAgent->debuggerAgent()) {
String url;
if (!condition->getString("url", &url))
return;
@@ -122,7 +122,7 @@ void InspectorBrowserDebuggerAgent::restoreStickyBreakpoint(PassRefPtr<Inspector
String javaScriptCondition;
if (!condition->getString("condition", &javaScriptCondition))
return;
- m_inspectorController->debuggerAgent()->setStickyBreakpoint(url, static_cast<unsigned>(lineNumber), javaScriptCondition, enabled);
+ m_inspectorAgent->debuggerAgent()->setStickyBreakpoint(url, static_cast<unsigned>(lineNumber), javaScriptCondition, enabled);
} else if (type == xhrBreakpointType) {
if (!enabled)
return;
@@ -178,7 +178,7 @@ void InspectorBrowserDebuggerAgent::didRemoveDOMNode(Node* node)
void InspectorBrowserDebuggerAgent::setDOMBreakpoint(long nodeId, long type)
{
- Node* node = m_inspectorController->domAgent()->nodeForId(nodeId);
+ Node* node = m_inspectorAgent->domAgent()->nodeForId(nodeId);
if (!node)
return;
@@ -192,7 +192,7 @@ void InspectorBrowserDebuggerAgent::setDOMBreakpoint(long nodeId, long type)
void InspectorBrowserDebuggerAgent::removeDOMBreakpoint(long nodeId, long type)
{
- Node* node = m_inspectorController->domAgent()->nodeForId(nodeId);
+ Node* node = m_inspectorAgent->domAgent()->nodeForId(nodeId);
if (!node)
return;
@@ -211,7 +211,7 @@ void InspectorBrowserDebuggerAgent::removeDOMBreakpoint(long nodeId, long type)
void InspectorBrowserDebuggerAgent::willInsertDOMNode(Node*, Node* parent)
{
- InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent();
+ InspectorDebuggerAgent* debuggerAgent = m_inspectorAgent->debuggerAgent();
if (!debuggerAgent)
return;
@@ -225,7 +225,7 @@ void InspectorBrowserDebuggerAgent::willInsertDOMNode(Node*, Node* parent)
void InspectorBrowserDebuggerAgent::willRemoveDOMNode(Node* node)
{
- InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent();
+ InspectorDebuggerAgent* debuggerAgent = m_inspectorAgent->debuggerAgent();
if (!debuggerAgent)
return;
@@ -244,7 +244,7 @@ void InspectorBrowserDebuggerAgent::willRemoveDOMNode(Node* node)
void InspectorBrowserDebuggerAgent::willModifyDOMAttr(Element* element)
{
- InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent();
+ InspectorDebuggerAgent* debuggerAgent = m_inspectorAgent->debuggerAgent();
if (!debuggerAgent)
return;
@@ -264,7 +264,7 @@ void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, long br
if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) {
// For inheritable breakpoint types, target node isn't always the same as the node that owns a breakpoint.
// Target node may be unknown to frontend, so we need to push it first.
- long targetNodeId = m_inspectorController->domAgent()->pushNodePathToFrontend(target);
+ long targetNodeId = m_inspectorAgent->domAgent()->pushNodePathToFrontend(target);
ASSERT(targetNodeId);
description->setNumber("targetNodeId", targetNodeId);
@@ -281,7 +281,7 @@ void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, long br
description->setBoolean("insertion", insertion);
}
- long breakpointOwnerNodeId = m_inspectorController->domAgent()->pushNodePathToFrontend(breakpointOwner);
+ long breakpointOwnerNodeId = m_inspectorAgent->domAgent()->pushNodePathToFrontend(breakpointOwner);
ASSERT(breakpointOwnerNodeId);
description->setNumber("nodeId", breakpointOwnerNodeId);
description->setNumber("type", breakpointType);
@@ -314,7 +314,7 @@ void InspectorBrowserDebuggerAgent::updateSubtreeBreakpoints(Node* node, uint32_
void InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded(const String& categoryType, const String& eventName, bool synchronous)
{
- InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent();
+ InspectorDebuggerAgent* debuggerAgent = m_inspectorAgent->debuggerAgent();
if (!debuggerAgent)
return;
@@ -349,7 +349,7 @@ void InspectorBrowserDebuggerAgent::removeXHRBreakpoint(const String& url)
void InspectorBrowserDebuggerAgent::willSendXMLHttpRequest(const String& url)
{
- InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent();
+ InspectorDebuggerAgent* debuggerAgent = m_inspectorAgent->debuggerAgent();
if (!debuggerAgent)
return;
diff --git a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h
index 0ffa85c..6c893a4 100644
--- a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h
+++ b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h
@@ -44,7 +44,7 @@
namespace WebCore {
class Element;
-class InspectorController;
+class InspectorAgent;
class InspectorObject;
class KURL;
class Node;
@@ -52,9 +52,9 @@ class Node;
class InspectorBrowserDebuggerAgent {
WTF_MAKE_NONCOPYABLE(InspectorBrowserDebuggerAgent);
public:
- static PassOwnPtr<InspectorBrowserDebuggerAgent> create(InspectorController* inspectorController)
+ static PassOwnPtr<InspectorBrowserDebuggerAgent> create(InspectorAgent* inspectorAgent)
{
- return adoptPtr(new InspectorBrowserDebuggerAgent(inspectorController));
+ return adoptPtr(new InspectorBrowserDebuggerAgent(inspectorAgent));
}
virtual ~InspectorBrowserDebuggerAgent();
@@ -79,7 +79,7 @@ public:
void pauseOnNativeEventIfNeeded(const String& categoryType, const String& eventName, bool synchronous);
private:
- InspectorBrowserDebuggerAgent(InspectorController*);
+ InspectorBrowserDebuggerAgent(InspectorAgent*);
void restoreStickyBreakpoint(PassRefPtr<InspectorObject> breakpoint);
@@ -88,7 +88,7 @@ private:
bool hasBreakpoint(Node*, long type);
void discardBindings();
- InspectorController* m_inspectorController;
+ InspectorAgent* m_inspectorAgent;
HashMap<Node*, uint32_t> m_domBreakpoints;
HashSet<String> m_eventListenerBreakpoints;
HashSet<String> m_XHRBreakpoints;
diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.cpp b/Source/WebCore/inspector/InspectorConsoleAgent.cpp
index 2c837f3..76638c7 100644
--- a/Source/WebCore/inspector/InspectorConsoleAgent.cpp
+++ b/Source/WebCore/inspector/InspectorConsoleAgent.cpp
@@ -30,7 +30,7 @@
#include "Console.h"
#include "ConsoleMessage.h"
#include "InjectedScriptHost.h"
-#include "InspectorController.h"
+#include "InspectorAgent.h"
#include "InspectorDOMAgent.h"
#include "InspectorFrontend.h"
#include "InspectorSettings.h"
@@ -50,8 +50,8 @@ namespace WebCore {
static const unsigned maximumConsoleMessages = 1000;
static const unsigned expireConsoleMessagesStep = 100;
-InspectorConsoleAgent::InspectorConsoleAgent(InspectorController* inspectorController)
- : m_inspectorController(inspectorController)
+InspectorConsoleAgent::InspectorConsoleAgent(InspectorAgent* inspectorAgent)
+ : m_inspectorAgent(inspectorAgent)
, m_frontend(0)
, m_previousMessage(0)
, m_expiredConsoleMessageCount(0)
@@ -60,7 +60,7 @@ InspectorConsoleAgent::InspectorConsoleAgent(InspectorController* inspectorContr
InspectorConsoleAgent::~InspectorConsoleAgent()
{
- m_inspectorController = 0;
+ m_inspectorAgent = 0;
}
void InspectorConsoleAgent::setConsoleMessagesEnabled(bool enabled, bool* newState)
@@ -74,8 +74,8 @@ void InspectorConsoleAgent::clearConsoleMessages()
m_consoleMessages.clear();
m_expiredConsoleMessageCount = 0;
m_previousMessage = 0;
- m_inspectorController->injectedScriptHost()->releaseWrapperObjectGroup(0 /* release the group in all scripts */, "console");
- if (InspectorDOMAgent* domAgent = m_inspectorController->domAgent())
+ m_inspectorAgent->injectedScriptHost()->releaseWrapperObjectGroup(0 /* release the group in all scripts */, "console");
+ if (InspectorDOMAgent* domAgent = m_inspectorAgent->domAgent())
domAgent->releaseDanglingNodes();
if (m_frontend)
m_frontend->consoleMessagesCleared();
@@ -95,14 +95,14 @@ void InspectorConsoleAgent::setFrontend(InspectorFrontend* frontend)
void InspectorConsoleAgent::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
{
- if (!m_inspectorController->enabled())
+ if (!m_inspectorAgent->enabled())
return;
addConsoleMessage(new ConsoleMessage(source, type, level, message, arguments, callStack));
}
void InspectorConsoleAgent::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
{
- if (!m_inspectorController->enabled())
+ if (!m_inspectorAgent->enabled())
return;
addConsoleMessage(new ConsoleMessage(source, type, level, message, lineNumber, sourceID));
}
@@ -163,15 +163,15 @@ void InspectorConsoleAgent::count(PassRefPtr<ScriptArguments> arguments, PassRef
void InspectorConsoleAgent::resourceRetrievedByXMLHttpRequest(const String& url, const String& sendURL, unsigned sendLineNumber)
{
- if (!m_inspectorController->enabled())
+ if (!m_inspectorAgent->enabled())
return;
- if (m_inspectorController->state()->getBoolean(InspectorState::monitoringXHR))
+ if (m_inspectorAgent->state()->getBoolean(InspectorState::monitoringXHR))
addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + url + "\".", sendLineNumber, sendURL);
}
void InspectorConsoleAgent::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
{
- if (!m_inspectorController->enabled())
+ if (!m_inspectorAgent->enabled())
return;
if (response.httpStatusCode() >= 400) {
@@ -182,7 +182,7 @@ void InspectorConsoleAgent::didReceiveResponse(unsigned long identifier, const R
void InspectorConsoleAgent::didFailLoading(unsigned long identifier, const ResourceError& error)
{
- if (!m_inspectorController->enabled())
+ if (!m_inspectorAgent->enabled())
return;
String message = "Failed to load resource";
@@ -193,40 +193,40 @@ void InspectorConsoleAgent::didFailLoading(unsigned long identifier, const Resou
void InspectorConsoleAgent::setMonitoringXHREnabled(bool enabled)
{
- m_inspectorController->state()->setBoolean(InspectorState::monitoringXHR, enabled);
- m_inspectorController->settings()->setBoolean(InspectorSettings::MonitoringXHREnabled, enabled);
+ m_inspectorAgent->state()->setBoolean(InspectorState::monitoringXHR, enabled);
+ m_inspectorAgent->settings()->setBoolean(InspectorSettings::MonitoringXHREnabled, enabled);
if (m_frontend)
m_frontend->monitoringXHRStateChanged(enabled);
}
void InspectorConsoleAgent::setConsoleMessagesEnabled(bool enabled)
{
- m_inspectorController->state()->setBoolean(InspectorState::consoleMessagesEnabled, enabled);
+ m_inspectorAgent->state()->setBoolean(InspectorState::consoleMessagesEnabled, enabled);
if (!enabled || !m_frontend)
return;
- m_frontend->monitoringXHRStateChanged(m_inspectorController->state()->getBoolean(InspectorState::monitoringXHR));
+ m_frontend->monitoringXHRStateChanged(m_inspectorAgent->state()->getBoolean(InspectorState::monitoringXHR));
if (m_expiredConsoleMessageCount)
m_frontend->updateConsoleMessageExpiredCount(m_expiredConsoleMessageCount);
unsigned messageCount = m_consoleMessages.size();
for (unsigned i = 0; i < messageCount; ++i)
- m_consoleMessages[i]->addToFrontend(m_frontend, m_inspectorController->injectedScriptHost());
+ m_consoleMessages[i]->addToFrontend(m_frontend, m_inspectorAgent->injectedScriptHost());
}
void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> consoleMessage)
{
- ASSERT(m_inspectorController->enabled());
+ ASSERT(m_inspectorAgent->enabled());
ASSERT_ARG(consoleMessage, consoleMessage);
if (m_previousMessage && m_previousMessage->isEqual(consoleMessage.get())) {
m_previousMessage->incrementCount();
- if (m_inspectorController->state()->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend)
+ if (m_inspectorAgent->state()->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend)
m_previousMessage->updateRepeatCountInConsole(m_frontend);
} else {
m_previousMessage = consoleMessage.get();
m_consoleMessages.append(consoleMessage);
- if (m_inspectorController->state()->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend)
- m_previousMessage->addToFrontend(m_frontend, m_inspectorController->injectedScriptHost());
+ if (m_inspectorAgent->state()->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend)
+ m_previousMessage->addToFrontend(m_frontend, m_inspectorAgent->injectedScriptHost());
}
if (!m_frontend && m_consoleMessages.size() >= maximumConsoleMessages) {
diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.h b/Source/WebCore/inspector/InspectorConsoleAgent.h
index 411f709..10ffb02 100644
--- a/Source/WebCore/inspector/InspectorConsoleAgent.h
+++ b/Source/WebCore/inspector/InspectorConsoleAgent.h
@@ -37,7 +37,7 @@ namespace WebCore {
#if ENABLE(INSPECTOR)
class ConsoleMessage;
-class InspectorController;
+class InspectorAgent;
class InspectorFrontend;
class InspectorState;
class ResourceError;
@@ -49,7 +49,7 @@ class ScriptProfile;
class InspectorConsoleAgent {
WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent);
public:
- InspectorConsoleAgent(InspectorController*);
+ InspectorConsoleAgent(InspectorAgent*);
~InspectorConsoleAgent();
void setConsoleMessagesEnabled(bool enabled, bool* newState);
@@ -77,7 +77,7 @@ private:
void setConsoleMessagesEnabled(bool);
void addConsoleMessage(PassOwnPtr<ConsoleMessage>);
- InspectorController* m_inspectorController;
+ InspectorAgent* m_inspectorAgent;
InspectorFrontend* m_frontend;
ConsoleMessage* m_previousMessage;
Vector<OwnPtr<ConsoleMessage> > m_consoleMessages;
diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp
index f57610f..fb8409e 100644
--- a/Source/WebCore/inspector/InspectorController.cpp
+++ b/Source/WebCore/inspector/InspectorController.cpp
@@ -1,30 +1,31 @@
/*
- * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Matt Lilek <webkit at mattlilek.com>
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * modification, are permitted provided that the following conditions are
+ * met:
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -32,1377 +33,15 @@
#if ENABLE(INSPECTOR)
-#include "CachedResource.h"
-#include "CachedResourceLoader.h"
-#include "Chrome.h"
-#include "Cookie.h"
-#include "CookieJar.h"
-#include "DOMWindow.h"
-#include "DOMWrapperWorld.h"
-#include "Document.h"
-#include "DocumentLoader.h"
-#include "Element.h"
-#include "FloatConversion.h"
-#include "FloatQuad.h"
-#include "FloatRect.h"
-#include "Frame.h"
-#include "FrameLoadRequest.h"
-#include "FrameLoader.h"
-#include "FrameTree.h"
-#include "FrameView.h"
-#include "GraphicsContext.h"
-#include "HTMLFrameOwnerElement.h"
-#include "HTTPHeaderMap.h"
-#include "HitTestResult.h"
-#include "InjectedScript.h"
-#include "InjectedScriptHost.h"
-#include "InspectorBackendDispatcher.h"
-#include "InspectorBrowserDebuggerAgent.h"
-#include "InspectorCSSAgent.h"
#include "InspectorClient.h"
-#include "InspectorConsoleAgent.h"
-#include "InspectorDOMAgent.h"
-#include "InspectorDOMStorageResource.h"
-#include "InspectorDatabaseResource.h"
-#include "InspectorDebuggerAgent.h"
-#include "InspectorFrontend.h"
-#include "InspectorFrontendClient.h"
-#include "InspectorInstrumentation.h"
-#include "InspectorProfilerAgent.h"
-#include "InspectorResourceAgent.h"
-#include "InspectorRuntimeAgent.h"
-#include "InspectorSettings.h"
-#include "InspectorState.h"
-#include "InspectorTimelineAgent.h"
-#include "InspectorValues.h"
-#include "InspectorWorkerResource.h"
-#include "IntRect.h"
#include "Page.h"
-#include "ProgressTracker.h"
-#include "Range.h"
-#include "RenderInline.h"
-#include "ResourceRequest.h"
-#include "ResourceResponse.h"
-#include "ScriptArguments.h"
-#include "ScriptCallStack.h"
-#include "ScriptFunctionCall.h"
-#include "ScriptObject.h"
-#include "ScriptProfile.h"
-#include "ScriptProfiler.h"
-#include "ScriptSourceCode.h"
-#include "ScriptState.h"
-#include "SecurityOrigin.h"
-#include "Settings.h"
-#include "SharedBuffer.h"
-#include "TextEncoding.h"
-#include "TextIterator.h"
-#include "TextRun.h"
-#include "UserGestureIndicator.h"
-#include "WindowFeatures.h"
-#include <wtf/text/StringConcatenate.h>
-#include <wtf/CurrentTime.h>
-#include <wtf/ListHashSet.h>
-#include <wtf/RefCounted.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/UnusedParam.h>
-
-#if ENABLE(DATABASE)
-#include "Database.h"
-#include "InspectorDatabaseAgent.h"
-#endif
-
-#if ENABLE(DOM_STORAGE)
-#include "InspectorDOMStorageAgent.h"
-#include "Storage.h"
-#include "StorageArea.h"
-#endif
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-#include "InspectorApplicationCacheAgent.h"
-#endif
-
-#if ENABLE(FILE_SYSTEM)
-#include "InspectorFileSystemAgent.h"
-#endif
-
-using namespace std;
namespace WebCore {
-const char* const InspectorController::ElementsPanel = "elements";
-const char* const InspectorController::ConsolePanel = "console";
-const char* const InspectorController::ScriptsPanel = "scripts";
-const char* const InspectorController::ProfilesPanel = "profiles";
-
-InspectorController::InspectorController(Page* page, InspectorClient* client)
- : m_inspectedPage(page)
- , m_client(client)
- , m_openingFrontend(false)
- , m_cssAgent(new InspectorCSSAgent())
- , m_state(new InspectorState(client))
- , m_inspectorBackendDispatcher(new InspectorBackendDispatcher(this))
- , m_injectedScriptHost(InjectedScriptHost::create(this))
- , m_consoleAgent(new InspectorConsoleAgent(this))
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- , m_attachDebuggerWhenShown(false)
- , m_profilerAgent(InspectorProfilerAgent::create(this))
-#endif
-{
- ASSERT_ARG(page, page);
- ASSERT_ARG(client, client);
-}
-
-InspectorController::~InspectorController()
-{
- // These should have been cleared in inspectedPageDestroyed().
- ASSERT(!m_client);
- ASSERT(!m_inspectedPage);
- ASSERT(!m_highlightedNode);
-}
-
-void InspectorController::inspectedPageDestroyed()
-{
- if (m_frontend)
- m_frontend->disconnectFromBackend();
-
- hideHighlight();
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- m_debuggerAgent.clear();
- m_browserDebuggerAgent.clear();
-#endif
-
- ASSERT(m_inspectedPage);
- m_inspectedPage = 0;
-
- releaseFrontendLifetimeAgents();
- m_injectedScriptHost->disconnectController();
-
- m_client->inspectorDestroyed();
- m_client = 0;
-}
-
-bool InspectorController::enabled() const
-{
- if (!m_inspectedPage)
- return false;
- return m_inspectedPage->settings()->developerExtrasEnabled();
-}
-
-bool InspectorController::inspectorStartsAttached()
-{
- return m_settings->getBoolean(InspectorSettings::InspectorStartsAttached);
-}
-
-void InspectorController::setInspectorStartsAttached(bool attached)
-{
- m_settings->setBoolean(InspectorSettings::InspectorStartsAttached, attached);
-}
-
-void InspectorController::setInspectorAttachedHeight(long height)
-{
- m_settings->setLong(InspectorSettings::InspectorAttachedHeight, height);
-}
-
-long InspectorController::inspectorAttachedHeight() const
-{
- return m_settings->getLong(InspectorSettings::InspectorAttachedHeight);
-}
-
-bool InspectorController::searchingForNodeInPage() const
-{
- return m_state->getBoolean(InspectorState::searchingForNode);
-}
-
-void InspectorController::restoreInspectorStateFromCookie(const String& inspectorStateCookie)
-{
- m_state->restoreFromInspectorCookie(inspectorStateCookie);
-
- if (!m_frontend) {
- connectFrontend();
- m_frontend->frontendReused();
- m_frontend->inspectedURLChanged(inspectedURL().string());
- m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
- pushDataCollectedOffline();
- }
-
- m_resourceAgent = InspectorResourceAgent::restore(m_inspectedPage, m_state.get(), m_frontend.get());
-
- if (m_state->getBoolean(InspectorState::timelineProfilerEnabled))
- startTimelineProfiler();
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- restoreDebugger();
- restoreProfiler(ProfilerRestoreResetAgent);
- if (m_state->getBoolean(InspectorState::userInitiatedProfiling))
- startUserInitiatedProfiling();
-#endif
-}
-
-void InspectorController::inspect(Node* node)
-{
- if (!enabled())
- return;
-
- show();
-
- if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE)
- node = node->parentNode();
- m_nodeToFocus = node;
-
- if (!m_frontend)
- return;
-
- focusNode();
-}
-
-void InspectorController::focusNode()
-{
- if (!enabled())
- return;
-
- ASSERT(m_frontend);
- ASSERT(m_nodeToFocus);
-
- long id = m_domAgent->pushNodePathToFrontend(m_nodeToFocus.get());
- m_frontend->updateFocusedNode(id);
- m_nodeToFocus = 0;
-}
-
-void InspectorController::highlight(Node* node)
-{
- if (!enabled())
- return;
- ASSERT_ARG(node, node);
- m_highlightedNode = node;
- m_client->highlight(node);
-}
-
-void InspectorController::highlightDOMNode(long nodeId)
-{
- Node* node = 0;
- if (m_domAgent && (node = m_domAgent->nodeForId(nodeId)))
- highlight(node);
-}
-
-void InspectorController::highlightFrame(unsigned long frameId)
-{
- Frame* mainFrame = m_inspectedPage->mainFrame();
- for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext(mainFrame)) {
- if (reinterpret_cast<uintptr_t>(frame) == frameId && frame->ownerElement()) {
- highlight(frame->ownerElement());
- return;
- }
- }
-}
-
-void InspectorController::hideHighlight()
-{
- if (!enabled())
- return;
- m_highlightedNode = 0;
- m_client->hideHighlight();
-}
-
-void InspectorController::mouseDidMoveOverElement(const HitTestResult& result, unsigned)
-{
- if (!enabled() || !searchingForNodeInPage())
- return;
-
- Node* node = result.innerNode();
- while (node && node->nodeType() == Node::TEXT_NODE)
- node = node->parentNode();
- if (node)
- highlight(node);
-}
-
-bool InspectorController::handleMousePress()
-{
- if (!enabled() || !searchingForNodeInPage())
- return false;
-
- if (m_highlightedNode) {
- RefPtr<Node> node = m_highlightedNode;
- setSearchingForNode(false);
- inspect(node.get());
- }
- return true;
-}
-
-void InspectorController::setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient> client)
-{
- ASSERT(!m_inspectorFrontendClient);
- m_inspectorFrontendClient = client;
-}
-
-void InspectorController::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
-{
- if (world != mainThreadNormalWorld())
- return;
-
- // If the page is supposed to serve as InspectorFrontend notify inspetor frontend
- // client that it's cleared so that the client can expose inspector bindings.
- if (m_inspectorFrontendClient && frame == m_inspectedPage->mainFrame())
- m_inspectorFrontendClient->windowObjectCleared();
-
- if (enabled()) {
- if (m_frontend && frame == m_inspectedPage->mainFrame())
- m_injectedScriptHost->discardInjectedScripts();
- if (m_scriptsToEvaluateOnLoad.size()) {
- ScriptState* scriptState = mainWorldScriptState(frame);
- for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin();
- it != m_scriptsToEvaluateOnLoad.end(); ++it) {
- m_injectedScriptHost->injectScript(*it, scriptState);
- }
- }
- }
- if (!m_inspectorExtensionAPI.isEmpty())
- m_injectedScriptHost->injectScript(m_inspectorExtensionAPI, mainWorldScriptState(frame));
-}
-
-void InspectorController::setSearchingForNode(bool enabled)
-{
- if (searchingForNodeInPage() == enabled)
- return;
- m_state->setBoolean(InspectorState::searchingForNode, enabled);
- if (!enabled)
- hideHighlight();
-}
-
-void InspectorController::setSearchingForNode(bool enabled, bool* newState)
-{
- *newState = enabled;
- setSearchingForNode(enabled);
-}
-
-void InspectorController::connectFrontend()
-{
- m_openingFrontend = false;
- releaseFrontendLifetimeAgents();
- m_frontend = new InspectorFrontend(m_client);
- m_domAgent = InspectorDOMAgent::create(m_injectedScriptHost.get(), m_frontend.get());
- m_runtimeAgent = InspectorRuntimeAgent::create(m_injectedScriptHost.get());
- m_cssAgent->setDOMAgent(m_domAgent.get());
-
-#if ENABLE(DATABASE)
- m_databaseAgent = InspectorDatabaseAgent::create(&m_databaseResources, m_frontend.get());
-#endif
-
-#if ENABLE(DOM_STORAGE)
- m_domStorageAgent = InspectorDOMStorageAgent::create(&m_domStorageResources, m_frontend.get());
-#endif
-
- if (m_timelineAgent)
- m_timelineAgent->resetFrontendProxyObject(m_frontend.get());
-
- m_consoleAgent->setFrontend(m_frontend.get());
-
- // Initialize Web Inspector title.
- m_frontend->inspectedURLChanged(inspectedURL().string());
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
- m_applicationCacheAgent = new InspectorApplicationCacheAgent(this, m_frontend.get());
-#endif
-
-#if ENABLE(FILE_SYSTEM)
- m_fileSystemAgent = InspectorFileSystemAgent::create(this, m_frontend.get());
-#endif
-
- if (!InspectorInstrumentation::hasFrontends())
- ScriptController::setCaptureCallStackForUncaughtExceptions(true);
- InspectorInstrumentation::frontendCreated();
-}
-
-void InspectorController::show()
-{
- if (!enabled())
- return;
-
- if (m_openingFrontend)
- return;
-
- if (m_frontend)
- m_frontend->bringToFront();
- else {
- m_openingFrontend = true;
- m_client->openInspectorFrontend(this);
- }
-}
-
-void InspectorController::showPanel(const String& panel)
-{
- if (!enabled())
- return;
-
- show();
-
- if (!m_frontend) {
- m_showAfterVisible = panel;
- return;
- }
- m_frontend->showPanel(panel);
-}
-
-void InspectorController::close()
-{
- if (!m_frontend)
- return;
- m_frontend->disconnectFromBackend();
- disconnectFrontend();
-}
-
-void InspectorController::disconnectFrontend()
-{
- if (!m_frontend)
- return;
-
- m_frontend.clear();
-
- InspectorInstrumentation::frontendDeleted();
- if (!InspectorInstrumentation::hasFrontends())
- ScriptController::setCaptureCallStackForUncaughtExceptions(false);
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- // If the window is being closed with the debugger enabled,
- // remember this state to re-enable debugger on the next window
- // opening.
- bool debuggerWasEnabled = debuggerEnabled();
- disableDebugger();
- m_attachDebuggerWhenShown = debuggerWasEnabled;
-#endif
- setSearchingForNode(false);
- unbindAllResources();
- stopTimelineProfiler();
-
- hideHighlight();
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- m_profilerAgent->setFrontend(0);
- m_profilerAgent->stopUserInitiatedProfiling(true);
-#endif
- m_consoleAgent->setFrontend(0);
-
- releaseFrontendLifetimeAgents();
- m_timelineAgent.clear();
- m_extraHeaders.clear();
-}
-
-InspectorResourceAgent* InspectorController::resourceAgent()
-{
- if (!m_resourceAgent && m_frontend)
- m_resourceAgent = InspectorResourceAgent::create(m_inspectedPage, m_state.get(), m_frontend.get());
- return m_resourceAgent.get();
-}
-
-void InspectorController::releaseFrontendLifetimeAgents()
-{
- m_resourceAgent.clear();
- m_runtimeAgent.clear();
-
- // This should be invoked prior to m_domAgent destruction.
- m_cssAgent->setDOMAgent(0);
-
- // m_domAgent is RefPtr. Remove DOM listeners first to ensure that there are
- // no references to the DOM agent from the DOM tree.
- if (m_domAgent)
- m_domAgent->reset();
- m_domAgent.clear();
-
-#if ENABLE(DATABASE)
- if (m_databaseAgent)
- m_databaseAgent->clearFrontend();
- m_databaseAgent.clear();
-#endif
-
-#if ENABLE(DOM_STORAGE)
- m_domStorageAgent.clear();
-#endif
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
- m_applicationCacheAgent.clear();
-#endif
-
-#if ENABLE(FILE_SYSTEM)
- if (m_fileSystemAgent)
- m_fileSystemAgent->stop();
- m_fileSystemAgent.clear();
-#endif
-}
-
-void InspectorController::populateScriptObjects()
-{
- ASSERT(m_frontend);
- if (!m_frontend)
- return;
-
- if (!m_showAfterVisible.isEmpty()) {
- showPanel(m_showAfterVisible);
- m_showAfterVisible = "";
- }
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (m_profilerAgent->enabled())
- m_frontend->profilerWasEnabled();
-#endif
-
- pushDataCollectedOffline();
-
- if (m_nodeToFocus)
- focusNode();
-
- // Dispatch pending frontend commands
- for (Vector<pair<long, String> >::iterator it = m_pendingEvaluateTestCommands.begin(); it != m_pendingEvaluateTestCommands.end(); ++it)
- m_frontend->evaluateForTestInFrontend((*it).first, (*it).second);
- m_pendingEvaluateTestCommands.clear();
-
- restoreDebugger();
- restoreProfiler(ProfilerRestoreNoAction);
-}
-
-void InspectorController::pushDataCollectedOffline()
-{
- m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
-
-#if ENABLE(DATABASE)
- DatabaseResourcesMap::iterator databasesEnd = m_databaseResources.end();
- for (DatabaseResourcesMap::iterator it = m_databaseResources.begin(); it != databasesEnd; ++it)
- it->second->bind(m_frontend.get());
-#endif
-#if ENABLE(DOM_STORAGE)
- DOMStorageResourcesMap::iterator domStorageEnd = m_domStorageResources.end();
- for (DOMStorageResourcesMap::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it)
- it->second->bind(m_frontend.get());
-#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS)
- WorkersMap::iterator workersEnd = m_workers.end();
- for (WorkersMap::iterator it = m_workers.begin(); it != workersEnd; ++it) {
- InspectorWorkerResource* worker = it->second.get();
- m_frontend->didCreateWorker(worker->id(), worker->url(), worker->isSharedWorker());
- }
-#endif
-}
-
-void InspectorController::restoreDebugger()
-{
- ASSERT(m_frontend);
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (InspectorDebuggerAgent::isDebuggerAlwaysEnabled() || m_attachDebuggerWhenShown || m_settings->getBoolean(InspectorSettings::DebuggerAlwaysEnabled)) {
- enableDebugger(false);
- m_attachDebuggerWhenShown = false;
- }
-#endif
-}
-
-void InspectorController::restoreProfiler(ProfilerRestoreAction action)
-{
- ASSERT(m_frontend);
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- m_profilerAgent->setFrontend(m_frontend.get());
- if (!ScriptProfiler::isProfilerAlwaysEnabled() && m_settings->getBoolean(InspectorSettings::ProfilerAlwaysEnabled))
- enableProfiler();
- if (action == ProfilerRestoreResetAgent)
- m_profilerAgent->resetFrontendProfiles();
-#endif
-}
-
-void InspectorController::unbindAllResources()
-{
-#if ENABLE(DATABASE)
- DatabaseResourcesMap::iterator databasesEnd = m_databaseResources.end();
- for (DatabaseResourcesMap::iterator it = m_databaseResources.begin(); it != databasesEnd; ++it)
- it->second->unbind();
-#endif
-#if ENABLE(DOM_STORAGE)
- DOMStorageResourcesMap::iterator domStorageEnd = m_domStorageResources.end();
- for (DOMStorageResourcesMap::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it)
- it->second->unbind();
-#endif
- if (m_timelineAgent)
- m_timelineAgent->reset();
-}
-
-void InspectorController::didCommitLoad(DocumentLoader* loader)
-{
- if (!enabled())
- return;
-
- if (m_resourceAgent)
- m_resourceAgent->didCommitLoad(loader);
-
- ASSERT(m_inspectedPage);
-
- if (loader->frame() == m_inspectedPage->mainFrame()) {
- if (m_frontend)
- m_frontend->inspectedURLChanged(loader->url().string());
-
- m_injectedScriptHost->discardInjectedScripts();
- m_consoleAgent->reset();
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (m_debuggerAgent) {
- m_debuggerAgent->clearForPageNavigation();
- if (m_browserDebuggerAgent)
- m_browserDebuggerAgent->inspectedURLChanged(inspectedURL());
- }
-#endif
-
-#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
- m_profilerAgent->stopUserInitiatedProfiling(true);
- m_profilerAgent->resetState();
-#endif
-
- // unbindAllResources should be called before database and DOM storage
- // resources are cleared so that it has a chance to unbind them.
- unbindAllResources();
-
- if (m_frontend) {
- m_frontend->reset();
- m_domAgent->reset();
- m_cssAgent->reset();
- }
-#if ENABLE(WORKERS)
- m_workers.clear();
-#endif
-#if ENABLE(DATABASE)
- m_databaseResources.clear();
-#endif
-#if ENABLE(DOM_STORAGE)
- m_domStorageResources.clear();
-#endif
-
- if (m_frontend)
- m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
- }
-}
-
-void InspectorController::mainResourceFiredDOMContentEvent(DocumentLoader* loader, const KURL& url)
-{
- if (!enabled() || !isMainResourceLoader(loader, url))
- return;
-
- if (m_timelineAgent)
- m_timelineAgent->didMarkDOMContentEvent();
- if (m_frontend)
- m_frontend->domContentEventFired(currentTime());
-}
-
-void InspectorController::mainResourceFiredLoadEvent(DocumentLoader* loader, const KURL& url)
-{
- if (!enabled() || !isMainResourceLoader(loader, url))
- return;
-
- if (m_timelineAgent)
- m_timelineAgent->didMarkLoadEvent();
- if (m_frontend)
- m_frontend->loadEventFired(currentTime());
-}
-
-bool InspectorController::isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl)
-{
- return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL();
-}
-
-void InspectorController::willSendRequest(ResourceRequest& request)
-{
- if (!enabled())
- return;
-
- if (m_frontend) {
- // Only enable load timing and raw headers if front-end is attached, as otherwise we may produce overhead.
- request.setReportLoadTiming(true);
- request.setReportRawHeaders(true);
-
- if (m_extraHeaders) {
- HTTPHeaderMap::const_iterator end = m_extraHeaders->end();
- for (HTTPHeaderMap::const_iterator it = m_extraHeaders->begin(); it != end; ++it)
- request.setHTTPHeaderField(it->first, it->second);
- }
- }
-}
-
-void InspectorController::ensureSettingsLoaded()
-{
- if (m_settings)
- return;
- m_settings = new InspectorSettings(m_client);
- m_state->setBoolean(InspectorState::monitoringXHR, m_settings->getBoolean(InspectorSettings::MonitoringXHREnabled));
-}
-
-void InspectorController::startTimelineProfiler()
-{
- if (!enabled())
- return;
-
- if (m_timelineAgent)
- return;
-
- m_timelineAgent = new InspectorTimelineAgent(m_frontend.get());
- if (m_frontend)
- m_frontend->timelineProfilerWasStarted();
-
- m_state->setBoolean(InspectorState::timelineProfilerEnabled, true);
-}
-
-void InspectorController::stopTimelineProfiler()
-{
- if (!enabled())
- return;
-
- if (!m_timelineAgent)
- return;
-
- m_timelineAgent = 0;
- if (m_frontend)
- m_frontend->timelineProfilerWasStopped();
-
- m_state->setBoolean(InspectorState::timelineProfilerEnabled, false);
-}
-
-#if ENABLE(WORKERS)
-class PostWorkerNotificationToFrontendTask : public ScriptExecutionContext::Task {
-public:
- static PassOwnPtr<PostWorkerNotificationToFrontendTask> create(PassRefPtr<InspectorWorkerResource> worker, InspectorController::WorkerAction action)
- {
- return new PostWorkerNotificationToFrontendTask(worker, action);
- }
-
-private:
- PostWorkerNotificationToFrontendTask(PassRefPtr<InspectorWorkerResource> worker, InspectorController::WorkerAction action)
- : m_worker(worker)
- , m_action(action)
- {
- }
-
- virtual void performTask(ScriptExecutionContext* scriptContext)
- {
- if (scriptContext->isDocument()) {
- if (InspectorController* inspector = static_cast<Document*>(scriptContext)->page()->inspectorController())
- inspector->postWorkerNotificationToFrontend(*m_worker, m_action);
- }
- }
-
-private:
- RefPtr<InspectorWorkerResource> m_worker;
- InspectorController::WorkerAction m_action;
-};
-
-void InspectorController::postWorkerNotificationToFrontend(const InspectorWorkerResource& worker, InspectorController::WorkerAction action)
-{
- if (!m_frontend)
- return;
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- switch (action) {
- case InspectorController::WorkerCreated:
- m_frontend->didCreateWorker(worker.id(), worker.url(), worker.isSharedWorker());
- break;
- case InspectorController::WorkerDestroyed:
- m_frontend->didDestroyWorker(worker.id());
- break;
- }
-#endif
-}
-
-void InspectorController::didCreateWorker(intptr_t id, const String& url, bool isSharedWorker)
-{
- if (!enabled())
- return;
-
- RefPtr<InspectorWorkerResource> workerResource(InspectorWorkerResource::create(id, url, isSharedWorker));
- m_workers.set(id, workerResource);
- if (m_inspectedPage && m_frontend)
- m_inspectedPage->mainFrame()->document()->postTask(PostWorkerNotificationToFrontendTask::create(workerResource, InspectorController::WorkerCreated));
-}
-
-void InspectorController::didDestroyWorker(intptr_t id)
-{
- if (!enabled())
- return;
-
- WorkersMap::iterator workerResource = m_workers.find(id);
- if (workerResource == m_workers.end())
- return;
- if (m_inspectedPage && m_frontend)
- m_inspectedPage->mainFrame()->document()->postTask(PostWorkerNotificationToFrontendTask::create(workerResource->second, InspectorController::WorkerDestroyed));
- m_workers.remove(workerResource);
-}
-#endif // ENABLE(WORKERS)
-
-#if ENABLE(DATABASE)
-void InspectorController::didOpenDatabase(PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
-{
- if (!enabled())
- return;
-
- RefPtr<InspectorDatabaseResource> resource = InspectorDatabaseResource::create(database, domain, name, version);
-
- m_databaseResources.set(resource->id(), resource);
-
- // Resources are only bound while visible.
- if (m_frontend)
- resource->bind(m_frontend.get());
-}
-#endif
-
-void InspectorController::getCookies(RefPtr<InspectorArray>* cookies, WTF::String* cookiesString)
-{
- // If we can get raw cookies.
- ListHashSet<Cookie> rawCookiesList;
-
- // If we can't get raw cookies - fall back to String representation
- String stringCookiesList;
-
- // Return value to getRawCookies should be the same for every call because
- // the return value is platform/network backend specific, and the call will
- // always return the same true/false value.
- bool rawCookiesImplemented = false;
-
- for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
- Document* document = frame->document();
- const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
- CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
- for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
- Vector<Cookie> docCookiesList;
- rawCookiesImplemented = getRawCookies(document, KURL(ParsedURLString, it->second->url()), docCookiesList);
-
- if (!rawCookiesImplemented) {
- // FIXME: We need duplication checking for the String representation of cookies.
- ExceptionCode ec = 0;
- stringCookiesList += document->cookie(ec);
- // Exceptions are thrown by cookie() in sandboxed frames. That won't happen here
- // because "document" is the document of the main frame of the page.
- ASSERT(!ec);
- } else {
- int cookiesSize = docCookiesList.size();
- for (int i = 0; i < cookiesSize; i++) {
- if (!rawCookiesList.contains(docCookiesList[i]))
- rawCookiesList.add(docCookiesList[i]);
- }
- }
- }
- }
-
- if (rawCookiesImplemented)
- *cookies = buildArrayForCookies(rawCookiesList);
- else
- *cookiesString = stringCookiesList;
-}
-
-PassRefPtr<InspectorArray> InspectorController::buildArrayForCookies(ListHashSet<Cookie>& cookiesList)
-{
- RefPtr<InspectorArray> cookies = InspectorArray::create();
-
- ListHashSet<Cookie>::iterator end = cookiesList.end();
- ListHashSet<Cookie>::iterator it = cookiesList.begin();
- for (int i = 0; it != end; ++it, i++)
- cookies->pushObject(buildObjectForCookie(*it));
-
- return cookies;
-}
-
-PassRefPtr<InspectorObject> InspectorController::buildObjectForCookie(const Cookie& cookie)
-{
- RefPtr<InspectorObject> value = InspectorObject::create();
- value->setString("name", cookie.name);
- value->setString("value", cookie.value);
- value->setString("domain", cookie.domain);
- value->setString("path", cookie.path);
- value->setNumber("expires", cookie.expires);
- value->setNumber("size", (cookie.name.length() + cookie.value.length()));
- value->setBoolean("httpOnly", cookie.httpOnly);
- value->setBoolean("secure", cookie.secure);
- value->setBoolean("session", cookie.session);
- return value;
-}
-
-void InspectorController::deleteCookie(const String& cookieName, const String& domain)
-{
- for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
- Document* document = frame->document();
- if (document->url().host() != domain)
- continue;
- const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
- CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
- for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it)
- WebCore::deleteCookie(document, KURL(ParsedURLString, it->second->url()), cookieName);
- }
-}
-
-#if ENABLE(DOM_STORAGE)
-void InspectorController::didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame)
-{
- if (!enabled())
- return;
-
- DOMStorageResourcesMap::iterator domStorageEnd = m_domStorageResources.end();
- for (DOMStorageResourcesMap::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it)
- if (it->second->isSameHostAndType(frame, isLocalStorage))
- return;
-
- RefPtr<Storage> domStorage = Storage::create(frame, storageArea);
- RefPtr<InspectorDOMStorageResource> resource = InspectorDOMStorageResource::create(domStorage.get(), isLocalStorage, frame);
-
- m_domStorageResources.set(resource->id(), resource);
-
- // Resources are only bound while visible.
- if (m_frontend)
- resource->bind(m_frontend.get());
-}
-#endif
-
-#if ENABLE(WEB_SOCKETS)
-void InspectorController::didCreateWebSocket(unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
-{
- if (!enabled())
- return;
- ASSERT(m_inspectedPage);
-
- if (m_resourceAgent)
- m_resourceAgent->didCreateWebSocket(identifier, requestURL);
- UNUSED_PARAM(documentURL);
-}
-
-void InspectorController::willSendWebSocketHandshakeRequest(unsigned long identifier, const WebSocketHandshakeRequest& request)
-{
- if (m_resourceAgent)
- m_resourceAgent->willSendWebSocketHandshakeRequest(identifier, request);
-}
-
-void InspectorController::didReceiveWebSocketHandshakeResponse(unsigned long identifier, const WebSocketHandshakeResponse& response)
-{
- if (m_resourceAgent)
- m_resourceAgent->didReceiveWebSocketHandshakeResponse(identifier, response);
-}
-
-void InspectorController::didCloseWebSocket(unsigned long identifier)
-{
- if (m_resourceAgent)
- m_resourceAgent->didCloseWebSocket(identifier);
-}
-#endif // ENABLE(WEB_SOCKETS)
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-bool InspectorController::isRecordingUserInitiatedProfile() const
-{
- return m_profilerAgent->isRecordingUserInitiatedProfile();
-}
-
-void InspectorController::startUserInitiatedProfiling()
-{
- if (!enabled())
- return;
- m_profilerAgent->startUserInitiatedProfiling();
- m_state->setBoolean(InspectorState::userInitiatedProfiling, true);
-}
-
-void InspectorController::stopUserInitiatedProfiling()
-{
- if (!enabled())
- return;
- m_profilerAgent->stopUserInitiatedProfiling();
- m_state->setBoolean(InspectorState::userInitiatedProfiling, false);
-}
-
-bool InspectorController::profilerEnabled() const
-{
- return enabled() && m_profilerAgent->enabled();
-}
-
-void InspectorController::enableProfiler(bool always, bool skipRecompile)
-{
- if (always)
- m_settings->setBoolean(InspectorSettings::ProfilerAlwaysEnabled, true);
- m_profilerAgent->enable(skipRecompile);
-}
-
-void InspectorController::disableProfiler(bool always)
-{
- if (always)
- m_settings->setBoolean(InspectorSettings::ProfilerAlwaysEnabled, false);
- m_profilerAgent->disable();
-}
-#endif
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-void InspectorController::showAndEnableDebugger()
-{
- if (!enabled())
- return;
-
- if (debuggerEnabled())
- return;
-
- if (!m_frontend) {
- m_attachDebuggerWhenShown = true;
- showPanel(ScriptsPanel);
- } else
- enableDebugger(false);
-}
-
-void InspectorController::enableDebugger(bool always)
-{
- ASSERT(!debuggerEnabled());
- if (always)
- m_settings->setBoolean(InspectorSettings::DebuggerAlwaysEnabled, true);
-
- ASSERT(m_inspectedPage);
-
- m_debuggerAgent = InspectorDebuggerAgent::create(this, m_frontend.get());
- m_browserDebuggerAgent = InspectorBrowserDebuggerAgent::create(this);
- m_browserDebuggerAgent->inspectedURLChanged(inspectedURL());
-
- m_frontend->debuggerWasEnabled();
-}
-
-void InspectorController::disableDebugger(bool always)
-{
- if (!enabled())
- return;
-
- if (always)
- m_settings->setBoolean(InspectorSettings::DebuggerAlwaysEnabled, false);
-
- ASSERT(m_inspectedPage);
-
- m_debuggerAgent.clear();
- m_browserDebuggerAgent.clear();
-
- m_attachDebuggerWhenShown = false;
-
- if (m_frontend)
- m_frontend->debuggerWasDisabled();
-}
-
-void InspectorController::resume()
-{
- if (m_debuggerAgent)
- m_debuggerAgent->resume();
-}
-
-void InspectorController::setAllBrowserBreakpoints(PassRefPtr<InspectorObject> breakpoints)
-{
- m_state->setObject(InspectorState::browserBreakpoints, breakpoints);
-}
-#endif
-
-void InspectorController::evaluateForTestInFrontend(long callId, const String& script)
-{
- if (m_frontend)
- m_frontend->evaluateForTestInFrontend(callId, script);
- else
- m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script));
-}
-
-void InspectorController::didEvaluateForTestInFrontend(long callId, const String& jsonResult)
-{
- ScriptState* scriptState = scriptStateFromPage(debuggerWorld(), m_inspectedPage);
- ScriptObject window;
- ScriptGlobalObject::get(scriptState, "window", window);
- ScriptFunctionCall function(window, "didEvaluateForTestInFrontend");
- function.appendArgument(callId);
- function.appendArgument(jsonResult);
- function.call();
-}
-
-static Path quadToPath(const FloatQuad& quad)
-{
- Path quadPath;
- quadPath.moveTo(quad.p1());
- quadPath.addLineTo(quad.p2());
- quadPath.addLineTo(quad.p3());
- quadPath.addLineTo(quad.p4());
- quadPath.closeSubpath();
- return quadPath;
-}
-
-static void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, const Color& fillColor)
-{
- static const int outlineThickness = 2;
- static const Color outlineColor(62, 86, 180, 228);
-
- Path quadPath = quadToPath(quad);
-
- // Clip out the quad, then draw with a 2px stroke to get a pixel
- // of outline (because inflating a quad is hard)
- {
- context.save();
- context.clipOut(quadPath);
-
- context.setStrokeThickness(outlineThickness);
- context.setStrokeColor(outlineColor, ColorSpaceDeviceRGB);
- context.strokePath(quadPath);
-
- context.restore();
- }
-
- // Now do the fill
- context.setFillColor(fillColor, ColorSpaceDeviceRGB);
- context.fillPath(quadPath);
-}
-
-static void drawOutlinedQuadWithClip(GraphicsContext& context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor)
-{
- context.save();
- Path clipQuadPath = quadToPath(clipQuad);
- context.clipOut(clipQuadPath);
- drawOutlinedQuad(context, quad, fillColor);
- context.restore();
-}
-
-static void drawHighlightForBox(GraphicsContext& context, const FloatQuad& contentQuad, const FloatQuad& paddingQuad, const FloatQuad& borderQuad, const FloatQuad& marginQuad)
-{
- static const Color contentBoxColor(125, 173, 217, 128);
- static const Color paddingBoxColor(125, 173, 217, 160);
- static const Color borderBoxColor(125, 173, 217, 192);
- static const Color marginBoxColor(125, 173, 217, 228);
-
- if (marginQuad != borderQuad)
- drawOutlinedQuadWithClip(context, marginQuad, borderQuad, marginBoxColor);
- if (borderQuad != paddingQuad)
- drawOutlinedQuadWithClip(context, borderQuad, paddingQuad, borderBoxColor);
- if (paddingQuad != contentQuad)
- drawOutlinedQuadWithClip(context, paddingQuad, contentQuad, paddingBoxColor);
-
- drawOutlinedQuad(context, contentQuad, contentBoxColor);
-}
-
-static void drawHighlightForLineBoxesOrSVGRenderer(GraphicsContext& context, const Vector<FloatQuad>& lineBoxQuads)
-{
- static const Color lineBoxColor(125, 173, 217, 128);
-
- for (size_t i = 0; i < lineBoxQuads.size(); ++i)
- drawOutlinedQuad(context, lineBoxQuads[i], lineBoxColor);
-}
-
-static inline void convertFromFrameToMainFrame(Frame* frame, IntRect& rect)
-{
- rect = frame->page()->mainFrame()->view()->windowToContents(frame->view()->contentsToWindow(rect));
-}
-
-static inline IntSize frameToMainFrameOffset(Frame* frame)
-{
- IntPoint mainFramePoint = frame->page()->mainFrame()->view()->windowToContents(frame->view()->contentsToWindow(IntPoint()));
- return mainFramePoint - IntPoint();
-}
-
-void InspectorController::drawNodeHighlight(GraphicsContext& context) const
-{
- if (!m_highlightedNode)
- return;
-
- RenderObject* renderer = m_highlightedNode->renderer();
- Frame* containingFrame = m_highlightedNode->document()->frame();
- if (!renderer || !containingFrame)
- return;
-
- IntSize mainFrameOffset = frameToMainFrameOffset(containingFrame);
- IntRect boundingBox = renderer->absoluteBoundingBoxRect(true);
- boundingBox.move(mainFrameOffset);
-
- IntRect titleReferenceBox = boundingBox;
-
- ASSERT(m_inspectedPage);
-
- FrameView* view = m_inspectedPage->mainFrame()->view();
- FloatRect overlayRect = view->visibleContentRect();
- if (!overlayRect.contains(boundingBox) && !boundingBox.contains(enclosingIntRect(overlayRect)))
- overlayRect = view->visibleContentRect();
- context.translate(-overlayRect.x(), -overlayRect.y());
-
- // RenderSVGRoot should be highlighted through the isBox() code path, all other SVG elements should just dump their absoluteQuads().
-#if ENABLE(SVG)
- bool isSVGRenderer = renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVGRoot();
-#else
- bool isSVGRenderer = false;
-#endif
-
- if (renderer->isBox() && !isSVGRenderer) {
- RenderBox* renderBox = toRenderBox(renderer);
-
- IntRect contentBox = renderBox->contentBoxRect();
-
- IntRect paddingBox(contentBox.x() - renderBox->paddingLeft(), contentBox.y() - renderBox->paddingTop(),
- contentBox.width() + renderBox->paddingLeft() + renderBox->paddingRight(), contentBox.height() + renderBox->paddingTop() + renderBox->paddingBottom());
- IntRect borderBox(paddingBox.x() - renderBox->borderLeft(), paddingBox.y() - renderBox->borderTop(),
- paddingBox.width() + renderBox->borderLeft() + renderBox->borderRight(), paddingBox.height() + renderBox->borderTop() + renderBox->borderBottom());
- IntRect marginBox(borderBox.x() - renderBox->marginLeft(), borderBox.y() - renderBox->marginTop(),
- borderBox.width() + renderBox->marginLeft() + renderBox->marginRight(), borderBox.height() + renderBox->marginTop() + renderBox->marginBottom());
-
- titleReferenceBox = marginBox;
- titleReferenceBox.move(mainFrameOffset);
- titleReferenceBox.move(boundingBox.x(), boundingBox.y());
-
- FloatQuad absContentQuad = renderBox->localToAbsoluteQuad(FloatRect(contentBox));
- FloatQuad absPaddingQuad = renderBox->localToAbsoluteQuad(FloatRect(paddingBox));
- FloatQuad absBorderQuad = renderBox->localToAbsoluteQuad(FloatRect(borderBox));
- FloatQuad absMarginQuad = renderBox->localToAbsoluteQuad(FloatRect(marginBox));
-
- absContentQuad.move(mainFrameOffset);
- absPaddingQuad.move(mainFrameOffset);
- absBorderQuad.move(mainFrameOffset);
- absMarginQuad.move(mainFrameOffset);
-
- drawHighlightForBox(context, absContentQuad, absPaddingQuad, absBorderQuad, absMarginQuad);
- } else if (renderer->isRenderInline() || isSVGRenderer) {
- // FIXME: We should show margins/padding/border for inlines.
- Vector<FloatQuad> lineBoxQuads;
- renderer->absoluteQuads(lineBoxQuads);
- for (unsigned i = 0; i < lineBoxQuads.size(); ++i)
- lineBoxQuads[i] += mainFrameOffset;
-
- drawHighlightForLineBoxesOrSVGRenderer(context, lineBoxQuads);
- }
-
- // Draw node title if necessary.
-
- if (!m_highlightedNode->isElementNode())
- return;
-
- WebCore::Settings* settings = containingFrame->settings();
- drawElementTitle(context, titleReferenceBox, overlayRect, settings);
-}
-
-void InspectorController::drawElementTitle(GraphicsContext& context, const IntRect& boundingBox, const FloatRect& overlayRect, WebCore::Settings* settings) const
-{
- static const int rectInflatePx = 4;
- static const int fontHeightPx = 12;
- static const int borderWidthPx = 1;
- static const Color tooltipBackgroundColor(255, 255, 194, 255);
- static const Color tooltipBorderColor(Color::black);
- static const Color tooltipFontColor(Color::black);
-
- Element* element = static_cast<Element*>(m_highlightedNode.get());
- bool isXHTML = element->document()->isXHTMLDocument();
- String nodeTitle = isXHTML ? element->nodeName() : element->nodeName().lower();
- const AtomicString& idValue = element->getIdAttribute();
- if (!idValue.isNull() && !idValue.isEmpty()) {
- nodeTitle += "#";
- nodeTitle += idValue;
- }
- if (element->hasClass() && element->isStyledElement()) {
- const SpaceSplitString& classNamesString = static_cast<StyledElement*>(element)->classNames();
- size_t classNameCount = classNamesString.size();
- if (classNameCount) {
- HashSet<AtomicString> usedClassNames;
- for (size_t i = 0; i < classNameCount; ++i) {
- const AtomicString& className = classNamesString[i];
- if (usedClassNames.contains(className))
- continue;
- usedClassNames.add(className);
- nodeTitle += ".";
- nodeTitle += className;
- }
- }
- }
-
- Element* highlightedElement = m_highlightedNode->isElementNode() ? static_cast<Element*>(m_highlightedNode.get()) : 0;
- nodeTitle += " [";
- nodeTitle += String::number(highlightedElement ? highlightedElement->offsetWidth() : boundingBox.width());
- nodeTitle.append(static_cast<UChar>(0x00D7)); // ×
- nodeTitle += String::number(highlightedElement ? highlightedElement->offsetHeight() : boundingBox.height());
- nodeTitle += "]";
-
- FontDescription desc;
- FontFamily family;
- family.setFamily(settings->fixedFontFamily());
- desc.setFamily(family);
- desc.setComputedSize(fontHeightPx);
- Font font = Font(desc, 0, 0);
- font.update(0);
-
- TextRun nodeTitleRun(nodeTitle);
- IntPoint titleBasePoint = boundingBox.bottomLeft();
- titleBasePoint.move(rectInflatePx, rectInflatePx);
- IntRect titleRect = enclosingIntRect(font.selectionRectForText(nodeTitleRun, titleBasePoint, fontHeightPx));
- titleRect.inflate(rectInflatePx);
-
- // The initial offsets needed to compensate for a 1px-thick border stroke (which is not a part of the rectangle).
- int dx = -borderWidthPx;
- int dy = borderWidthPx;
-
- // If the tip sticks beyond the right of overlayRect, right-align the tip with the said boundary.
- if (titleRect.right() > overlayRect.right())
- dx = overlayRect.right() - titleRect.right();
-
- // If the tip sticks beyond the left of overlayRect, left-align the tip with the said boundary.
- if (titleRect.x() + dx < overlayRect.x())
- dx = overlayRect.x() - titleRect.x() - borderWidthPx;
-
- // If the tip sticks beyond the bottom of overlayRect, show the tip at top of bounding box.
- if (titleRect.bottom() > overlayRect.bottom()) {
- dy = boundingBox.y() - titleRect.bottom() - borderWidthPx;
- // If the tip still sticks beyond the bottom of overlayRect, bottom-align the tip with the said boundary.
- if (titleRect.bottom() + dy > overlayRect.bottom())
- dy = overlayRect.bottom() - titleRect.bottom();
- }
-
- // If the tip sticks beyond the top of overlayRect, show the tip at top of overlayRect.
- if (titleRect.y() + dy < overlayRect.y())
- dy = overlayRect.y() - titleRect.y() + borderWidthPx;
-
- titleRect.move(dx, dy);
- context.setStrokeColor(tooltipBorderColor, ColorSpaceDeviceRGB);
- context.setStrokeThickness(borderWidthPx);
- context.setFillColor(tooltipBackgroundColor, ColorSpaceDeviceRGB);
- context.drawRect(titleRect);
- context.setFillColor(tooltipFontColor, ColorSpaceDeviceRGB);
- context.drawText(font, nodeTitleRun, IntPoint(titleRect.x() + rectInflatePx, titleRect.y() + font.fontMetrics().height()));
-}
-
-void InspectorController::openInInspectedWindow(const String& url)
-{
- Frame* mainFrame = m_inspectedPage->mainFrame();
-
- FrameLoadRequest request(mainFrame->document()->securityOrigin(), ResourceRequest(), "_blank");
-
- bool created;
- WindowFeatures windowFeatures;
- Frame* newFrame = WebCore::createWindow(mainFrame, mainFrame, request, windowFeatures, created);
- if (!newFrame)
- return;
-
- UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
- newFrame->loader()->setOpener(mainFrame);
- newFrame->page()->setOpenedByDOM();
- newFrame->loader()->changeLocation(mainFrame->document()->securityOrigin(), newFrame->loader()->completeURL(url), "", false, false);
-}
-
-void InspectorController::addScriptToEvaluateOnLoad(const String& source)
-{
- m_scriptsToEvaluateOnLoad.append(source);
-}
-
-void InspectorController::removeAllScriptsToEvaluateOnLoad()
-{
- m_scriptsToEvaluateOnLoad.clear();
-}
-
-void InspectorController::setInspectorExtensionAPI(const String& source)
-{
- m_inspectorExtensionAPI = source;
-}
-
-KURL InspectorController::inspectedURL() const
-{
- return m_inspectedPage->mainFrame()->loader()->url();
-}
-
-void InspectorController::reloadPage()
-{
- // FIXME: Why do we set the user gesture indicator here?
- UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
- m_inspectedPage->mainFrame()->navigationScheduler()->scheduleRefresh();
-}
-
-void InspectorController::setExtraHeaders(PassRefPtr<InspectorObject> headers)
+// FIXME: temporary solution. It will become a separate class in the next patch and Controller related subset of functions will be moved from InspectorAgent to InspectorControler.
+InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient)
+ : InspectorAgent(this, page, inspectorClient)
{
- m_extraHeaders = adoptPtr(new HTTPHeaderMap());
- InspectorObject::const_iterator end = headers->end();
- for (InspectorObject::const_iterator it = headers->begin(); it != end; ++it) {
- String value;
- if (!it->second->asString(&value))
- continue;
- m_extraHeaders->add(it->first, value);
- }
}
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h
index 90a0300..42e9615 100644
--- a/Source/WebCore/inspector/InspectorController.h
+++ b/Source/WebCore/inspector/InspectorController.h
@@ -1,365 +1,49 @@
/*
- * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * modification, are permitted provided that the following conditions are
+ * met:
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef InspectorController_h
#define InspectorController_h
-#include "CharacterData.h"
-#include "Console.h"
-#include "Cookie.h"
-#include "Page.h"
-#include "PlatformString.h"
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/ListHashSet.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-#include <wtf/text/StringHash.h>
+#include "InspectorAgent.h"
namespace WebCore {
-class CachedResource;
-class CharacterData;
-class Database;
-class DOMWrapperWorld;
-class Document;
-class DocumentLoader;
-class FloatRect;
-class GraphicsContext;
-class HTTPHeaderMap;
-class HitTestResult;
-class InjectedScript;
-class InjectedScriptHost;
-class InspectorArray;
-class InspectorBackendDispatcher;
-class InspectorBrowserDebuggerAgent;
class InspectorClient;
-class InspectorConsoleAgent;
-class InspectorCSSAgent;
-class InspectorDOMAgent;
-class InspectorDOMStorageAgent;
-class InspectorDOMStorageResource;
-class InspectorDatabaseAgent;
-class InspectorDatabaseResource;
-class InspectorDebuggerAgent;
-class InspectorFrontend;
-class InspectorFrontendClient;
-class InspectorObject;
-class InspectorProfilerAgent;
-class InspectorResourceAgent;
-class InspectorRuntimeAgent;
-class InspectorSettings;
-class InspectorState;
-class InspectorStorageAgent;
-class InspectorTimelineAgent;
-class InspectorValue;
-class InspectorWorkerResource;
-class IntRect;
-class KURL;
-class Node;
class Page;
-class ResourceRequest;
-class ResourceResponse;
-class ResourceError;
-class ScriptArguments;
-class ScriptCallStack;
-class ScriptProfile;
-class SharedBuffer;
-class StorageArea;
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-class InspectorApplicationCacheAgent;
-#endif
-
-#if ENABLE(FILE_SYSTEM)
-class InspectorFileSystemAgent;
-#endif
-
-#if ENABLE(WEB_SOCKETS)
-class WebSocketHandshakeRequest;
-class WebSocketHandshakeResponse;
-#endif
-
-class InspectorController {
- WTF_MAKE_NONCOPYABLE(InspectorController); WTF_MAKE_FAST_ALLOCATED;
+// FIXME: temporary solution. It will become a separate class in the next patch and controller related subset of functions will be moved from InspectorAgent to InspectorControler.
+class InspectorController : public InspectorAgent {
public:
- static const char* const ConsolePanel;
- static const char* const ElementsPanel;
- static const char* const ProfilesPanel;
- static const char* const ScriptsPanel;
-
InspectorController(Page*, InspectorClient*);
- ~InspectorController();
-
- InspectorBackendDispatcher* inspectorBackendDispatcher() { return m_inspectorBackendDispatcher.get(); }
- InspectorClient* inspectorClient() { return m_client; }
- InjectedScriptHost* injectedScriptHost() { return m_injectedScriptHost.get(); }
-
- void inspectedPageDestroyed();
-
- bool enabled() const;
-
- Page* inspectedPage() const { return m_inspectedPage; }
- KURL inspectedURL() const;
- void reloadPage();
-
- void restoreInspectorStateFromCookie(const String& inspectorCookie);
-
- void inspect(Node*);
- void highlight(Node*);
- void hideHighlight();
- void highlightDOMNode(long nodeId);
- void hideDOMNodeHighlight() { hideHighlight(); }
-
- void highlightFrame(unsigned long frameId);
- void hideFrameHighlight() { hideHighlight(); }
-
- void show();
- void showPanel(const String&);
- void close();
-
- void connectFrontend();
- void reuseFrontend();
- void disconnectFrontend();
- InspectorFrontend* frontend() const { return m_frontend.get(); }
-
- InspectorResourceAgent* resourceAgent();
-
- InspectorController* inspectorAgent() { return this; }
- InspectorConsoleAgent* consoleAgent() { return m_consoleAgent.get(); }
- InspectorCSSAgent* cssAgent() { return m_cssAgent.get(); }
- InspectorDOMAgent* domAgent() { return m_domAgent.get(); }
- InjectedScriptHost* injectedScriptAgent() { return m_injectedScriptHost.get(); }
- InspectorRuntimeAgent* runtimeAgent() { return m_runtimeAgent.get(); }
- InspectorTimelineAgent* timelineAgent() { return m_timelineAgent.get(); }
-#if ENABLE(DATABASE)
- InspectorDatabaseAgent* databaseAgent() { return m_databaseAgent.get(); }
-#endif
-#if ENABLE(DOM_STORAGE)
- InspectorDOMStorageAgent* domStorageAgent() { return m_domStorageAgent.get(); }
-#endif
-#if ENABLE(FILE_SYSTEM)
- InspectorFileSystemAgent* fileSystemAgent() { return m_fileSystemAgent.get(); }
-#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- InspectorBrowserDebuggerAgent* browserDebuggerAgent() const { return m_browserDebuggerAgent.get(); }
- InspectorDebuggerAgent* debuggerAgent() const { return m_debuggerAgent.get(); }
- InspectorProfilerAgent* profilerAgent() const { return m_profilerAgent.get(); }
-#endif
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
- InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); }
-#endif
-
-
- bool searchingForNodeInPage() const;
- void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
- bool handleMousePress();
-
- void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient> client);
- bool hasInspectorFrontendClient() const { return m_inspectorFrontendClient; }
-
- void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
-
- void didCommitLoad(DocumentLoader*);
-
- void setExtraHeaders(PassRefPtr<InspectorObject>);
-
- void startTimelineProfiler();
- void stopTimelineProfiler();
-
- void getCookies(RefPtr<InspectorArray>* cookies, WTF::String* cookiesString);
- void deleteCookie(const String& cookieName, const String& domain);
-
- void mainResourceFiredLoadEvent(DocumentLoader*, const KURL&);
- void mainResourceFiredDOMContentEvent(DocumentLoader*, const KURL&);
-
-#if ENABLE(WORKERS)
- enum WorkerAction { WorkerCreated, WorkerDestroyed };
-
- void postWorkerNotificationToFrontend(const InspectorWorkerResource&, WorkerAction);
- void didCreateWorker(intptr_t, const String& url, bool isSharedWorker);
- void didDestroyWorker(intptr_t);
-#endif
-
-#if ENABLE(DATABASE)
- void didOpenDatabase(PassRefPtr<Database>, const String& domain, const String& name, const String& version);
-#endif
-
-#if ENABLE(DOM_STORAGE)
- void didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame);
-#endif
-
-#if ENABLE(WEB_SOCKETS)
- void didCreateWebSocket(unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
- void willSendWebSocketHandshakeRequest(unsigned long identifier, const WebSocketHandshakeRequest&);
- void didReceiveWebSocketHandshakeResponse(unsigned long identifier, const WebSocketHandshakeResponse&);
- void didCloseWebSocket(unsigned long identifier);
-#endif
-
- bool hasFrontend() const { return m_frontend; }
-
- void drawNodeHighlight(GraphicsContext&) const;
- void openInInspectedWindow(const String& url);
- void drawElementTitle(GraphicsContext&, const IntRect& boundingBox, const FloatRect& overlayRect, WebCore::Settings*) const;
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- bool isRecordingUserInitiatedProfile() const;
- void startProfiling() { startUserInitiatedProfiling(); }
- void startUserInitiatedProfiling();
- void stopProfiling() { stopUserInitiatedProfiling(); }
- void stopUserInitiatedProfiling();
- void enableProfiler(bool always = false, bool skipRecompile = false);
- void disableProfiler(bool always = false);
- bool profilerEnabled() const;
-
- void showAndEnableDebugger();
- void enableDebugger(bool always);
- void disableDebugger(bool always = false);
- bool debuggerEnabled() const { return m_debuggerAgent; }
- void resume();
-
- void setAllBrowserBreakpoints(PassRefPtr<InspectorObject>);
-#endif
-
- // Generic code called from custom implementations.
- void evaluateForTestInFrontend(long testCallId, const String& script);
-
- void addScriptToEvaluateOnLoad(const String& source);
- void removeAllScriptsToEvaluateOnLoad();
- void setInspectorExtensionAPI(const String& source);
-
- bool inspectorStartsAttached();
- void setInspectorStartsAttached(bool);
- void setInspectorAttachedHeight(long height);
- long inspectorAttachedHeight() const;
-
- InspectorState* state() { return m_state.get(); }
- InspectorSettings* settings() { return m_settings.get(); }
-
- // InspectorAgent API
- void getInspectorState(RefPtr<InspectorObject>* state);
- void setMonitoringXHREnabled(bool enabled, bool* newState);
- void populateScriptObjects();
- // Following are used from InspectorBackend and internally.
- void setSearchingForNode(bool enabled, bool* newState);
- void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
-
- // InspectorInstrumentation API
- void ensureSettingsLoaded();
- void willSendRequest(ResourceRequest&);
-
-private:
- void pushDataCollectedOffline();
- void restoreDebugger();
- enum ProfilerRestoreAction {
- ProfilerRestoreNoAction = 0,
- ProfilerRestoreResetAgent = 1
- };
- void restoreProfiler(ProfilerRestoreAction action);
- void unbindAllResources();
- void setSearchingForNode(bool enabled);
-
- void releaseFrontendLifetimeAgents();
-
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- void toggleRecordButton(bool);
-#endif
-
- PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie&);
- PassRefPtr<InspectorArray> buildArrayForCookies(ListHashSet<Cookie>&);
-
- void focusNode();
- bool isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl);
-
- Page* m_inspectedPage;
- InspectorClient* m_client;
- OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
- bool m_openingFrontend;
- OwnPtr<InspectorFrontend> m_frontend;
- OwnPtr<InspectorCSSAgent> m_cssAgent;
- RefPtr<InspectorDOMAgent> m_domAgent;
-
-#if ENABLE(DATABASE)
- RefPtr<InspectorDatabaseAgent> m_databaseAgent;
-#endif
-
-#if ENABLE(DOM_STORAGE)
- RefPtr<InspectorDOMStorageAgent> m_domStorageAgent;
-#endif
-
- OwnPtr<InspectorTimelineAgent> m_timelineAgent;
- OwnPtr<InspectorState> m_state;
- OwnPtr<InspectorSettings> m_settings;
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
- OwnPtr<InspectorApplicationCacheAgent> m_applicationCacheAgent;
-#endif
-
-#if ENABLE(FILE_SYSTEM)
- RefPtr<InspectorFileSystemAgent> m_fileSystemAgent;
-#endif
-
- RefPtr<Node> m_nodeToFocus;
- RefPtr<InspectorResourceAgent> m_resourceAgent;
- OwnPtr<InspectorRuntimeAgent> m_runtimeAgent;
-
-#if ENABLE(DATABASE)
- typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
- DatabaseResourcesMap m_databaseResources;
-#endif
-#if ENABLE(DOM_STORAGE)
- typedef HashMap<int, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
- DOMStorageResourcesMap m_domStorageResources;
-#endif
-
- String m_showAfterVisible;
- RefPtr<Node> m_highlightedNode;
- OwnPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
- RefPtr<InjectedScriptHost> m_injectedScriptHost;
- OwnPtr<InspectorConsoleAgent> m_consoleAgent;
-
- Vector<pair<long, String> > m_pendingEvaluateTestCommands;
- Vector<String> m_scriptsToEvaluateOnLoad;
- String m_inspectorExtensionAPI;
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- bool m_attachDebuggerWhenShown;
- OwnPtr<InspectorDebuggerAgent> m_debuggerAgent;
- OwnPtr<InspectorBrowserDebuggerAgent> m_browserDebuggerAgent;
- OwnPtr<InspectorProfilerAgent> m_profilerAgent;
-#endif
- OwnPtr<HTTPHeaderMap> m_extraHeaders;
-#if ENABLE(WORKERS)
- typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap;
-
- WorkersMap m_workers;
-#endif
};
-} // namespace WebCore
+}
#endif // !defined(InspectorController_h)
diff --git a/Source/WebCore/inspector/InspectorDatabaseAgent.cpp b/Source/WebCore/inspector/InspectorDatabaseAgent.cpp
index 36bcab8..385400f 100644
--- a/Source/WebCore/inspector/InspectorDatabaseAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDatabaseAgent.cpp
@@ -34,7 +34,7 @@
#include "Database.h"
#include "ExceptionCode.h"
-#include "InspectorController.h"
+#include "InspectorAgent.h"
#include "InspectorDatabaseResource.h"
#include "InspectorFrontend.h"
#include "InspectorValues.h"
diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
index acfbb6e..2ffaa83 100644
--- a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
@@ -40,18 +40,18 @@
namespace WebCore {
-PassOwnPtr<InspectorDebuggerAgent> InspectorDebuggerAgent::create(InspectorController* inspectorController, InspectorFrontend* frontend)
+PassOwnPtr<InspectorDebuggerAgent> InspectorDebuggerAgent::create(InspectorAgent* inspectorAgent, InspectorFrontend* frontend)
{
- OwnPtr<InspectorDebuggerAgent> agent = adoptPtr(new InspectorDebuggerAgent(inspectorController, frontend));
+ OwnPtr<InspectorDebuggerAgent> agent = adoptPtr(new InspectorDebuggerAgent(inspectorAgent, frontend));
ScriptDebugServer::shared().clearBreakpoints();
// FIXME(WK44513): breakpoints activated flag should be synchronized between all front-ends
ScriptDebugServer::shared().setBreakpointsActivated(true);
- ScriptDebugServer::shared().addListener(agent.get(), inspectorController->inspectedPage());
+ ScriptDebugServer::shared().addListener(agent.get(), inspectorAgent->inspectedPage());
return agent.release();
}
-InspectorDebuggerAgent::InspectorDebuggerAgent(InspectorController* inspectorController, InspectorFrontend* frontend)
- : m_inspectorController(inspectorController)
+InspectorDebuggerAgent::InspectorDebuggerAgent(InspectorAgent* inspectorAgent, InspectorFrontend* frontend)
+ : m_inspectorAgent(inspectorAgent)
, m_frontend(frontend)
, m_pausedScriptState(0)
, m_javaScriptPauseScheduled(false)
@@ -60,7 +60,7 @@ InspectorDebuggerAgent::InspectorDebuggerAgent(InspectorController* inspectorCon
InspectorDebuggerAgent::~InspectorDebuggerAgent()
{
- ScriptDebugServer::shared().removeListener(this, m_inspectorController->inspectedPage());
+ ScriptDebugServer::shared().removeListener(this, m_inspectorAgent->inspectedPage());
m_pausedScriptState = 0;
}
@@ -175,14 +175,14 @@ void InspectorDebuggerAgent::setPauseOnExceptionsState(long pauseState, long* ne
void InspectorDebuggerAgent::evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result)
{
- InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptForObjectId(callFrameId.get());
+ InjectedScript injectedScript = m_inspectorAgent->injectedScriptHost()->injectedScriptForObjectId(callFrameId.get());
if (!injectedScript.hasNoValue())
injectedScript.evaluateOnCallFrame(callFrameId, expression, objectGroup, result);
}
void InspectorDebuggerAgent::getCompletionsOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeInspectorCommandLineAPI, RefPtr<InspectorValue>* result)
{
- InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptForObjectId(callFrameId.get());
+ InjectedScript injectedScript = m_inspectorAgent->injectedScriptHost()->injectedScriptForObjectId(callFrameId.get());
if (!injectedScript.hasNoValue())
injectedScript.getCompletionsOnCallFrame(callFrameId, expression, includeInspectorCommandLineAPI, result);
}
@@ -198,7 +198,7 @@ PassRefPtr<InspectorValue> InspectorDebuggerAgent::currentCallFrames()
{
if (!m_pausedScriptState)
return InspectorValue::null();
- InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(m_pausedScriptState);
+ InjectedScript injectedScript = m_inspectorAgent->injectedScriptHost()->injectedScriptFor(m_pausedScriptState);
if (injectedScript.hasNoValue()) {
ASSERT_NOT_REACHED();
return InspectorValue::null();
diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.h b/Source/WebCore/inspector/InspectorDebuggerAgent.h
index 4cb9f9c..c16b38f 100644
--- a/Source/WebCore/inspector/InspectorDebuggerAgent.h
+++ b/Source/WebCore/inspector/InspectorDebuggerAgent.h
@@ -42,7 +42,7 @@
namespace WebCore {
class InjectedScriptHost;
-class InspectorController;
+class InspectorAgent;
class InspectorFrontend;
class InspectorObject;
class InspectorValue;
@@ -56,7 +56,7 @@ enum DebuggerEventType {
class InspectorDebuggerAgent : public ScriptDebugListener {
WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent); WTF_MAKE_FAST_ALLOCATED;
public:
- static PassOwnPtr<InspectorDebuggerAgent> create(InspectorController*, InspectorFrontend*);
+ static PassOwnPtr<InspectorDebuggerAgent> create(InspectorAgent*, InspectorFrontend*);
virtual ~InspectorDebuggerAgent();
static bool isDebuggerAlwaysEnabled();
@@ -84,7 +84,7 @@ public:
void clearForPageNavigation();
private:
- InspectorDebuggerAgent(InspectorController*, InspectorFrontend*);
+ InspectorDebuggerAgent(InspectorAgent*, InspectorFrontend*);
PassRefPtr<InspectorValue> currentCallFrames();
@@ -95,7 +95,7 @@ private:
void restoreBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition, bool enabled);
- InspectorController* m_inspectorController;
+ InspectorAgent* m_inspectorAgent;
InspectorFrontend* m_frontend;
ScriptState* m_pausedScriptState;
HashMap<String, String> m_scriptIDToContent;
diff --git a/Source/WebCore/inspector/InspectorFileSystemAgent.cpp b/Source/WebCore/inspector/InspectorFileSystemAgent.cpp
index 2a0df3c..467c97a 100644
--- a/Source/WebCore/inspector/InspectorFileSystemAgent.cpp
+++ b/Source/WebCore/inspector/InspectorFileSystemAgent.cpp
@@ -39,7 +39,7 @@
#include "FileSystemCallbacks.h"
#include "Frame.h"
#include "FrameTree.h"
-#include "InspectorController.h"
+#include "InspectorAgent.h"
#include "InspectorFrontend.h"
#include "LocalFileSystem.h"
#include "NotImplemented.h"
@@ -69,7 +69,7 @@ public:
void didOpenFileSystem(const String&, PassOwnPtr<AsyncFileSystem> fileSystem)
{
- // Agent will be alive even if InspectorController is destroyed until callback is run.
+ // Agent will be alive even if InspectorAgent is destroyed until callback is run.
m_agent->didGetFileSystemPath(fileSystem->root(), m_type, m_origin);
}
@@ -105,8 +105,8 @@ private:
String m_origin;
};
-InspectorFileSystemAgent::InspectorFileSystemAgent(InspectorController* inspectorController, InspectorFrontend* frontend)
- : m_inspectorController(inspectorController)
+InspectorFileSystemAgent::InspectorFileSystemAgent(InspectorAgent* inspectorAgent, InspectorFrontend* frontend)
+ : m_inspectorAgent(inspectorAgent)
, m_frontend(frontend)
{
}
@@ -115,7 +115,7 @@ InspectorFileSystemAgent::~InspectorFileSystemAgent() { }
void InspectorFileSystemAgent::stop()
{
- m_inspectorController = 0;
+ m_inspectorAgent = 0;
}
#if PLATFORM(CHROMIUM)
@@ -139,7 +139,7 @@ void InspectorFileSystemAgent::getFileSystemPathAsync(unsigned int type, const S
}
AsyncFileSystem::Type asyncFileSystemType = static_cast<AsyncFileSystem::Type>(type);
- Frame* mainFrame = m_inspectorController->inspectedPage()->mainFrame();
+ Frame* mainFrame = m_inspectorAgent->inspectedPage()->mainFrame();
for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) {
Document* document = frame->document();
if (document && document->securityOrigin()->toString() == origin) {
@@ -151,8 +151,8 @@ void InspectorFileSystemAgent::getFileSystemPathAsync(unsigned int type, const S
void InspectorFileSystemAgent::didGetFileSystemPath(const String& root, AsyncFileSystem::Type type, const String& origin)
{
- // When controller is being destroyed, this is set to 0. Agent can live even after m_inspectorController is destroyed.
- if (!m_inspectorController)
+ // When controller is being destroyed, this is set to 0. Agent can live even after m_inspectorAgent is destroyed.
+ if (!m_inspectorAgent)
return;
m_frontend->didGetFileSystemPath(root, static_cast<unsigned int>(type), origin);
@@ -160,8 +160,8 @@ void InspectorFileSystemAgent::didGetFileSystemPath(const String& root, AsyncFil
void InspectorFileSystemAgent::didGetFileSystemError(AsyncFileSystem::Type type, const String& origin)
{
- // When controller is being destroyed, this is set to 0. Agent can live even after m_inspectorController is destroyed.
- if (!m_inspectorController)
+ // When controller is being destroyed, this is set to 0. Agent can live even after m_inspectorAgent is destroyed.
+ if (!m_inspectorAgent)
return;
m_frontend->didGetFileSystemError(static_cast<unsigned int>(type), origin);
}
diff --git a/Source/WebCore/inspector/InspectorFileSystemAgent.h b/Source/WebCore/inspector/InspectorFileSystemAgent.h
index a85ad0f..b995d70 100644
--- a/Source/WebCore/inspector/InspectorFileSystemAgent.h
+++ b/Source/WebCore/inspector/InspectorFileSystemAgent.h
@@ -40,15 +40,15 @@
namespace WebCore {
class Document;
-class InspectorController;
+class InspectorAgent;
class InspectorFrontend;
class LocalFileSystem;
class InspectorFileSystemAgent : public RefCounted<InspectorFileSystemAgent> {
public:
- static PassRefPtr<InspectorFileSystemAgent> create(InspectorController* inspectorController, InspectorFrontend* frontend)
+ static PassRefPtr<InspectorFileSystemAgent> create(InspectorAgent* inspectorAgent, InspectorFrontend* frontend)
{
- return adoptRef(new InspectorFileSystemAgent(inspectorController, frontend));
+ return adoptRef(new InspectorFileSystemAgent(inspectorAgent, frontend));
}
~InspectorFileSystemAgent();
@@ -64,10 +64,10 @@ public:
void didGetFileSystemDisabled();
private:
- InspectorFileSystemAgent(InspectorController*, InspectorFrontend*);
+ InspectorFileSystemAgent(InspectorAgent*, InspectorFrontend*);
void getFileSystemRoot(AsyncFileSystem::Type);
- InspectorController* m_inspectorController;
+ InspectorAgent* m_inspectorAgent;
InspectorFrontend* m_frontend;
};
diff --git a/Source/WebCore/inspector/InspectorFrontendHost.cpp b/Source/WebCore/inspector/InspectorFrontendHost.cpp
index 342af0f..1796256 100644
--- a/Source/WebCore/inspector/InspectorFrontendHost.cpp
+++ b/Source/WebCore/inspector/InspectorFrontendHost.cpp
@@ -41,6 +41,7 @@
#include "FrameLoader.h"
#include "HitTestResult.h"
#include "HTMLFrameOwnerElement.h"
+#include "InspectorAgent.h"
#include "InspectorController.h"
#include "InspectorFrontendClient.h"
#include "Page.h"
@@ -200,7 +201,7 @@ void InspectorFrontendHost::moveWindowBy(float x, float y) const
void InspectorFrontendHost::setExtensionAPI(const String& script)
{
- InspectorController* inspector = m_frontendPage->inspectorController();
+ InspectorAgent* inspector = m_frontendPage->inspectorController();
inspector->setInspectorExtensionAPI(script);
}
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp
index 9ae97be..66951ec 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp
+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp
@@ -38,10 +38,10 @@
#include "DocumentLoader.h"
#include "Event.h"
#include "EventContext.h"
+#include "InspectorAgent.h"
#include "InspectorApplicationCacheAgent.h"
#include "InspectorBrowserDebuggerAgent.h"
#include "InspectorConsoleAgent.h"
-#include "InspectorController.h"
#include "InspectorDOMAgent.h"
#include "InspectorDebuggerAgent.h"
#include "InspectorProfilerAgent.h"
@@ -61,6 +61,7 @@ static const char* const setTimerEventName = "setTimer";
static const char* const clearTimerEventName = "clearTimer";
static const char* const timerFiredEventName = "timerFired";
+HashMap<Page*, InspectorAgent*> InspectorInstrumentation::s_inspectorAgents;
int InspectorInstrumentation::s_frontendCounter = 0;
static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
@@ -80,119 +81,119 @@ static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window,
return false;
}
-void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InspectorController* inspectorController, Frame* frame, DOMWrapperWorld* world)
+void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InspectorAgent* inspectorAgent, Frame* frame, DOMWrapperWorld* world)
{
- inspectorController->didClearWindowObjectInWorld(frame, world);
+ inspectorAgent->didClearWindowObjectInWorld(frame, world);
}
-void InspectorInstrumentation::inspectedPageDestroyedImpl(InspectorController* inspectorController)
+void InspectorInstrumentation::inspectedPageDestroyedImpl(InspectorAgent* inspectorAgent)
{
- inspectorController->inspectedPageDestroyed();
+ inspectorAgent->inspectedPageDestroyed();
}
-void InspectorInstrumentation::willInsertDOMNodeImpl(InspectorController* inspectorController, Node* node, Node* parent)
+void InspectorInstrumentation::willInsertDOMNodeImpl(InspectorAgent* inspectorAgent, Node* node, Node* parent)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
+ if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorAgent->browserDebuggerAgent())
browserDebuggerAgent->willInsertDOMNode(node, parent);
#endif
}
-void InspectorInstrumentation::didInsertDOMNodeImpl(InspectorController* inspectorController, Node* node)
+void InspectorInstrumentation::didInsertDOMNodeImpl(InspectorAgent* inspectorAgent, Node* node)
{
- if (InspectorDOMAgent* domAgent = inspectorController->domAgent())
+ if (InspectorDOMAgent* domAgent = inspectorAgent->domAgent())
domAgent->didInsertDOMNode(node);
#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
+ if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorAgent->browserDebuggerAgent())
browserDebuggerAgent->didInsertDOMNode(node);
#endif
}
-void InspectorInstrumentation::willRemoveDOMNodeImpl(InspectorController* inspectorController, Node* node)
+void InspectorInstrumentation::willRemoveDOMNodeImpl(InspectorAgent* inspectorAgent, Node* node)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
+ if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorAgent->browserDebuggerAgent())
browserDebuggerAgent->willRemoveDOMNode(node);
#endif
}
-void InspectorInstrumentation::didRemoveDOMNodeImpl(InspectorController* inspectorController, Node* node)
+void InspectorInstrumentation::didRemoveDOMNodeImpl(InspectorAgent* inspectorAgent, Node* node)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
+ if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorAgent->browserDebuggerAgent())
browserDebuggerAgent->didRemoveDOMNode(node);
#endif
- if (InspectorDOMAgent* domAgent = inspectorController->domAgent())
+ if (InspectorDOMAgent* domAgent = inspectorAgent->domAgent())
domAgent->didRemoveDOMNode(node);
}
-void InspectorInstrumentation::willModifyDOMAttrImpl(InspectorController* inspectorController, Element* element)
+void InspectorInstrumentation::willModifyDOMAttrImpl(InspectorAgent* inspectorAgent, Element* element)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
+ if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorAgent->browserDebuggerAgent())
browserDebuggerAgent->willModifyDOMAttr(element);
#endif
}
-void InspectorInstrumentation::didModifyDOMAttrImpl(InspectorController* inspectorController, Element* element)
+void InspectorInstrumentation::didModifyDOMAttrImpl(InspectorAgent* inspectorAgent, Element* element)
{
- if (InspectorDOMAgent* domAgent = inspectorController->domAgent())
+ if (InspectorDOMAgent* domAgent = inspectorAgent->domAgent())
domAgent->didModifyDOMAttr(element);
}
-void InspectorInstrumentation::mouseDidMoveOverElementImpl(InspectorController* inspectorController, const HitTestResult& result, unsigned modifierFlags)
+void InspectorInstrumentation::mouseDidMoveOverElementImpl(InspectorAgent* inspectorAgent, const HitTestResult& result, unsigned modifierFlags)
{
- inspectorController->mouseDidMoveOverElement(result, modifierFlags);
+ inspectorAgent->mouseDidMoveOverElement(result, modifierFlags);
}
-bool InspectorInstrumentation::handleMousePressImpl(InspectorController* inspectorController)
+bool InspectorInstrumentation::handleMousePressImpl(InspectorAgent* inspectorAgent)
{
- return inspectorController->handleMousePress();
+ return inspectorAgent->handleMousePress();
}
-void InspectorInstrumentation::characterDataModifiedImpl(InspectorController* inspectorController, CharacterData* characterData)
+void InspectorInstrumentation::characterDataModifiedImpl(InspectorAgent* inspectorAgent, CharacterData* characterData)
{
- if (InspectorDOMAgent* domAgent = inspectorController->domAgent())
+ if (InspectorDOMAgent* domAgent = inspectorAgent->domAgent())
domAgent->characterDataModified(characterData);
}
-void InspectorInstrumentation::willSendXMLHttpRequestImpl(InspectorController* inspectorController, const String& url)
+void InspectorInstrumentation::willSendXMLHttpRequestImpl(InspectorAgent* inspectorAgent, const String& url)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
+ if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorAgent->browserDebuggerAgent())
browserDebuggerAgent->willSendXMLHttpRequest(url);
#endif
}
-void InspectorInstrumentation::didScheduleResourceRequestImpl(InspectorController* inspectorController, const String& url)
+void InspectorInstrumentation::didScheduleResourceRequestImpl(InspectorAgent* inspectorAgent, const String& url)
{
- if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController))
+ if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent))
timelineAgent->didScheduleResourceRequest(url);
}
-void InspectorInstrumentation::didInstallTimerImpl(InspectorController* inspectorController, int timerId, int timeout, bool singleShot)
+void InspectorInstrumentation::didInstallTimerImpl(InspectorAgent* inspectorAgent, int timerId, int timeout, bool singleShot)
{
- pauseOnNativeEventIfNeeded(inspectorController, instrumentationEventCategoryType, setTimerEventName, true);
- if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController))
+ pauseOnNativeEventIfNeeded(inspectorAgent, instrumentationEventCategoryType, setTimerEventName, true);
+ if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent))
timelineAgent->didInstallTimer(timerId, timeout, singleShot);
}
-void InspectorInstrumentation::didRemoveTimerImpl(InspectorController* inspectorController, int timerId)
+void InspectorInstrumentation::didRemoveTimerImpl(InspectorAgent* inspectorAgent, int timerId)
{
- pauseOnNativeEventIfNeeded(inspectorController, instrumentationEventCategoryType, clearTimerEventName, true);
- if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController))
+ pauseOnNativeEventIfNeeded(inspectorAgent, instrumentationEventCategoryType, clearTimerEventName, true);
+ if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent))
timelineAgent->didRemoveTimer(timerId);
}
-InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InspectorController* inspectorController, const String& scriptName, int scriptLine)
+InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InspectorAgent* inspectorAgent, const String& scriptName, int scriptLine)
{
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent) {
timelineAgent->willCallFunction(scriptName, scriptLine);
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didCallFunctionImpl(const InspectorInstrumentationCookie& cookie)
@@ -201,15 +202,15 @@ void InspectorInstrumentation::didCallFunctionImpl(const InspectorInstrumentatio
timelineAgent->didCallFunction();
}
-InspectorInstrumentationCookie InspectorInstrumentation::willChangeXHRReadyStateImpl(InspectorController* inspectorController, XMLHttpRequest* request)
+InspectorInstrumentationCookie InspectorInstrumentation::willChangeXHRReadyStateImpl(InspectorAgent* inspectorAgent, XMLHttpRequest* request)
{
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent && request->hasEventListeners(eventNames().readystatechangeEvent)) {
timelineAgent->willChangeXHRReadyState(request->url().string(), request->readyState());
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didChangeXHRReadyStateImpl(const InspectorInstrumentationCookie& cookie)
@@ -218,17 +219,17 @@ void InspectorInstrumentation::didChangeXHRReadyStateImpl(const InspectorInstrum
timelineAgent->didChangeXHRReadyState();
}
-InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InspectorController* inspectorController, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
+InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InspectorAgent* inspectorAgent, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
{
- pauseOnNativeEventIfNeeded(inspectorController, listenerEventCategoryType, event.type(), false);
+ pauseOnNativeEventIfNeeded(inspectorAgent, listenerEventCategoryType, event.type(), false);
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent && eventHasListeners(event.type(), window, node, ancestors)) {
timelineAgent->willDispatchEvent(event);
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie)
@@ -239,17 +240,17 @@ void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentati
timelineAgent->didDispatchEvent();
}
-InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InspectorController* inspectorController, const Event& event, DOMWindow* window)
+InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InspectorAgent* inspectorAgent, const Event& event, DOMWindow* window)
{
- pauseOnNativeEventIfNeeded(inspectorController, listenerEventCategoryType, event.type(), false);
+ pauseOnNativeEventIfNeeded(inspectorAgent, listenerEventCategoryType, event.type(), false);
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent && window->hasEventListeners(event.type())) {
timelineAgent->willDispatchEvent(event);
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie& cookie)
@@ -260,15 +261,15 @@ void InspectorInstrumentation::didDispatchEventOnWindowImpl(const InspectorInstr
timelineAgent->didDispatchEvent();
}
-InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InspectorController* inspectorController, const String& url, int lineNumber)
+InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InspectorAgent* inspectorAgent, const String& url, int lineNumber)
{
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent) {
timelineAgent->willEvaluateScript(url, lineNumber);
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didEvaluateScriptImpl(const InspectorInstrumentationCookie& cookie)
@@ -277,17 +278,17 @@ void InspectorInstrumentation::didEvaluateScriptImpl(const InspectorInstrumentat
timelineAgent->didEvaluateScript();
}
-InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InspectorController* inspectorController, int timerId)
+InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InspectorAgent* inspectorAgent, int timerId)
{
- pauseOnNativeEventIfNeeded(inspectorController, instrumentationEventCategoryType, timerFiredEventName, false);
+ pauseOnNativeEventIfNeeded(inspectorAgent, instrumentationEventCategoryType, timerFiredEventName, false);
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent) {
timelineAgent->willFireTimer(timerId);
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didFireTimerImpl(const InspectorInstrumentationCookie& cookie)
@@ -298,15 +299,15 @@ void InspectorInstrumentation::didFireTimerImpl(const InspectorInstrumentationCo
timelineAgent->didFireTimer();
}
-InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InspectorController* inspectorController)
+InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InspectorAgent* inspectorAgent)
{
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent) {
timelineAgent->willLayout();
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCookie& cookie)
@@ -315,15 +316,15 @@ void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCooki
timelineAgent->didLayout();
}
-InspectorInstrumentationCookie InspectorInstrumentation::willLoadXHRImpl(InspectorController* inspectorController, XMLHttpRequest* request)
+InspectorInstrumentationCookie InspectorInstrumentation::willLoadXHRImpl(InspectorAgent* inspectorAgent, XMLHttpRequest* request)
{
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent && request->hasEventListeners(eventNames().loadEvent)) {
timelineAgent->willLoadXHR(request->url());
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didLoadXHRImpl(const InspectorInstrumentationCookie& cookie)
@@ -332,15 +333,15 @@ void InspectorInstrumentation::didLoadXHRImpl(const InspectorInstrumentationCook
timelineAgent->didLoadXHR();
}
-InspectorInstrumentationCookie InspectorInstrumentation::willPaintImpl(InspectorController* inspectorController, const IntRect& rect)
+InspectorInstrumentationCookie InspectorInstrumentation::willPaintImpl(InspectorAgent* inspectorAgent, const IntRect& rect)
{
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent) {
timelineAgent->willPaint(rect);
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didPaintImpl(const InspectorInstrumentationCookie& cookie)
@@ -349,15 +350,15 @@ void InspectorInstrumentation::didPaintImpl(const InspectorInstrumentationCookie
timelineAgent->didPaint();
}
-InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyleImpl(InspectorController* inspectorController)
+InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyleImpl(InspectorAgent* inspectorAgent)
{
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent) {
timelineAgent->willRecalculateStyle();
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didRecalculateStyleImpl(const InspectorInstrumentationCookie& cookie)
@@ -366,7 +367,7 @@ void InspectorInstrumentation::didRecalculateStyleImpl(const InspectorInstrument
timelineAgent->didRecalculateStyle();
}
-void InspectorInstrumentation::identifierForInitialRequestImpl(InspectorController* ic, unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
+void InspectorInstrumentation::identifierForInitialRequestImpl(InspectorAgent* ic, unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
{
if (!ic->enabled())
return;
@@ -376,7 +377,7 @@ void InspectorInstrumentation::identifierForInitialRequestImpl(InspectorControll
resourceAgent->identifierForInitialRequest(identifier, request.url(), loader);
}
-void InspectorInstrumentation::willSendRequestImpl(InspectorController* ic, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
+void InspectorInstrumentation::willSendRequestImpl(InspectorAgent* ic, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
ic->willSendRequest(request);
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(ic))
@@ -385,13 +386,13 @@ void InspectorInstrumentation::willSendRequestImpl(InspectorController* ic, unsi
resourceAgent->willSendRequest(identifier, request, redirectResponse);
}
-void InspectorInstrumentation::markResourceAsCachedImpl(InspectorController* ic, unsigned long identifier)
+void InspectorInstrumentation::markResourceAsCachedImpl(InspectorAgent* ic, unsigned long identifier)
{
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->markResourceAsCached(identifier);
}
-void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InspectorController* ic, DocumentLoader* loader, const CachedResource* cachedResource)
+void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InspectorAgent* ic, DocumentLoader* loader, const CachedResource* cachedResource)
{
if (!ic->enabled())
return;
@@ -400,15 +401,15 @@ void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InspectorContr
resourceAgent->didLoadResourceFromMemoryCache(loader, cachedResource);
}
-InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InspectorController* inspectorController, unsigned long identifier)
+InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InspectorAgent* inspectorAgent, unsigned long identifier)
{
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent) {
timelineAgent->willReceiveResourceData(identifier);
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didReceiveResourceDataImpl(const InspectorInstrumentationCookie& cookie)
@@ -417,20 +418,20 @@ void InspectorInstrumentation::didReceiveResourceDataImpl(const InspectorInstrum
timelineAgent->didReceiveResourceData();
}
-InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponseImpl(InspectorController* inspectorController, unsigned long identifier, const ResourceResponse& response)
+InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponseImpl(InspectorAgent* inspectorAgent, unsigned long identifier, const ResourceResponse& response)
{
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent) {
timelineAgent->willReceiveResourceResponse(identifier, response);
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
{
- InspectorController* ic = cookie.first;
+ InspectorAgent* ic = cookie.first;
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->didReceiveResponse(identifier, loader, response);
ic->consoleAgent()->didReceiveResponse(identifier, response);
@@ -438,13 +439,13 @@ void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorIns
timelineAgent->didReceiveResourceResponse();
}
-void InspectorInstrumentation::didReceiveContentLengthImpl(InspectorController* ic, unsigned long identifier, int lengthReceived)
+void InspectorInstrumentation::didReceiveContentLengthImpl(InspectorAgent* ic, unsigned long identifier, int lengthReceived)
{
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->didReceiveContentLength(identifier, lengthReceived);
}
-void InspectorInstrumentation::didFinishLoadingImpl(InspectorController* ic, unsigned long identifier, double finishTime)
+void InspectorInstrumentation::didFinishLoadingImpl(InspectorAgent* ic, unsigned long identifier, double finishTime)
{
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(ic))
timelineAgent->didFinishLoadingResource(identifier, false, finishTime);
@@ -452,7 +453,7 @@ void InspectorInstrumentation::didFinishLoadingImpl(InspectorController* ic, uns
resourceAgent->didFinishLoading(identifier, finishTime);
}
-void InspectorInstrumentation::didFailLoadingImpl(InspectorController* ic, unsigned long identifier, const ResourceError& error)
+void InspectorInstrumentation::didFailLoadingImpl(InspectorAgent* ic, unsigned long identifier, const ResourceError& error)
{
ic->consoleAgent()->didFailLoading(identifier, error);
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(ic))
@@ -461,49 +462,49 @@ void InspectorInstrumentation::didFailLoadingImpl(InspectorController* ic, unsig
resourceAgent->didFailLoading(identifier, error);
}
-void InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl(InspectorController* ic, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
+void InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl(InspectorAgent* ic, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
{
ic->consoleAgent()->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber);
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->setInitialContent(identifier, sourceString, "XHR");
}
-void InspectorInstrumentation::scriptImportedImpl(InspectorController* ic, unsigned long identifier, const String& sourceString)
+void InspectorInstrumentation::scriptImportedImpl(InspectorAgent* ic, unsigned long identifier, const String& sourceString)
{
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->setInitialContent(identifier, sourceString, "Script");
}
-void InspectorInstrumentation::mainResourceFiredLoadEventImpl(InspectorController* inspectorController, Frame* frame, const KURL& url)
+void InspectorInstrumentation::mainResourceFiredLoadEventImpl(InspectorAgent* inspectorAgent, Frame* frame, const KURL& url)
{
- inspectorController->mainResourceFiredLoadEvent(frame->loader()->documentLoader(), url);
+ inspectorAgent->mainResourceFiredLoadEvent(frame->loader()->documentLoader(), url);
}
-void InspectorInstrumentation::mainResourceFiredDOMContentEventImpl(InspectorController* inspectorController, Frame* frame, const KURL& url)
+void InspectorInstrumentation::mainResourceFiredDOMContentEventImpl(InspectorAgent* inspectorAgent, Frame* frame, const KURL& url)
{
- inspectorController->mainResourceFiredDOMContentEvent(frame->loader()->documentLoader(), url);
+ inspectorAgent->mainResourceFiredDOMContentEvent(frame->loader()->documentLoader(), url);
}
-void InspectorInstrumentation::frameDetachedFromParentImpl(InspectorController* inspectorController, Frame* frame)
+void InspectorInstrumentation::frameDetachedFromParentImpl(InspectorAgent* inspectorAgent, Frame* frame)
{
- if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorController))
+ if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
resourceAgent->frameDetachedFromParent(frame);
}
-void InspectorInstrumentation::didCommitLoadImpl(InspectorController* inspectorController, DocumentLoader* loader)
+void InspectorInstrumentation::didCommitLoadImpl(InspectorAgent* inspectorAgent, DocumentLoader* loader)
{
- inspectorController->didCommitLoad(loader);
+ inspectorAgent->didCommitLoad(loader);
}
-InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InspectorController* inspectorController, unsigned int length, unsigned int startLine)
+InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InspectorAgent* inspectorAgent, unsigned int length, unsigned int startLine)
{
int timelineAgentId = 0;
- InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
+ InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent);
if (timelineAgent) {
timelineAgent->willWriteHTML(length, startLine);
timelineAgentId = timelineAgent->id();
}
- return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
+ return InspectorInstrumentationCookie(inspectorAgent, timelineAgentId);
}
void InspectorInstrumentation::didWriteHTMLImpl(const InspectorInstrumentationCookie& cookie, unsigned int endLine)
@@ -512,34 +513,34 @@ void InspectorInstrumentation::didWriteHTMLImpl(const InspectorInstrumentationCo
timelineAgent->didWriteHTML(endLine);
}
-void InspectorInstrumentation::addMessageToConsoleImpl(InspectorController* inspectorController, MessageSource source, MessageType type, MessageLevel level, const String& message, ScriptArguments* arguments, ScriptCallStack* callStack)
+void InspectorInstrumentation::addMessageToConsoleImpl(InspectorAgent* inspectorAgent, MessageSource source, MessageType type, MessageLevel level, const String& message, ScriptArguments* arguments, ScriptCallStack* callStack)
{
- inspectorController->consoleAgent()->addMessageToConsole(source, type, level, message, arguments, callStack);
+ inspectorAgent->consoleAgent()->addMessageToConsole(source, type, level, message, arguments, callStack);
}
-void InspectorInstrumentation::addMessageToConsoleImpl(InspectorController* inspectorController, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
+void InspectorInstrumentation::addMessageToConsoleImpl(InspectorAgent* inspectorAgent, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
{
- inspectorController->consoleAgent()->addMessageToConsole(source, type, level, message, lineNumber, sourceID);
+ inspectorAgent->consoleAgent()->addMessageToConsole(source, type, level, message, lineNumber, sourceID);
}
-void InspectorInstrumentation::consoleCountImpl(InspectorController* inspectorController, ScriptArguments* arguments, ScriptCallStack* stack)
+void InspectorInstrumentation::consoleCountImpl(InspectorAgent* inspectorAgent, ScriptArguments* arguments, ScriptCallStack* stack)
{
- inspectorController->consoleAgent()->count(arguments, stack);
+ inspectorAgent->consoleAgent()->count(arguments, stack);
}
-void InspectorInstrumentation::startConsoleTimingImpl(InspectorController* inspectorController, const String& title)
+void InspectorInstrumentation::startConsoleTimingImpl(InspectorAgent* inspectorAgent, const String& title)
{
- inspectorController->consoleAgent()->startTiming(title);
+ inspectorAgent->consoleAgent()->startTiming(title);
}
-void InspectorInstrumentation::stopConsoleTimingImpl(InspectorController* inspectorController, const String& title, ScriptCallStack* stack)
+void InspectorInstrumentation::stopConsoleTimingImpl(InspectorAgent* inspectorAgent, const String& title, ScriptCallStack* stack)
{
- inspectorController->consoleAgent()->stopTiming(title, stack);
+ inspectorAgent->consoleAgent()->stopTiming(title, stack);
}
-void InspectorInstrumentation::consoleMarkTimelineImpl(InspectorController* inspectorController, ScriptArguments* arguments)
+void InspectorInstrumentation::consoleMarkTimelineImpl(InspectorAgent* inspectorAgent, ScriptArguments* arguments)
{
- if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) {
+ if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent)) {
String message;
arguments->getFirstArgumentAsString(message);
timelineAgent->didMarkTimeline(message);
@@ -547,126 +548,126 @@ void InspectorInstrumentation::consoleMarkTimelineImpl(InspectorController* insp
}
#if ENABLE(JAVASCRIPT_DEBUGGER)
-void InspectorInstrumentation::addStartProfilingMessageToConsoleImpl(InspectorController* inspectorController, const String& title, unsigned lineNumber, const String& sourceURL)
+void InspectorInstrumentation::addStartProfilingMessageToConsoleImpl(InspectorAgent* inspectorAgent, const String& title, unsigned lineNumber, const String& sourceURL)
{
- if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent())
+ if (InspectorProfilerAgent* profilerAgent = inspectorAgent->profilerAgent())
profilerAgent->addStartProfilingMessageToConsole(title, lineNumber, sourceURL);
}
-void InspectorInstrumentation::addProfileImpl(InspectorController* inspectorController, RefPtr<ScriptProfile> profile, ScriptCallStack* callStack)
+void InspectorInstrumentation::addProfileImpl(InspectorAgent* inspectorAgent, RefPtr<ScriptProfile> profile, ScriptCallStack* callStack)
{
- if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent()) {
+ if (InspectorProfilerAgent* profilerAgent = inspectorAgent->profilerAgent()) {
const ScriptCallFrame& lastCaller = callStack->at(0);
profilerAgent->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL());
}
}
-bool InspectorInstrumentation::profilerEnabledImpl(InspectorController* inspectorController)
+bool InspectorInstrumentation::profilerEnabledImpl(InspectorAgent* inspectorAgent)
{
- if (!inspectorController->enabled())
+ if (!inspectorAgent->enabled())
return false;
- InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent();
+ InspectorProfilerAgent* profilerAgent = inspectorAgent->profilerAgent();
if (!profilerAgent)
return false;
return profilerAgent->enabled();
}
-String InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(InspectorController* inspectorController, bool incrementProfileNumber)
+String InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(InspectorAgent* inspectorAgent, bool incrementProfileNumber)
{
- if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent())
+ if (InspectorProfilerAgent* profilerAgent = inspectorAgent->profilerAgent())
return profilerAgent->getCurrentUserInitiatedProfileName(incrementProfileNumber);
return "";
}
#endif
#if ENABLE(DATABASE)
-void InspectorInstrumentation::didOpenDatabaseImpl(InspectorController* inspectorController, Database* database, const String& domain, const String& name, const String& version)
+void InspectorInstrumentation::didOpenDatabaseImpl(InspectorAgent* inspectorAgent, Database* database, const String& domain, const String& name, const String& version)
{
- inspectorController->didOpenDatabase(database, domain, name, version);
+ inspectorAgent->didOpenDatabase(database, domain, name, version);
}
#endif
#if ENABLE(DOM_STORAGE)
-void InspectorInstrumentation::didUseDOMStorageImpl(InspectorController* inspectorController, StorageArea* storageArea, bool isLocalStorage, Frame* frame)
+void InspectorInstrumentation::didUseDOMStorageImpl(InspectorAgent* inspectorAgent, StorageArea* storageArea, bool isLocalStorage, Frame* frame)
{
- inspectorController->didUseDOMStorage(storageArea, isLocalStorage, frame);
+ inspectorAgent->didUseDOMStorage(storageArea, isLocalStorage, frame);
}
#endif
#if ENABLE(WORKERS)
-void InspectorInstrumentation::didCreateWorkerImpl(InspectorController* inspectorController, intptr_t id, const String& url, bool isSharedWorker)
+void InspectorInstrumentation::didCreateWorkerImpl(InspectorAgent* inspectorAgent, intptr_t id, const String& url, bool isSharedWorker)
{
- inspectorController->didCreateWorker(id, url, isSharedWorker);
+ inspectorAgent->didCreateWorker(id, url, isSharedWorker);
}
-void InspectorInstrumentation::didDestroyWorkerImpl(InspectorController* inspectorController, intptr_t id)
+void InspectorInstrumentation::didDestroyWorkerImpl(InspectorAgent* inspectorAgent, intptr_t id)
{
- inspectorController->didDestroyWorker(id);
+ inspectorAgent->didDestroyWorker(id);
}
#endif
#if ENABLE(WEB_SOCKETS)
-void InspectorInstrumentation::didCreateWebSocketImpl(InspectorController* inspectorController, unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
+void InspectorInstrumentation::didCreateWebSocketImpl(InspectorAgent* inspectorAgent, unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
{
- inspectorController->didCreateWebSocket(identifier, requestURL, documentURL);
+ inspectorAgent->didCreateWebSocket(identifier, requestURL, documentURL);
}
-void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(InspectorController* inspectorController, unsigned long identifier, const WebSocketHandshakeRequest& request)
+void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(InspectorAgent* inspectorAgent, unsigned long identifier, const WebSocketHandshakeRequest& request)
{
- inspectorController->willSendWebSocketHandshakeRequest(identifier, request);
+ inspectorAgent->willSendWebSocketHandshakeRequest(identifier, request);
}
-void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(InspectorController* inspectorController, unsigned long identifier, const WebSocketHandshakeResponse& response)
+void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(InspectorAgent* inspectorAgent, unsigned long identifier, const WebSocketHandshakeResponse& response)
{
- inspectorController->didReceiveWebSocketHandshakeResponse(identifier, response);
+ inspectorAgent->didReceiveWebSocketHandshakeResponse(identifier, response);
}
-void InspectorInstrumentation::didCloseWebSocketImpl(InspectorController* inspectorController, unsigned long identifier)
+void InspectorInstrumentation::didCloseWebSocketImpl(InspectorAgent* inspectorAgent, unsigned long identifier)
{
- inspectorController->didCloseWebSocket(identifier);
+ inspectorAgent->didCloseWebSocket(identifier);
}
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-void InspectorInstrumentation::networkStateChangedImpl(InspectorController* ic)
+void InspectorInstrumentation::networkStateChangedImpl(InspectorAgent* ic)
{
if (InspectorApplicationCacheAgent* applicationCacheAgent = ic->applicationCacheAgent())
applicationCacheAgent->networkStateChanged();
}
-void InspectorInstrumentation::updateApplicationCacheStatusImpl(InspectorController* ic, Frame* frame)
+void InspectorInstrumentation::updateApplicationCacheStatusImpl(InspectorAgent* ic, Frame* frame)
{
if (InspectorApplicationCacheAgent* applicationCacheAgent = ic->applicationCacheAgent())
applicationCacheAgent->updateApplicationCacheStatus(frame);
}
#endif
-bool InspectorInstrumentation::hasFrontend(InspectorController* inspectorController)
+bool InspectorInstrumentation::hasFrontend(InspectorAgent* inspectorAgent)
{
- return inspectorController->hasFrontend();
+ return inspectorAgent->hasFrontend();
}
-void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InspectorController* inspectorController, const String& categoryType, const String& eventName, bool synchronous)
+void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InspectorAgent* inspectorAgent, const String& categoryType, const String& eventName, bool synchronous)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent())
+ if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorAgent->browserDebuggerAgent())
browserDebuggerAgent->pauseOnNativeEventIfNeeded(categoryType, eventName, synchronous);
#endif
}
-void InspectorInstrumentation::cancelPauseOnNativeEvent(InspectorController* inspectorController)
+void InspectorInstrumentation::cancelPauseOnNativeEvent(InspectorAgent* inspectorAgent)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
- if (InspectorDebuggerAgent* debuggerAgent = inspectorController->debuggerAgent())
+ if (InspectorDebuggerAgent* debuggerAgent = inspectorAgent->debuggerAgent())
debuggerAgent->cancelPauseOnNextStatement();
#endif
}
-InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(InspectorController* inspectorController)
+InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(InspectorAgent* inspectorAgent)
{
- return inspectorController->timelineAgent();
+ return inspectorAgent->timelineAgent();
}
InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
@@ -677,7 +678,7 @@ InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const In
return 0;
}
-InspectorResourceAgent* InspectorInstrumentation::retrieveResourceAgent(InspectorController* ic)
+InspectorResourceAgent* InspectorInstrumentation::retrieveResourceAgent(InspectorAgent* ic)
{
return ic->resourceAgent();
}
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h
index 7a7ee43..2835055 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.h
+++ b/Source/WebCore/inspector/InspectorInstrumentation.h
@@ -36,6 +36,7 @@
#include "Page.h"
#include "ScriptExecutionContext.h"
+#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
@@ -48,7 +49,7 @@ class Element;
class EventContext;
class DocumentLoader;
class HitTestResult;
-class InspectorController;
+class InspectorAgent;
class InspectorResourceAgent;
class InspectorTimelineAgent;
class KURL;
@@ -66,7 +67,7 @@ class WebSocketHandshakeRequest;
class WebSocketHandshakeResponse;
#endif
-typedef pair<InspectorController*, int> InspectorInstrumentationCookie;
+typedef pair<InspectorAgent*, int> InspectorInstrumentationCookie;
class InspectorInstrumentation {
public:
@@ -171,6 +172,8 @@ public:
#endif
#if ENABLE(INSPECTOR)
+ static void bindInspectorAgent(Page* page, InspectorAgent* inspectorAgent) { s_inspectorAgents.set(page, inspectorAgent); }
+ static void unbindInspectorAgent(Page* page) { s_inspectorAgents.remove(page); }
static void frontendCreated() { s_frontendCounter += 1; }
static void frontendDeleted() { s_frontendCounter -= 1; }
static bool hasFrontends() { return s_frontendCounter; }
@@ -180,120 +183,121 @@ public:
private:
#if ENABLE(INSPECTOR)
- static void didClearWindowObjectInWorldImpl(InspectorController*, Frame*, DOMWrapperWorld*);
- static void inspectedPageDestroyedImpl(InspectorController*);
+ static void didClearWindowObjectInWorldImpl(InspectorAgent*, Frame*, DOMWrapperWorld*);
+ static void inspectedPageDestroyedImpl(InspectorAgent*);
- static void willInsertDOMNodeImpl(InspectorController*, Node* node, Node* parent);
- static void didInsertDOMNodeImpl(InspectorController*, Node*);
- static void willRemoveDOMNodeImpl(InspectorController*, Node*);
- static void didRemoveDOMNodeImpl(InspectorController*, Node*);
- static void willModifyDOMAttrImpl(InspectorController*, Element*);
- static void didModifyDOMAttrImpl(InspectorController*, Element*);
- static void characterDataModifiedImpl(InspectorController*, CharacterData*);
+ static void willInsertDOMNodeImpl(InspectorAgent*, Node* node, Node* parent);
+ static void didInsertDOMNodeImpl(InspectorAgent*, Node*);
+ static void willRemoveDOMNodeImpl(InspectorAgent*, Node*);
+ static void didRemoveDOMNodeImpl(InspectorAgent*, Node*);
+ static void willModifyDOMAttrImpl(InspectorAgent*, Element*);
+ static void didModifyDOMAttrImpl(InspectorAgent*, Element*);
+ static void characterDataModifiedImpl(InspectorAgent*, CharacterData*);
- static void mouseDidMoveOverElementImpl(InspectorController*, const HitTestResult&, unsigned modifierFlags);
- static bool handleMousePressImpl(InspectorController*);
+ static void mouseDidMoveOverElementImpl(InspectorAgent*, const HitTestResult&, unsigned modifierFlags);
+ static bool handleMousePressImpl(InspectorAgent*);
- static void willSendXMLHttpRequestImpl(InspectorController*, const String& url);
- static void didScheduleResourceRequestImpl(InspectorController*, const String& url);
- static void didInstallTimerImpl(InspectorController*, int timerId, int timeout, bool singleShot);
- static void didRemoveTimerImpl(InspectorController*, int timerId);
+ static void willSendXMLHttpRequestImpl(InspectorAgent*, const String& url);
+ static void didScheduleResourceRequestImpl(InspectorAgent*, const String& url);
+ static void didInstallTimerImpl(InspectorAgent*, int timerId, int timeout, bool singleShot);
+ static void didRemoveTimerImpl(InspectorAgent*, int timerId);
- static InspectorInstrumentationCookie willCallFunctionImpl(InspectorController*, const String& scriptName, int scriptLine);
+ static InspectorInstrumentationCookie willCallFunctionImpl(InspectorAgent*, const String& scriptName, int scriptLine);
static void didCallFunctionImpl(const InspectorInstrumentationCookie&);
- static InspectorInstrumentationCookie willChangeXHRReadyStateImpl(InspectorController*, XMLHttpRequest* request);
+ static InspectorInstrumentationCookie willChangeXHRReadyStateImpl(InspectorAgent*, XMLHttpRequest* request);
static void didChangeXHRReadyStateImpl(const InspectorInstrumentationCookie&);
- static InspectorInstrumentationCookie willDispatchEventImpl(InspectorController*, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors);
+ static InspectorInstrumentationCookie willDispatchEventImpl(InspectorAgent*, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors);
static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
- static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InspectorController*, const Event& event, DOMWindow* window);
+ static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InspectorAgent*, const Event& event, DOMWindow* window);
static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
- static InspectorInstrumentationCookie willEvaluateScriptImpl(InspectorController*, const String& url, int lineNumber);
+ static InspectorInstrumentationCookie willEvaluateScriptImpl(InspectorAgent*, const String& url, int lineNumber);
static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&);
- static InspectorInstrumentationCookie willFireTimerImpl(InspectorController*, int timerId);
+ static InspectorInstrumentationCookie willFireTimerImpl(InspectorAgent*, int timerId);
static void didFireTimerImpl(const InspectorInstrumentationCookie&);
- static InspectorInstrumentationCookie willLayoutImpl(InspectorController*);
+ static InspectorInstrumentationCookie willLayoutImpl(InspectorAgent*);
static void didLayoutImpl(const InspectorInstrumentationCookie&);
- static InspectorInstrumentationCookie willLoadXHRImpl(InspectorController*, XMLHttpRequest* request);
+ static InspectorInstrumentationCookie willLoadXHRImpl(InspectorAgent*, XMLHttpRequest* request);
static void didLoadXHRImpl(const InspectorInstrumentationCookie&);
- static InspectorInstrumentationCookie willPaintImpl(InspectorController*, const IntRect& rect);
+ static InspectorInstrumentationCookie willPaintImpl(InspectorAgent*, const IntRect& rect);
static void didPaintImpl(const InspectorInstrumentationCookie&);
- static InspectorInstrumentationCookie willRecalculateStyleImpl(InspectorController*);
+ static InspectorInstrumentationCookie willRecalculateStyleImpl(InspectorAgent*);
static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
- static void identifierForInitialRequestImpl(InspectorController*, unsigned long identifier, DocumentLoader*, const ResourceRequest&);
- static void willSendRequestImpl(InspectorController*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
- static void markResourceAsCachedImpl(InspectorController*, unsigned long identifier);
- static void didLoadResourceFromMemoryCacheImpl(InspectorController*, DocumentLoader*, const CachedResource*);
- static InspectorInstrumentationCookie willReceiveResourceDataImpl(InspectorController*, unsigned long identifier);
+ static void identifierForInitialRequestImpl(InspectorAgent*, unsigned long identifier, DocumentLoader*, const ResourceRequest&);
+ static void willSendRequestImpl(InspectorAgent*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
+ static void markResourceAsCachedImpl(InspectorAgent*, unsigned long identifier);
+ static void didLoadResourceFromMemoryCacheImpl(InspectorAgent*, DocumentLoader*, const CachedResource*);
+ static InspectorInstrumentationCookie willReceiveResourceDataImpl(InspectorAgent*, unsigned long identifier);
static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&);
- static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InspectorController*, unsigned long identifier, const ResourceResponse&);
+ static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InspectorAgent*, unsigned long identifier, const ResourceResponse&);
static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
- static void didReceiveContentLengthImpl(InspectorController*, unsigned long identifier, int lengthReceived);
- static void didFinishLoadingImpl(InspectorController*, unsigned long identifier, double finishTime);
- static void didFailLoadingImpl(InspectorController*, unsigned long identifier, const ResourceError&);
- static void resourceRetrievedByXMLHttpRequestImpl(InspectorController*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
- static void scriptImportedImpl(InspectorController*, unsigned long identifier, const String& sourceString);
- static void mainResourceFiredLoadEventImpl(InspectorController*, Frame*, const KURL&);
- static void mainResourceFiredDOMContentEventImpl(InspectorController*, Frame*, const KURL&);
- static void frameDetachedFromParentImpl(InspectorController*, Frame*);
- static void didCommitLoadImpl(InspectorController*, DocumentLoader*);
-
- static InspectorInstrumentationCookie willWriteHTMLImpl(InspectorController*, unsigned int length, unsigned int startLine);
+ static void didReceiveContentLengthImpl(InspectorAgent*, unsigned long identifier, int lengthReceived);
+ static void didFinishLoadingImpl(InspectorAgent*, unsigned long identifier, double finishTime);
+ static void didFailLoadingImpl(InspectorAgent*, unsigned long identifier, const ResourceError&);
+ static void resourceRetrievedByXMLHttpRequestImpl(InspectorAgent*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
+ static void scriptImportedImpl(InspectorAgent*, unsigned long identifier, const String& sourceString);
+ static void mainResourceFiredLoadEventImpl(InspectorAgent*, Frame*, const KURL&);
+ static void mainResourceFiredDOMContentEventImpl(InspectorAgent*, Frame*, const KURL&);
+ static void frameDetachedFromParentImpl(InspectorAgent*, Frame*);
+ static void didCommitLoadImpl(InspectorAgent*, DocumentLoader*);
+
+ static InspectorInstrumentationCookie willWriteHTMLImpl(InspectorAgent*, unsigned int length, unsigned int startLine);
static void didWriteHTMLImpl(const InspectorInstrumentationCookie&, unsigned int endLine);
- static void addMessageToConsoleImpl(InspectorController*, MessageSource, MessageType, MessageLevel, const String& message, ScriptArguments*, ScriptCallStack*);
- static void addMessageToConsoleImpl(InspectorController*, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
- static void consoleCountImpl(InspectorController*, ScriptArguments*, ScriptCallStack*);
- static void startConsoleTimingImpl(InspectorController*, const String& title);
- static void stopConsoleTimingImpl(InspectorController*, const String& title, ScriptCallStack*);
- static void consoleMarkTimelineImpl(InspectorController*, ScriptArguments*);
+ static void addMessageToConsoleImpl(InspectorAgent*, MessageSource, MessageType, MessageLevel, const String& message, ScriptArguments*, ScriptCallStack*);
+ static void addMessageToConsoleImpl(InspectorAgent*, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
+ static void consoleCountImpl(InspectorAgent*, ScriptArguments*, ScriptCallStack*);
+ static void startConsoleTimingImpl(InspectorAgent*, const String& title);
+ static void stopConsoleTimingImpl(InspectorAgent*, const String& title, ScriptCallStack*);
+ static void consoleMarkTimelineImpl(InspectorAgent*, ScriptArguments*);
#if ENABLE(JAVASCRIPT_DEBUGGER)
- static void addStartProfilingMessageToConsoleImpl(InspectorController*, const String& title, unsigned lineNumber, const String& sourceURL);
- static void addProfileImpl(InspectorController*, RefPtr<ScriptProfile>, ScriptCallStack*);
- static bool profilerEnabledImpl(InspectorController*);
- static String getCurrentUserInitiatedProfileNameImpl(InspectorController*, bool incrementProfileNumber);
+ static void addStartProfilingMessageToConsoleImpl(InspectorAgent*, const String& title, unsigned lineNumber, const String& sourceURL);
+ static void addProfileImpl(InspectorAgent*, RefPtr<ScriptProfile>, ScriptCallStack*);
+ static bool profilerEnabledImpl(InspectorAgent*);
+ static String getCurrentUserInitiatedProfileNameImpl(InspectorAgent*, bool incrementProfileNumber);
#endif
#if ENABLE(DATABASE)
- static void didOpenDatabaseImpl(InspectorController*, Database*, const String& domain, const String& name, const String& version);
+ static void didOpenDatabaseImpl(InspectorAgent*, Database*, const String& domain, const String& name, const String& version);
#endif
#if ENABLE(DOM_STORAGE)
- static void didUseDOMStorageImpl(InspectorController*, StorageArea*, bool isLocalStorage, Frame*);
+ static void didUseDOMStorageImpl(InspectorAgent*, StorageArea*, bool isLocalStorage, Frame*);
#endif
#if ENABLE(WORKERS)
- static void didCreateWorkerImpl(InspectorController*, intptr_t id, const String& url, bool isSharedWorker);
- static void didDestroyWorkerImpl(InspectorController*, intptr_t id);
+ static void didCreateWorkerImpl(InspectorAgent*, intptr_t id, const String& url, bool isSharedWorker);
+ static void didDestroyWorkerImpl(InspectorAgent*, intptr_t id);
#endif
#if ENABLE(WEB_SOCKETS)
- static void didCreateWebSocketImpl(InspectorController*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
- static void willSendWebSocketHandshakeRequestImpl(InspectorController*, unsigned long identifier, const WebSocketHandshakeRequest&);
- static void didReceiveWebSocketHandshakeResponseImpl(InspectorController*, unsigned long identifier, const WebSocketHandshakeResponse&);
- static void didCloseWebSocketImpl(InspectorController*, unsigned long identifier);
+ static void didCreateWebSocketImpl(InspectorAgent*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
+ static void willSendWebSocketHandshakeRequestImpl(InspectorAgent*, unsigned long identifier, const WebSocketHandshakeRequest&);
+ static void didReceiveWebSocketHandshakeResponseImpl(InspectorAgent*, unsigned long identifier, const WebSocketHandshakeResponse&);
+ static void didCloseWebSocketImpl(InspectorAgent*, unsigned long identifier);
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
- static void networkStateChangedImpl(InspectorController*);
- static void updateApplicationCacheStatusImpl(InspectorController*, Frame*);
-#endif
-
- static InspectorController* inspectorControllerForFrame(Frame*);
- static InspectorController* inspectorControllerForContext(ScriptExecutionContext*);
- static InspectorController* inspectorControllerForPage(Page*);
- static InspectorController* inspectorControllerWithFrontendForContext(ScriptExecutionContext*);
- static InspectorController* inspectorControllerWithFrontendForDocument(Document*);
- static InspectorController* inspectorControllerWithFrontendForFrame(Frame*);
- static InspectorController* inspectorControllerWithFrontendForPage(Page*);
-
- static bool hasFrontend(InspectorController*);
- static void pauseOnNativeEventIfNeeded(InspectorController*, const String& categoryType, const String& eventName, bool synchronous);
- static void cancelPauseOnNativeEvent(InspectorController*);
- static InspectorTimelineAgent* retrieveTimelineAgent(InspectorController*);
+ static void networkStateChangedImpl(InspectorAgent*);
+ static void updateApplicationCacheStatusImpl(InspectorAgent*, Frame*);
+#endif
+
+ static InspectorAgent* inspectorAgentForFrame(Frame*);
+ static InspectorAgent* inspectorAgentForContext(ScriptExecutionContext*);
+ static InspectorAgent* inspectorAgentForPage(Page*);
+ static InspectorAgent* inspectorAgentWithFrontendForContext(ScriptExecutionContext*);
+ static InspectorAgent* inspectorAgentWithFrontendForDocument(Document*);
+ static InspectorAgent* inspectorAgentWithFrontendForFrame(Frame*);
+ static InspectorAgent* inspectorAgentWithFrontendForPage(Page*);
+
+ static bool hasFrontend(InspectorAgent*);
+ static void pauseOnNativeEventIfNeeded(InspectorAgent*, const String& categoryType, const String& eventName, bool synchronous);
+ static void cancelPauseOnNativeEvent(InspectorAgent*);
+ static InspectorTimelineAgent* retrieveTimelineAgent(InspectorAgent*);
static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
- static InspectorResourceAgent* retrieveResourceAgent(InspectorController*);
+ static InspectorResourceAgent* retrieveResourceAgent(InspectorAgent*);
+ static HashMap<Page*, InspectorAgent*> s_inspectorAgents;
static int s_frontendCounter;
#endif
};
@@ -301,41 +305,41 @@ private:
inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForFrame(frame))
- didClearWindowObjectInWorldImpl(inspectorController, frame, world);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
+ didClearWindowObjectInWorldImpl(inspectorAgent, frame, world);
#endif
}
inline void InspectorInstrumentation::inspectedPageDestroyed(Page* page)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- inspectedPageDestroyedImpl(inspectorController);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ inspectedPageDestroyedImpl(inspectorAgent);
#endif
}
inline void InspectorInstrumentation::willInsertDOMNode(Document* document, Node* node, Node* parent)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForDocument(document))
- willInsertDOMNodeImpl(inspectorController, node, parent);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
+ willInsertDOMNodeImpl(inspectorAgent, node, parent);
#endif
}
inline void InspectorInstrumentation::didInsertDOMNode(Document* document, Node* node)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForDocument(document))
- didInsertDOMNodeImpl(inspectorController, node);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
+ didInsertDOMNodeImpl(inspectorAgent, node);
#endif
}
inline void InspectorInstrumentation::willRemoveDOMNode(Document* document, Node* node)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForDocument(document)) {
- willRemoveDOMNodeImpl(inspectorController, node);
- didRemoveDOMNodeImpl(inspectorController, node);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document)) {
+ willRemoveDOMNodeImpl(inspectorAgent, node);
+ didRemoveDOMNodeImpl(inspectorAgent, node);
}
#endif
}
@@ -343,32 +347,32 @@ inline void InspectorInstrumentation::willRemoveDOMNode(Document* document, Node
inline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Element* element)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForDocument(document))
- willModifyDOMAttrImpl(inspectorController, element);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
+ willModifyDOMAttrImpl(inspectorAgent, element);
#endif
}
inline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Element* element)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForDocument(document))
- didModifyDOMAttrImpl(inspectorController, element);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
+ didModifyDOMAttrImpl(inspectorAgent, element);
#endif
}
inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const HitTestResult& result, unsigned modifierFlags)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForPage(page))
- mouseDidMoveOverElementImpl(inspectorController, result, modifierFlags);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForPage(page))
+ mouseDidMoveOverElementImpl(inspectorAgent, result, modifierFlags);
#endif
}
inline bool InspectorInstrumentation::handleMousePress(Page* page)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForPage(page))
- return handleMousePressImpl(inspectorController);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForPage(page))
+ return handleMousePressImpl(inspectorAgent);
#endif
return false;
}
@@ -376,40 +380,40 @@ inline bool InspectorInstrumentation::handleMousePress(Page* page)
inline void InspectorInstrumentation::characterDataModified(Document* document, CharacterData* characterData)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForDocument(document))
- characterDataModifiedImpl(inspectorController, characterData);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
+ characterDataModifiedImpl(inspectorAgent, characterData);
#endif
}
inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- willSendXMLHttpRequestImpl(inspectorController, url);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ willSendXMLHttpRequestImpl(inspectorAgent, url);
#endif
}
inline void InspectorInstrumentation::didScheduleResourceRequest(Document* document, const String& url)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForDocument(document))
- didScheduleResourceRequestImpl(inspectorController, url);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
+ didScheduleResourceRequestImpl(inspectorAgent, url);
#endif
}
inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- didInstallTimerImpl(inspectorController, timerId, timeout, singleShot);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ didInstallTimerImpl(inspectorAgent, timerId, timeout, singleShot);
#endif
}
inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* context, int timerId)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- didRemoveTimerImpl(inspectorController, timerId);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ didRemoveTimerImpl(inspectorAgent, timerId);
#endif
}
@@ -417,8 +421,8 @@ inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* con
inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(Frame* frame, const String& scriptName, int scriptLine)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- return willCallFunctionImpl(inspectorController, scriptName, scriptLine);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ return willCallFunctionImpl(inspectorAgent, scriptName, scriptLine);
#endif
return InspectorInstrumentationCookie();
}
@@ -434,8 +438,8 @@ inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumenta
inline InspectorInstrumentationCookie InspectorInstrumentation::willChangeXHRReadyState(ScriptExecutionContext* context, XMLHttpRequest* request)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- return willChangeXHRReadyStateImpl(inspectorController, request);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ return willChangeXHRReadyStateImpl(inspectorAgent, request);
#endif
return InspectorInstrumentationCookie();
}
@@ -451,8 +455,8 @@ inline void InspectorInstrumentation::didChangeXHRReadyState(const InspectorInst
inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForDocument(document))
- return willDispatchEventImpl(inspectorController, event, window, node, ancestors);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
+ return willDispatchEventImpl(inspectorAgent, event, window, node, ancestors);
#endif
return InspectorInstrumentationCookie();
}
@@ -468,8 +472,8 @@ inline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrument
inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- return willDispatchEventOnWindowImpl(inspectorController, event, window);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ return willDispatchEventOnWindowImpl(inspectorAgent, event, window);
#endif
return InspectorInstrumentationCookie();
}
@@ -485,8 +489,8 @@ inline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorIn
inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame* frame, const String& url, int lineNumber)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- return willEvaluateScriptImpl(inspectorController, url, lineNumber);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ return willEvaluateScriptImpl(inspectorAgent, url, lineNumber);
#endif
return InspectorInstrumentationCookie();
}
@@ -502,8 +506,8 @@ inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumen
inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext* context, int timerId)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- return willFireTimerImpl(inspectorController, timerId);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ return willFireTimerImpl(inspectorAgent, timerId);
#endif
return InspectorInstrumentationCookie();
}
@@ -519,8 +523,8 @@ inline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentatio
inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame* frame)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- return willLayoutImpl(inspectorController);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ return willLayoutImpl(inspectorAgent);
#endif
return InspectorInstrumentationCookie();
}
@@ -536,8 +540,8 @@ inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCo
inline InspectorInstrumentationCookie InspectorInstrumentation::willLoadXHR(ScriptExecutionContext* context, XMLHttpRequest* request)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- return willLoadXHRImpl(inspectorController, request);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ return willLoadXHRImpl(inspectorAgent, request);
#endif
return InspectorInstrumentationCookie();
}
@@ -553,8 +557,8 @@ inline void InspectorInstrumentation::didLoadXHR(const InspectorInstrumentationC
inline InspectorInstrumentationCookie InspectorInstrumentation::willPaint(Frame* frame, const IntRect& rect)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- return willPaintImpl(inspectorController, rect);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ return willPaintImpl(inspectorAgent, rect);
#endif
return InspectorInstrumentationCookie();
}
@@ -570,8 +574,8 @@ inline void InspectorInstrumentation::didPaint(const InspectorInstrumentationCoo
inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document* document)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForDocument(document))
- return willRecalculateStyleImpl(inspectorController);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
+ return willRecalculateStyleImpl(inspectorAgent);
#endif
return InspectorInstrumentationCookie();
}
@@ -590,7 +594,7 @@ inline void InspectorInstrumentation::identifierForInitialRequest(Frame* frame,
// This notification should be procecessed even in cases there is no frontend.
if (!frame)
return;
- if (InspectorController* ic = inspectorControllerForPage(frame->page()))
+ if (InspectorAgent* ic = inspectorAgentForPage(frame->page()))
identifierForInitialRequestImpl(ic, identifier, loader, request);
#endif
}
@@ -598,7 +602,7 @@ inline void InspectorInstrumentation::identifierForInitialRequest(Frame* frame,
inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* ic = inspectorControllerWithFrontendForFrame(frame))
+ if (InspectorAgent* ic = inspectorAgentWithFrontendForFrame(frame))
willSendRequestImpl(ic, identifier, request, redirectResponse);
#endif
}
@@ -606,22 +610,22 @@ inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned lon
inline void InspectorInstrumentation::markResourceAsCached(Page* page, unsigned long identifier)
{
#if ENABLE(INSPECTOR)
- markResourceAsCachedImpl(inspectorControllerForPage(page), identifier);
+ markResourceAsCachedImpl(inspectorAgentForPage(page), identifier);
#endif
}
inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, const CachedResource* resource)
{
#if ENABLE(INSPECTOR)
- didLoadResourceFromMemoryCacheImpl(inspectorControllerForPage(page), loader, resource);
+ didLoadResourceFromMemoryCacheImpl(inspectorAgentForPage(page), loader, resource);
#endif
}
inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- return willReceiveResourceDataImpl(inspectorController, identifier);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ return willReceiveResourceDataImpl(inspectorAgent, identifier);
#endif
return InspectorInstrumentationCookie();
}
@@ -637,8 +641,8 @@ inline void InspectorInstrumentation::didReceiveResourceData(const InspectorInst
inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponse(Frame* frame, unsigned long identifier, const ResourceResponse& response)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- return willReceiveResourceResponseImpl(inspectorController, identifier, response);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ return willReceiveResourceResponseImpl(inspectorAgent, identifier, response);
#endif
return InspectorInstrumentationCookie();
}
@@ -654,80 +658,80 @@ inline void InspectorInstrumentation::didReceiveResourceResponse(const Inspector
inline void InspectorInstrumentation::didReceiveContentLength(Frame* frame, unsigned long identifier, int lengthReceived)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- didReceiveContentLengthImpl(inspectorController, identifier, lengthReceived);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ didReceiveContentLengthImpl(inspectorAgent, identifier, lengthReceived);
#endif
}
inline void InspectorInstrumentation::didFinishLoading(Frame* frame, unsigned long identifier, double finishTime)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- didFinishLoadingImpl(inspectorController, identifier, finishTime);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ didFinishLoadingImpl(inspectorAgent, identifier, finishTime);
#endif
}
inline void InspectorInstrumentation::didFailLoading(Frame* frame, unsigned long identifier, const ResourceError& error)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- didFailLoadingImpl(inspectorController, identifier, error);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ didFailLoadingImpl(inspectorAgent, identifier, error);
#endif
}
inline void InspectorInstrumentation::resourceRetrievedByXMLHttpRequest(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForContext(context))
- resourceRetrievedByXMLHttpRequestImpl(inspectorController, identifier, sourceString, url, sendURL, sendLineNumber);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
+ resourceRetrievedByXMLHttpRequestImpl(inspectorAgent, identifier, sourceString, url, sendURL, sendLineNumber);
#endif
}
inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForContext(context))
- scriptImportedImpl(inspectorController, identifier, sourceString);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
+ scriptImportedImpl(inspectorAgent, identifier, sourceString);
#endif
}
inline void InspectorInstrumentation::mainResourceFiredLoadEvent(Frame* frame, const KURL& url)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- mainResourceFiredLoadEventImpl(inspectorController, frame, url);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ mainResourceFiredLoadEventImpl(inspectorAgent, frame, url);
#endif
}
inline void InspectorInstrumentation::mainResourceFiredDOMContentEvent(Frame* frame, const KURL& url)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- mainResourceFiredDOMContentEventImpl(inspectorController, frame, url);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ mainResourceFiredDOMContentEventImpl(inspectorAgent, frame, url);
#endif
}
inline void InspectorInstrumentation::frameDetachedFromParent(Frame* frame)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- frameDetachedFromParentImpl(inspectorController, frame);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ frameDetachedFromParentImpl(inspectorAgent, frame);
#endif
}
inline void InspectorInstrumentation::didCommitLoad(Frame* frame, DocumentLoader* loader)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForFrame(frame))
- didCommitLoadImpl(inspectorController, loader);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
+ didCommitLoadImpl(inspectorAgent, loader);
#endif
}
inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned int length, unsigned int startLine)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForDocument(document))
- return willWriteHTMLImpl(inspectorController, length, startLine);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
+ return willWriteHTMLImpl(inspectorAgent, length, startLine);
#endif
return InspectorInstrumentationCookie();
}
@@ -744,8 +748,8 @@ inline void InspectorInstrumentation::didWriteHTML(const InspectorInstrumentatio
inline void InspectorInstrumentation::didOpenDatabase(ScriptExecutionContext* context, Database* database, const String& domain, const String& name, const String& version)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForContext(context))
- didOpenDatabaseImpl(inspectorController, database, domain, name, version);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
+ didOpenDatabaseImpl(inspectorAgent, database, domain, name, version);
#endif
}
#endif
@@ -754,8 +758,8 @@ inline void InspectorInstrumentation::didOpenDatabase(ScriptExecutionContext* co
inline void InspectorInstrumentation::didUseDOMStorage(Page* page, StorageArea* storageArea, bool isLocalStorage, Frame* frame)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- didUseDOMStorageImpl(inspectorController, storageArea, isLocalStorage, frame);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ didUseDOMStorageImpl(inspectorAgent, storageArea, isLocalStorage, frame);
#endif
}
#endif
@@ -764,16 +768,16 @@ inline void InspectorInstrumentation::didUseDOMStorage(Page* page, StorageArea*
inline void InspectorInstrumentation::didCreateWorker(ScriptExecutionContext* context, intptr_t id, const String& url, bool isSharedWorker)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- didCreateWorkerImpl(inspectorController, id, url, isSharedWorker);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ didCreateWorkerImpl(inspectorAgent, id, url, isSharedWorker);
#endif
}
inline void InspectorInstrumentation::didDestroyWorker(ScriptExecutionContext* context, intptr_t id)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- didDestroyWorkerImpl(inspectorController, id);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ didDestroyWorkerImpl(inspectorAgent, id);
#endif
}
#endif
@@ -783,32 +787,32 @@ inline void InspectorInstrumentation::didDestroyWorker(ScriptExecutionContext* c
inline void InspectorInstrumentation::didCreateWebSocket(ScriptExecutionContext* context, unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- didCreateWebSocketImpl(inspectorController, identifier, requestURL, documentURL);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ didCreateWebSocketImpl(inspectorAgent, identifier, requestURL, documentURL);
#endif
}
inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(ScriptExecutionContext* context, unsigned long identifier, const WebSocketHandshakeRequest& request)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- willSendWebSocketHandshakeRequestImpl(inspectorController, identifier, request);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ willSendWebSocketHandshakeRequestImpl(inspectorAgent, identifier, request);
#endif
}
inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(ScriptExecutionContext* context, unsigned long identifier, const WebSocketHandshakeResponse& response)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- didReceiveWebSocketHandshakeResponseImpl(inspectorController, identifier, response);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ didReceiveWebSocketHandshakeResponseImpl(inspectorAgent, identifier, response);
#endif
}
inline void InspectorInstrumentation::didCloseWebSocket(ScriptExecutionContext* context, unsigned long identifier)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForContext(context))
- didCloseWebSocketImpl(inspectorController, identifier);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
+ didCloseWebSocketImpl(inspectorAgent, identifier);
#endif
}
#endif
@@ -816,8 +820,8 @@ inline void InspectorInstrumentation::didCloseWebSocket(ScriptExecutionContext*
inline void InspectorInstrumentation::networkStateChanged(Page* page)
{
#if ENABLE(INSPECTOR) && ENABLE(OFFLINE_WEB_APPLICATIONS)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForPage(page))
- networkStateChangedImpl(inspectorController);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForPage(page))
+ networkStateChangedImpl(inspectorAgent);
#endif
}
@@ -825,8 +829,8 @@ inline void InspectorInstrumentation::networkStateChanged(Page* page)
inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForFrame(frame))
- updateApplicationCacheStatusImpl(inspectorController, frame);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+ updateApplicationCacheStatusImpl(inspectorAgent, frame);
#endif
}
#endif
@@ -834,48 +838,48 @@ inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
inline void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSource source, MessageType type, MessageLevel level, const String& message, ScriptArguments* arguments, ScriptCallStack* callStack)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- addMessageToConsoleImpl(inspectorController, source, type, level, message, arguments, callStack);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ addMessageToConsoleImpl(inspectorAgent, source, type, level, message, arguments, callStack);
#endif
}
inline void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- addMessageToConsoleImpl(inspectorController, source, type, level, message, lineNumber, sourceID);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ addMessageToConsoleImpl(inspectorAgent, source, type, level, message, lineNumber, sourceID);
#endif
}
inline void InspectorInstrumentation::consoleCount(Page* page, ScriptArguments* arguments, ScriptCallStack* stack)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- consoleCountImpl(inspectorController, arguments, stack);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ consoleCountImpl(inspectorAgent, arguments, stack);
#endif
}
inline void InspectorInstrumentation::startConsoleTiming(Page* page, const String& title)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- startConsoleTimingImpl(inspectorController, title);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ startConsoleTimingImpl(inspectorAgent, title);
#endif
}
inline void InspectorInstrumentation::stopConsoleTiming(Page* page, const String& title, ScriptCallStack* stack)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- stopConsoleTimingImpl(inspectorController, title, stack);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ stopConsoleTimingImpl(inspectorAgent, title, stack);
#endif
}
inline void InspectorInstrumentation::consoleMarkTimeline(Page* page, ScriptArguments* arguments)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerWithFrontendForPage(page))
- consoleMarkTimelineImpl(inspectorController, arguments);
+ if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForPage(page))
+ consoleMarkTimelineImpl(inspectorAgent, arguments);
#endif
}
@@ -883,24 +887,24 @@ inline void InspectorInstrumentation::consoleMarkTimeline(Page* page, ScriptArgu
inline void InspectorInstrumentation::addStartProfilingMessageToConsole(Page* page, const String& title, unsigned lineNumber, const String& sourceURL)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- addStartProfilingMessageToConsoleImpl(inspectorController, title, lineNumber, sourceURL);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ addStartProfilingMessageToConsoleImpl(inspectorAgent, title, lineNumber, sourceURL);
#endif
}
inline void InspectorInstrumentation::addProfile(Page* page, RefPtr<ScriptProfile> profile, ScriptCallStack* callStack)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- addProfileImpl(inspectorController, profile, callStack);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ addProfileImpl(inspectorAgent, profile, callStack);
#endif
}
inline bool InspectorInstrumentation::profilerEnabled(Page* page)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- return profilerEnabledImpl(inspectorController);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ return profilerEnabledImpl(inspectorAgent);
#endif
return false;
}
@@ -908,62 +912,62 @@ inline bool InspectorInstrumentation::profilerEnabled(Page* page)
inline String InspectorInstrumentation::getCurrentUserInitiatedProfileName(Page* page, bool incrementProfileNumber)
{
#if ENABLE(INSPECTOR)
- if (InspectorController* inspectorController = inspectorControllerForPage(page))
- return InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(inspectorController, incrementProfileNumber);
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
+ return InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(inspectorAgent, incrementProfileNumber);
#endif
return "";
}
#endif
#if ENABLE(INSPECTOR)
-inline InspectorController* InspectorInstrumentation::inspectorControllerForContext(ScriptExecutionContext* context)
+inline InspectorAgent* InspectorInstrumentation::inspectorAgentForContext(ScriptExecutionContext* context)
{
if (context && context->isDocument())
- return inspectorControllerForPage(static_cast<Document*>(context)->page());
+ return inspectorAgentForPage(static_cast<Document*>(context)->page());
return 0;
}
-inline InspectorController* InspectorInstrumentation::inspectorControllerForFrame(Frame* frame)
+inline InspectorAgent* InspectorInstrumentation::inspectorAgentForFrame(Frame* frame)
{
if (frame)
- return inspectorControllerForPage(frame->page());
+ return inspectorAgentForPage(frame->page());
return 0;
}
-inline InspectorController* InspectorInstrumentation::inspectorControllerForPage(Page* page)
+inline InspectorAgent* InspectorInstrumentation::inspectorAgentForPage(Page* page)
{
if (!page)
return 0;
- return page->inspectorController();
+ return s_inspectorAgents.get(page);
}
-inline InspectorController* InspectorInstrumentation::inspectorControllerWithFrontendForContext(ScriptExecutionContext* context)
+inline InspectorAgent* InspectorInstrumentation::inspectorAgentWithFrontendForContext(ScriptExecutionContext* context)
{
if (hasFrontends() && context && context->isDocument())
- return inspectorControllerWithFrontendForPage(static_cast<Document*>(context)->page());
+ return inspectorAgentWithFrontendForPage(static_cast<Document*>(context)->page());
return 0;
}
-inline InspectorController* InspectorInstrumentation::inspectorControllerWithFrontendForDocument(Document* document)
+inline InspectorAgent* InspectorInstrumentation::inspectorAgentWithFrontendForDocument(Document* document)
{
if (hasFrontends() && document)
- return inspectorControllerWithFrontendForPage(document->page());
+ return inspectorAgentWithFrontendForPage(document->page());
return 0;
}
-inline InspectorController* InspectorInstrumentation::inspectorControllerWithFrontendForFrame(Frame* frame)
+inline InspectorAgent* InspectorInstrumentation::inspectorAgentWithFrontendForFrame(Frame* frame)
{
if (hasFrontends() && frame)
- return inspectorControllerWithFrontendForPage(frame->page());
+ return inspectorAgentWithFrontendForPage(frame->page());
return 0;
}
-inline InspectorController* InspectorInstrumentation::inspectorControllerWithFrontendForPage(Page* page)
+inline InspectorAgent* InspectorInstrumentation::inspectorAgentWithFrontendForPage(Page* page)
{
if (page) {
- if (InspectorController* inspectorController = inspectorControllerForPage(page)) {
- if (hasFrontend(inspectorController))
- return inspectorController;
+ if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page)) {
+ if (hasFrontend(inspectorAgent))
+ return inspectorAgent;
}
}
return 0;
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
index 8c4f28f..e7198b8 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
@@ -33,8 +33,8 @@
#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
#include "Console.h"
+#include "InspectorAgent.h"
#include "InspectorConsoleAgent.h"
-#include "InspectorController.h"
#include "InspectorFrontend.h"
#include "InspectorValues.h"
#include "KURL.h"
@@ -56,14 +56,14 @@ static const char* const UserInitiatedProfileName = "org.webkit.profiles.user-in
static const char* const CPUProfileType = "CPU";
static const char* const HeapProfileType = "HEAP";
-PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InspectorController* inspectorController)
+PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InspectorAgent* inspectorAgent)
{
- OwnPtr<InspectorProfilerAgent> agent = adoptPtr(new InspectorProfilerAgent(inspectorController));
+ OwnPtr<InspectorProfilerAgent> agent = adoptPtr(new InspectorProfilerAgent(inspectorAgent));
return agent.release();
}
-InspectorProfilerAgent::InspectorProfilerAgent(InspectorController* inspectorController)
- : m_inspectorController(inspectorController)
+InspectorProfilerAgent::InspectorProfilerAgent(InspectorAgent* inspectorAgent)
+ : m_inspectorAgent(inspectorAgent)
, m_frontend(0)
, m_enabled(ScriptProfiler::isProfilerAlwaysEnabled())
, m_recordingUserInitiatedProfile(false)
@@ -93,7 +93,7 @@ void InspectorProfilerAgent::addProfileFinishedMessageToConsole(PassRefPtr<Scrip
RefPtr<ScriptProfile> profile = prpProfile;
String title = profile->title();
String message = makeString("Profile \"webkit-profile://", CPUProfileType, '/', encodeWithURLEscapeSequences(title), '#', String::number(profile->uid()), "\" finished.");
- m_inspectorController->consoleAgent()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
+ m_inspectorAgent->consoleAgent()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
}
void InspectorProfilerAgent::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL)
@@ -101,7 +101,7 @@ void InspectorProfilerAgent::addStartProfilingMessageToConsole(const String& tit
if (!m_frontend)
return;
String message = makeString("Profile \"webkit-profile://", CPUProfileType, '/', encodeWithURLEscapeSequences(title), "#0\" started.");
- m_inspectorController->consoleAgent()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
+ m_inspectorAgent->consoleAgent()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
}
PassRefPtr<InspectorObject> InspectorProfilerAgent::createProfileHeader(const ScriptProfile& profile)
@@ -235,7 +235,7 @@ void InspectorProfilerAgent::startUserInitiatedProfiling()
m_recordingUserInitiatedProfile = true;
String title = getCurrentUserInitiatedProfileName(true);
#if USE(JSC)
- JSC::ExecState* scriptState = toJSDOMWindow(m_inspectorController->inspectedPage()->mainFrame(), debuggerWorld())->globalExec();
+ JSC::ExecState* scriptState = toJSDOMWindow(m_inspectorAgent->inspectedPage()->mainFrame(), debuggerWorld())->globalExec();
#else
ScriptState* scriptState = 0;
#endif
@@ -251,7 +251,7 @@ void InspectorProfilerAgent::stopUserInitiatedProfiling(bool ignoreProfile)
m_recordingUserInitiatedProfile = false;
String title = getCurrentUserInitiatedProfileName();
#if USE(JSC)
- JSC::ExecState* scriptState = toJSDOMWindow(m_inspectorController->inspectedPage()->mainFrame(), debuggerWorld())->globalExec();
+ JSC::ExecState* scriptState = toJSDOMWindow(m_inspectorAgent->inspectedPage()->mainFrame(), debuggerWorld())->globalExec();
#else
// Use null script state to avoid filtering by context security token.
// All functions from all iframes should be visible from Inspector UI.
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.h b/Source/WebCore/inspector/InspectorProfilerAgent.h
index 436ae51..09de717 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.h
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.h
@@ -41,7 +41,7 @@
namespace WebCore {
class InspectorArray;
-class InspectorController;
+class InspectorAgent;
class InspectorFrontend;
class InspectorObject;
class ScriptHeapSnapshot;
@@ -50,7 +50,7 @@ class ScriptProfile;
class InspectorProfilerAgent {
WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED;
public:
- static PassOwnPtr<InspectorProfilerAgent> create(InspectorController*);
+ static PassOwnPtr<InspectorProfilerAgent> create(InspectorAgent*);
virtual ~InspectorProfilerAgent();
void addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL);
@@ -77,11 +77,11 @@ private:
typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap;
typedef HashMap<unsigned int, RefPtr<ScriptHeapSnapshot> > HeapSnapshotsMap;
- InspectorProfilerAgent(InspectorController*);
+ InspectorProfilerAgent(InspectorAgent*);
PassRefPtr<InspectorObject> createProfileHeader(const ScriptProfile& profile);
PassRefPtr<InspectorObject> createSnapshotHeader(const ScriptHeapSnapshot& snapshot);
- InspectorController* m_inspectorController;
+ InspectorAgent* m_inspectorAgent;
InspectorFrontend* m_frontend;
bool m_enabled;
bool m_recordingUserInitiatedProfile;
diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog
index dff8935..445a2a2 100644
--- a/Source/WebKit/qt/ChangeLog
+++ b/Source/WebKit/qt/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-22 Ilya Tikhonovsky <loislo at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: next step in splitting InspectorController.
+
+ #include "InspectorController.h" was added.
+
+ https://bugs.webkit.org/show_bug.cgi?id=52955
+
+ * WebCoreSupport/InspectorServerQt.cpp:
+
2011-01-22 Robert Hogan <robert at webkit.org>
Reviewed by Andreas Kling.
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
index 7002dce..bad26a4 100644
--- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
@@ -22,6 +22,7 @@
#include "InspectorBackendDispatcher.h"
#include "InspectorClientQt.h"
+#include "InspectorController.h"
#include "MD5.h"
#include "Page.h"
#include "qwebpage.h"
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list