2011-02-02 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Feb 2011 17:32:44 +0000 (17:32 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Feb 2011 17:32:44 +0000 (17:32 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: move InspectorController's methods from InspectorAgent to InspectorController.

        https://bugs.webkit.org/show_bug.cgi?id=53169

        All the Inspector API for WebCore has two parts.
        The first one is InspectorInstrumentation for WebCore.
        The second is InspectorController for WebKit.
        InspectorAgent was produced by renaming original InspectorController.
        This patch extracts WebKit related methods from InspectorAgent to InspectorController.

        * WebCore.exp.in:
        * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp:
        * html/HTMLDocument.cpp:
        (WebCore::HTMLDocument::createParser):
        * inspector/InspectorAgent.cpp:
        (WebCore::InspectorAgent::InspectorAgent):
        (WebCore::InspectorAgent::~InspectorAgent):
        (WebCore::InspectorAgent::restoreInspectorStateFromCookie):
        (WebCore::InspectorAgent::inspect):
        (WebCore::InspectorAgent::handleMousePress):
        (WebCore::InspectorAgent::didClearWindowObjectInWorld):
        (WebCore::InspectorAgent::setFrontend):
        (WebCore::InspectorAgent::disconnectFrontend):
        (WebCore::InspectorAgent::resourceAgent):
        (WebCore::InspectorAgent::createFrontendLifetimeAgents):
        (WebCore::InspectorAgent::releaseFrontendLifetimeAgents):
        (WebCore::InspectorAgent::populateScriptObjects):
        (WebCore::InspectorAgent::pushDataCollectedOffline):
        (WebCore::InspectorAgent::restoreProfiler):
        (WebCore::InspectorAgent::startTimelineProfiler):
        (WebCore::PostWorkerNotificationToFrontendTask::performTask):
        (WebCore::InspectorAgent::didOpenDatabase):
        (WebCore::InspectorAgent::didUseDOMStorage):
        (WebCore::InspectorAgent::showAndEnableDebugger):
        (WebCore::InspectorAgent::enableDebugger):
        (WebCore::InspectorAgent::enabled):
        * inspector/InspectorAgent.h:
        (WebCore::InspectorAgent::frontend):
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::InspectorController):
        (WebCore::InspectorController::~InspectorController):
        (WebCore::InspectorController::setInspectorFrontendClient):
        (WebCore::InspectorController::hasInspectorFrontendClient):
        (WebCore::InspectorController::didClearWindowObjectInWorld):
        (WebCore::InspectorController::startTimelineProfiler):
        (WebCore::InspectorController::stopTimelineProfiler):
        (WebCore::InspectorController::connectFrontend):
        (WebCore::InspectorController::disconnectFrontend):
        (WebCore::InspectorController::disconnectFrontendImpl):
        (WebCore::InspectorController::show):
        (WebCore::InspectorController::close):
        (WebCore::InspectorController::restoreInspectorStateFromCookie):
        (WebCore::InspectorController::evaluateForTestInFrontend):
        (WebCore::InspectorController::drawNodeHighlight):
        (WebCore::InspectorController::inspect):
        (WebCore::InspectorController::enabled):
        (WebCore::InspectorController::showPanel):
        (WebCore::InspectorController::frontendLoaded):
        (WebCore::InspectorController::timelineProfilerEnabled):
        (WebCore::InspectorController::enableProfiler):
        (WebCore::InspectorController::disableProfiler):
        (WebCore::InspectorController::profilerEnabled):
        (WebCore::InspectorController::debuggerEnabled):
        (WebCore::InspectorController::showAndEnableDebugger):
        (WebCore::InspectorController::disableDebugger):
        (WebCore::InspectorController::startUserInitiatedProfiling):
        (WebCore::InspectorController::stopUserInitiatedProfiling):
        (WebCore::InspectorController::isRecordingUserInitiatedProfile):
        (WebCore::InspectorController::setInspectorExtensionAPI):
        (WebCore::InspectorController::resume):
        (WebCore::InspectorController::hideHighlight):
        (WebCore::InspectorController::dispatchMessageFromFrontend):
        * inspector/InspectorController.h:
        (WebCore::InspectorController::inspectorClient):
        (WebCore::InspectorController::inspectedPage):
        (WebCore::InspectorController::hasFrontend):
        * inspector/InspectorFrontendClientLocal.cpp:
        (WebCore::InspectorFrontendClientLocal::sendMessageToBackend):
        * inspector/InspectorFrontendHost.cpp:
        (WebCore::InspectorFrontendHost::setExtensionAPI):
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
        (WebCore::InspectorInstrumentation::profilerEnabledImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::hasFrontend):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):

2011-02-02  Ilya Tikhonovsky  <loislo@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: move InspectorController's methods from InspectorAgent to InspectorController.

        https://bugs.webkit.org/show_bug.cgi?id=53169

        Minor change enforced by major changes in WebCore/inspector/InspectorController.

        * src/WebDevToolsAgentImpl.cpp:
        (WebKit::WebDevToolsAgentImpl::dispatchOnInspectorBackend):
        * src/WebViewImpl.h:

2011-02-02  Ilya Tikhonovsky  <loislo@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: move InspectorController's methods from InspectorAgent to InspectorController.

        https://bugs.webkit.org/show_bug.cgi?id=53169

        Minor change enforced by major changes in WebCore/inspector/InspectorController.

        * WebCoreSupport/InspectorClientGtk.cpp:
        * webkit/webkitwebinspector.cpp:
        (webkit_web_inspector_get_property):

2011-02-02  Ilya Tikhonovsky  <loislo@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: move InspectorController's methods from InspectorAgent to InspectorController.

        https://bugs.webkit.org/show_bug.cgi?id=53169

        Minor change enforced by major changes in WebCore/inspector/InspectorController.

        * WebInspector/WebInspector.mm:
        (-[WebInspector isTimelineProfilingEnabled]):

2011-02-02  Ilya Tikhonovsky  <loislo@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: move InspectorController's methods from InspectorAgent to InspectorController.

        https://bugs.webkit.org/show_bug.cgi?id=53169

        Minor change enforced by major changes in WebCore/inspector/InspectorController.

        * WebInspector.cpp:
        (WebInspector::isTimelineProfilingEnabled):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77950 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
Source/WebCore/html/HTMLDocument.cpp
Source/WebCore/inspector/InspectorAgent.cpp
Source/WebCore/inspector/InspectorAgent.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
Source/WebKit/gtk/webkit/webkitwebinspector.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebInspector/WebInspector.mm
Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebInspector.cpp

index 40df7a8c7d5931e973f1452e3dc844f61ce176b1..bb306fe2c05e7198543107ae2345fa632e0700a3 100644 (file)
@@ -1,3 +1,95 @@
+2011-02-02  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: move InspectorController's methods from InspectorAgent to InspectorController.
+
+        https://bugs.webkit.org/show_bug.cgi?id=53169
+
+        All the Inspector API for WebCore has two parts.
+        The first one is InspectorInstrumentation for WebCore.
+        The second is InspectorController for WebKit.
+        InspectorAgent was produced by renaming original InspectorController.
+        This patch extracts WebKit related methods from InspectorAgent to InspectorController.
+
+        * WebCore.exp.in:
+        * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp:
+        * html/HTMLDocument.cpp:
+        (WebCore::HTMLDocument::createParser):
+        * inspector/InspectorAgent.cpp:
+        (WebCore::InspectorAgent::InspectorAgent):
+        (WebCore::InspectorAgent::~InspectorAgent):
+        (WebCore::InspectorAgent::restoreInspectorStateFromCookie):
+        (WebCore::InspectorAgent::inspect):
+        (WebCore::InspectorAgent::handleMousePress):
+        (WebCore::InspectorAgent::didClearWindowObjectInWorld):
+        (WebCore::InspectorAgent::setFrontend):
+        (WebCore::InspectorAgent::disconnectFrontend):
+        (WebCore::InspectorAgent::resourceAgent):
+        (WebCore::InspectorAgent::createFrontendLifetimeAgents):
+        (WebCore::InspectorAgent::releaseFrontendLifetimeAgents):
+        (WebCore::InspectorAgent::populateScriptObjects):
+        (WebCore::InspectorAgent::pushDataCollectedOffline):
+        (WebCore::InspectorAgent::restoreProfiler):
+        (WebCore::InspectorAgent::startTimelineProfiler):
+        (WebCore::PostWorkerNotificationToFrontendTask::performTask):
+        (WebCore::InspectorAgent::didOpenDatabase):
+        (WebCore::InspectorAgent::didUseDOMStorage):
+        (WebCore::InspectorAgent::showAndEnableDebugger):
+        (WebCore::InspectorAgent::enableDebugger):
+        (WebCore::InspectorAgent::enabled):
+        * inspector/InspectorAgent.h:
+        (WebCore::InspectorAgent::frontend):
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::~InspectorController):
+        (WebCore::InspectorController::setInspectorFrontendClient):
+        (WebCore::InspectorController::hasInspectorFrontendClient):
+        (WebCore::InspectorController::didClearWindowObjectInWorld):
+        (WebCore::InspectorController::startTimelineProfiler):
+        (WebCore::InspectorController::stopTimelineProfiler):
+        (WebCore::InspectorController::connectFrontend):
+        (WebCore::InspectorController::disconnectFrontend):
+        (WebCore::InspectorController::disconnectFrontendImpl):
+        (WebCore::InspectorController::show):
+        (WebCore::InspectorController::close):
+        (WebCore::InspectorController::restoreInspectorStateFromCookie):
+        (WebCore::InspectorController::evaluateForTestInFrontend):
+        (WebCore::InspectorController::drawNodeHighlight):
+        (WebCore::InspectorController::inspect):
+        (WebCore::InspectorController::enabled):
+        (WebCore::InspectorController::showPanel):
+        (WebCore::InspectorController::frontendLoaded):
+        (WebCore::InspectorController::timelineProfilerEnabled):
+        (WebCore::InspectorController::enableProfiler):
+        (WebCore::InspectorController::disableProfiler):
+        (WebCore::InspectorController::profilerEnabled):
+        (WebCore::InspectorController::debuggerEnabled):
+        (WebCore::InspectorController::showAndEnableDebugger):
+        (WebCore::InspectorController::disableDebugger):
+        (WebCore::InspectorController::startUserInitiatedProfiling):
+        (WebCore::InspectorController::stopUserInitiatedProfiling):
+        (WebCore::InspectorController::isRecordingUserInitiatedProfile):
+        (WebCore::InspectorController::setInspectorExtensionAPI):
+        (WebCore::InspectorController::resume):
+        (WebCore::InspectorController::hideHighlight):
+        (WebCore::InspectorController::dispatchMessageFromFrontend):
+        * inspector/InspectorController.h:
+        (WebCore::InspectorController::inspectorClient):
+        (WebCore::InspectorController::inspectedPage):
+        (WebCore::InspectorController::hasFrontend):
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::sendMessageToBackend):
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::setExtensionAPI):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
+        (WebCore::InspectorInstrumentation::profilerEnabledImpl):
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::hasFrontend):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
+
 2011-02-08  George Wright  <gwright@rim.com>
 
         Reviewed by Adam Barth.
index bd49c1feaf687fa67f7393f9d410503c64aef07f..096834d563fa98221cd88aba30f40fab2fa1a4c6 100644 (file)
@@ -1404,23 +1404,26 @@ __ZN7WebCore22GeolocationServiceMock8setErrorEN3WTF10PassRefPtrINS_13PositionErr
 #endif
 
 #if ENABLE(INSPECTOR)
-__ZN7WebCore14InspectorAgent4showEv
-__ZN7WebCore14InspectorAgent5closeEv
-__ZN7WebCore14InspectorAgent9showPanelERKN3WTF6StringE
-__ZN7WebCore14InspectorAgent12ConsolePanelE
-__ZN7WebCore14InspectorAgent13ProfilesPanelE
-__ZN7WebCore14InspectorAgent14enableProfilerEv
-__ZN7WebCore14InspectorAgent15disableDebuggerEv
-__ZN7WebCore14InspectorAgent15disableProfilerEv
-__ZN7WebCore14InspectorAgent18disconnectFrontendEv
-__ZN7WebCore14InspectorAgent20stopTimelineProfilerEv
-__ZN7WebCore14InspectorAgent21showAndEnableDebuggerEv
-__ZN7WebCore14InspectorAgent21startTimelineProfilerEv
-__ZN7WebCore14InspectorAgent25evaluateForTestInFrontendElRKN3WTF6StringE
-__ZN7WebCore14InspectorAgent26setInspectorFrontendClientEN3WTF10PassOwnPtrINS_23InspectorFrontendClientEEE
-__ZN7WebCore14InspectorAgent26stopUserInitiatedProfilingEv
-__ZN7WebCore14InspectorAgent27startUserInitiatedProfilingEv
 __ZN7WebCore15InspectorClient31doDispatchMessageOnFrontendPageEPNS_4PageERKN3WTF6StringE
+__ZN7WebCore19InspectorController12ConsolePanelE
+__ZN7WebCore19InspectorController13ProfilesPanelE
+__ZN7WebCore19InspectorController14enableProfilerEv
+__ZN7WebCore19InspectorController15debuggerEnabledEv
+__ZN7WebCore19InspectorController15disableDebuggerEv
+__ZN7WebCore19InspectorController15disableProfilerEv
+__ZN7WebCore19InspectorController15profilerEnabledEv
+__ZN7WebCore19InspectorController18disconnectFrontendEv
+__ZN7WebCore19InspectorController20stopTimelineProfilerEv
+__ZN7WebCore19InspectorController21showAndEnableDebuggerEv
+__ZN7WebCore19InspectorController21startTimelineProfilerEv
+__ZN7WebCore19InspectorController23timelineProfilerEnabledEv
+__ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKN3WTF6StringE
+__ZN7WebCore19InspectorController26setInspectorFrontendClientEN3WTF10PassOwnPtrINS_23InspectorFrontendClientEEE
+__ZN7WebCore19InspectorController26stopUserInitiatedProfilingEv
+__ZN7WebCore19InspectorController27startUserInitiatedProfilingEv
+__ZN7WebCore19InspectorController4showEv
+__ZN7WebCore19InspectorController5closeEv
+__ZN7WebCore19InspectorController9showPanelERKN3WTF6StringE
 __ZN7WebCore28InspectorFrontendClientLocal12moveWindowByEff
 __ZN7WebCore28InspectorFrontendClientLocal14frontendLoadedEv
 __ZN7WebCore28InspectorFrontendClientLocal15canAttachWindowEv
@@ -1432,9 +1435,8 @@ __ZN7WebCore28InspectorFrontendClientLocal26changeAttachedWindowHeightEj
 __ZN7WebCore28InspectorFrontendClientLocal27restoreAttachedWindowHeightEv
 __ZN7WebCore28InspectorFrontendClientLocalC2EPNS_19InspectorControllerEPNS_4PageEN3WTF10PassOwnPtrINS0_8SettingsEEE
 __ZN7WebCore28InspectorFrontendClientLocalD2Ev
-__ZNK7WebCore14InspectorAgent15profilerEnabledEv
-__ZNK7WebCore14InspectorAgent17drawNodeHighlightERNS_15GraphicsContextE
-__ZNK7WebCore14InspectorAgent31isRecordingUserInitiatedProfileEv
+__ZNK7WebCore19InspectorController17drawNodeHighlightERNS_15GraphicsContextE
+__ZNK7WebCore19InspectorController31isRecordingUserInitiatedProfileEv
 #endif
 
 #if ENABLE(JAVA_BRIDGE)
index 94fa86ebd192ca7eb22de9aca34e1f8b1e01c021..a8d8d0b5d11e6767aee30a794231712f1ff519b9 100644 (file)
@@ -32,6 +32,7 @@
 #include "V8InspectorFrontendHost.h"
 
 #include "InspectorController.h"
+#include "InspectorFrontendClient.h"
 #include "InspectorFrontendHost.h"
 #include "PlatformString.h"
 
index 36c1f5f8541d81904faa9b810627246d9e4ae6dc..17ce60be2e85402c4c567e33c6176ceea2b57bc6 100644 (file)
@@ -69,7 +69,7 @@
 #include "HTMLBodyElement.h"
 #include "HTMLElementFactory.h"
 #include "HTMLNames.h"
-#include "InspectorController.h"
+#include "InspectorInstrumentation.h"
 #include "KURL.h"
 #include "Page.h"
 #include "Settings.h"
@@ -277,11 +277,7 @@ void HTMLDocument::releaseEvents()
 
 PassRefPtr<DocumentParser> HTMLDocument::createParser()
 {
-    bool reportErrors = false;
-#if ENABLE(INSPECTOR)
-    if (Page* page = this->page())
-        reportErrors = page->inspectorController()->hasFrontend();
-#endif
+    bool reportErrors = InspectorInstrumentation::hasFrontend(this->page());
     return HTMLDocumentParser::create(this, reportErrors);
 }
 
index ea4dc0f776b490ae575db3402e20b506bdbba379..607c7af00642acc65fc744b406f3bbfef2eb0c70 100644 (file)
@@ -56,7 +56,6 @@
 #include "HitTestResult.h"
 #include "InjectedScript.h"
 #include "InjectedScriptHost.h"
-#include "InspectorBackendDispatcher.h"
 #include "InspectorBrowserDebuggerAgent.h"
 #include "InspectorCSSAgent.h"
 #include "InspectorClient.h"
@@ -137,19 +136,13 @@ static const char debuggerEnabled[] = "debuggerEnabled";
 static const char profilerEnabled[] = "profilerEnabled";
 }
 
-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_frontend(0)
     , 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)
@@ -192,13 +185,6 @@ void InspectorAgent::inspectedPageDestroyed()
     m_client = 0;
 }
 
-bool InspectorAgent::enabled() const
-{
-    if (!m_inspectedPage)
-        return false;
-    return m_inspectedPage->settings()->developerExtrasEnabled();
-}
-
 bool InspectorAgent::searchingForNodeInPage() const
 {
     return m_state->getBoolean(InspectorAgentState::searchingForNode);
@@ -209,14 +195,14 @@ void InspectorAgent::restoreInspectorStateFromCookie(const String& inspectorStat
     m_state->restoreFromInspectorCookie(inspectorStateCookie);
 
     if (!m_frontend) {
-        connectFrontend();
+        m_inspectorController->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());
+    m_resourceAgent = InspectorResourceAgent::restore(m_inspectedPage, m_state.get(), m_frontend);
 
     if (m_state->getBoolean(InspectorAgentState::timelineProfilerEnabled))
         startTimelineProfiler();
@@ -231,11 +217,6 @@ void InspectorAgent::restoreInspectorStateFromCookie(const String& inspectorStat
 
 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;
@@ -319,33 +300,24 @@ bool InspectorAgent::handleMousePress()
     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) {
+                  it != m_scriptsToEvaluateOnLoad.end(); ++it) {
                 m_injectedScriptHost->injectScript(*it, scriptState);
             }
         }
     }
+
     if (!m_inspectorExtensionAPI.isEmpty())
         m_injectedScriptHost->injectScript(m_inspectorExtensionAPI, mainWorldScriptState(frame));
 }
@@ -365,80 +337,21 @@ void InspectorAgent::setSearchingForNode(bool enabled, bool* newState)
     setSearchingForNode(enabled);
 }
 
-void InspectorAgent::connectFrontend()
+void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
 {
-    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
+    m_frontend = inspectorFrontend;
+    createFrontendLifetimeAgents();
 
-#if ENABLE(DOM_STORAGE)
-    m_domStorageAgent = InspectorDOMStorageAgent::create(&m_domStorageResources, m_frontend.get());
-#endif
+    m_cssAgent->setDOMAgent(m_domAgent.get());
 
     if (m_timelineAgent)
-        m_timelineAgent->resetFrontendProxyObject(m_frontend.get());
+        m_timelineAgent->resetFrontendProxyObject(m_frontend);
 
-    m_consoleAgent->setFrontend(m_frontend.get());
+    m_consoleAgent->setFrontend(m_frontend);
 
     // 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()
@@ -446,11 +359,9 @@ void InspectorAgent::disconnectFrontend()
     if (!m_frontend)
         return;
 
-    m_frontend.clear();
+    m_frontend = 0;
 
-    InspectorInstrumentation::frontendDeleted();
-    if (!InspectorInstrumentation::hasFrontends())
-        ScriptController::setCaptureCallStackForUncaughtExceptions(false);
+    m_inspectorController->disconnectFrontendImpl();
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     // If the window is being closed with the debugger enabled,
@@ -460,7 +371,6 @@ void InspectorAgent::disconnectFrontend()
 #endif
     setSearchingForNode(false);
     unbindAllResources();
-    stopTimelineProfiler();
 
     hideHighlight();
 
@@ -478,10 +388,32 @@ void InspectorAgent::disconnectFrontend()
 InspectorResourceAgent* InspectorAgent::resourceAgent()
 {
     if (!m_resourceAgent && m_frontend)
-        m_resourceAgent = InspectorResourceAgent::create(m_inspectedPage, m_state.get(), m_frontend.get());
+        m_resourceAgent = InspectorResourceAgent::create(m_inspectedPage, m_state.get(), m_frontend);
     return m_resourceAgent.get();
 }
 
+void InspectorAgent::createFrontendLifetimeAgents()
+{
+    m_domAgent = InspectorDOMAgent::create(m_injectedScriptHost.get(), m_frontend);
+    m_runtimeAgent = InspectorRuntimeAgent::create(m_injectedScriptHost.get());
+
+#if ENABLE(DATABASE)
+    m_databaseAgent = InspectorDatabaseAgent::create(&m_databaseResources, m_frontend);
+#endif
+
+#if ENABLE(DOM_STORAGE)
+    m_domStorageAgent = InspectorDOMStorageAgent::create(&m_domStorageResources, m_frontend);
+#endif
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    m_applicationCacheAgent = new InspectorApplicationCacheAgent(this, m_frontend);
+#endif
+
+#if ENABLE(FILE_SYSTEM)
+    m_fileSystemAgent = InspectorFileSystemAgent::create(this, m_frontend);
+#endif
+}
+
 void InspectorAgent::releaseFrontendLifetimeAgents()
 {
     m_resourceAgent.clear();
@@ -515,6 +447,7 @@ void InspectorAgent::releaseFrontendLifetimeAgents()
         m_fileSystemAgent->stop();
         m_fileSystemAgent.clear();
 #endif
+    stopTimelineProfiler();
 }
 
 void InspectorAgent::populateScriptObjects()
@@ -523,11 +456,6 @@ void InspectorAgent::populateScriptObjects()
     if (!m_frontend)
         return;
 
-    if (!m_showAfterVisible.isEmpty()) {
-        showPanel(m_showAfterVisible);
-        m_showAfterVisible = "";
-    }
-
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     if (m_profilerAgent->enabled())
         m_frontend->profilerWasEnabled();
@@ -538,13 +466,18 @@ void InspectorAgent::populateScriptObjects()
     if (m_nodeToFocus)
         focusNode();
 
+    if (!m_requiredPanel.isEmpty()) {
+        m_frontend->showPanel(m_requiredPanel);
+        m_requiredPanel = "";
+    }
+
+    restoreDebugger(true);
+    restoreProfiler(ProfilerRestoreNoAction);
+
     // 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(true);
-    restoreProfiler(ProfilerRestoreNoAction);
 }
 
 void InspectorAgent::pushDataCollectedOffline()
@@ -554,12 +487,12 @@ void InspectorAgent::pushDataCollectedOffline()
 #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());
+        it->second->bind(m_frontend);
 #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());
+        it->second->bind(m_frontend);
 #endif
 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS)
     WorkersMap::iterator workersEnd = m_workers.end();
@@ -583,7 +516,7 @@ void InspectorAgent::restoreProfiler(ProfilerRestoreAction action)
 {
     ASSERT(m_frontend);
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    m_profilerAgent->setFrontend(m_frontend.get());
+    m_profilerAgent->setFrontend(m_frontend);
     if (m_state->getBoolean(InspectorAgentState::profilerEnabled))
         enableProfiler();
     if (action == ProfilerRestoreResetAgent)
@@ -708,7 +641,7 @@ void InspectorAgent::startTimelineProfiler()
     if (m_timelineAgent)
         return;
 
-    m_timelineAgent = new InspectorTimelineAgent(m_frontend.get());
+    m_timelineAgent = new InspectorTimelineAgent(m_frontend);
     if (m_frontend)
         m_frontend->timelineProfilerWasStarted();
 
@@ -748,8 +681,8 @@ private:
     virtual void performTask(ScriptExecutionContext* scriptContext)
     {
         if (scriptContext->isDocument()) {
-            if (InspectorAgent* inspector = static_cast<Document*>(scriptContext)->page()->inspectorController())
-                inspector->postWorkerNotificationToFrontend(*m_worker, m_action);
+            if (InspectorAgent* inspectorAgent = static_cast<Document*>(scriptContext)->page()->inspectorController()->m_inspectorAgent.get())
+                inspectorAgent->postWorkerNotificationToFrontend(*m_worker, m_action);
         }
     }
 
@@ -811,7 +744,7 @@ void InspectorAgent::didOpenDatabase(PassRefPtr<Database> database, const String
 
     // Resources are only bound while visible.
     if (m_frontend)
-        resource->bind(m_frontend.get());
+        resource->bind(m_frontend);
 }
 #endif
 
@@ -917,7 +850,7 @@ void InspectorAgent::didUseDOMStorage(StorageArea* storageArea, bool isLocalStor
 
     // Resources are only bound while visible.
     if (m_frontend)
-        resource->bind(m_frontend.get());
+        resource->bind(m_frontend);
 }
 #endif
 
@@ -1005,7 +938,7 @@ void InspectorAgent::showAndEnableDebugger()
 
     if (!m_frontend) {
         m_state->setBoolean(InspectorAgentState::debuggerEnabled, true);
-        showPanel(ScriptsPanel);
+        showPanel(InspectorController::ScriptsPanel);
     } else
         enableDebugger(true);
 }
@@ -1017,7 +950,7 @@ void InspectorAgent::enableDebugger(bool eraseStickyBreakpoints)
     m_state->setBoolean(InspectorAgentState::debuggerEnabled, true);
     ASSERT(m_inspectedPage);
 
-    m_debuggerAgent = InspectorDebuggerAgent::create(this, m_frontend.get(), eraseStickyBreakpoints);
+    m_debuggerAgent = InspectorDebuggerAgent::create(this, m_frontend, eraseStickyBreakpoints);
     m_browserDebuggerAgent = InspectorBrowserDebuggerAgent::create(this, eraseStickyBreakpoints);
 
     m_frontend->debuggerWasEnabled();
@@ -1358,6 +1291,20 @@ void InspectorAgent::reloadPage(bool ignoreCache)
     m_inspectedPage->mainFrame()->loader()->reload(ignoreCache);
 }
 
+bool InspectorAgent::enabled() const
+{
+    return m_inspectorController->enabled();
+}
+
+void InspectorAgent::showPanel(const String& panel)
+{
+    if (!m_frontend) {
+        m_requiredPanel = panel;
+        return;
+    }
+    m_frontend->showPanel(panel);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
index 29116ca54bfb9be38f885a85778156de51308c86..e1cc07b8da3ae2598232070cd3c340e1de1919a2 100644 (file)
@@ -56,7 +56,6 @@ class HitTestResult;
 class InjectedScript;
 class InjectedScriptHost;
 class InspectorArray;
-class InspectorBackendDispatcher;
 class InspectorBrowserDebuggerAgent;
 class InspectorClient;
 class InspectorConsoleAgent;
@@ -109,15 +108,9 @@ 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(); }
 
@@ -129,26 +122,22 @@ public:
     KURL inspectedURL() const;
     KURL inspectedURLWithoutFragment() const;
     void reloadPage(bool ignoreCache);
+    void showPanel(const String& panel);
 
     void restoreInspectorStateFromCookie(const String& inspectorCookie);
 
-    void inspect(Node*);
     void highlight(Node*);
     void hideHighlight();
+    void inspect(Node*);
     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 setFrontend(InspectorFrontend*);
+    InspectorFrontend* frontend() const { return m_frontend; }
     void disconnectFrontend();
-    InspectorFrontend* frontend() const { return m_frontend.get(); }
 
     InspectorResourceAgent* resourceAgent();
 
@@ -178,20 +167,14 @@ public:
     InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); }
 #endif
 
-
+    bool handleMousePress();
     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();
 
@@ -280,6 +263,7 @@ private:
     void setSearchingForNode(bool enabled);
 
     void releaseFrontendLifetimeAgents();
+    void createFrontendLifetimeAgents();
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     void toggleRecordButton(bool);
@@ -294,9 +278,7 @@ private:
     InspectorController* m_inspectorController;
     Page* m_inspectedPage;
     InspectorClient* m_client;
-    OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
-    bool m_openingFrontend;
-    OwnPtr<InspectorFrontend> m_frontend;
+    InspectorFrontend* m_frontend;
     OwnPtr<InspectorCSSAgent> m_cssAgent;
     RefPtr<InspectorDOMAgent> m_domAgent;
 
@@ -319,6 +301,7 @@ private:
     RefPtr<InspectorFileSystemAgent> m_fileSystemAgent;
 #endif
 
+    RefPtr<Node> m_highlightedNode;
     RefPtr<Node> m_nodeToFocus;
     RefPtr<InspectorResourceAgent> m_resourceAgent;
     OwnPtr<InspectorRuntimeAgent> m_runtimeAgent;
@@ -332,13 +315,11 @@ private:
     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;
+    String m_requiredPanel;
     Vector<String> m_scriptsToEvaluateOnLoad;
     String m_inspectorExtensionAPI;
 #if ENABLE(JAVASCRIPT_DEBUGGER)
index fb8409eab578fec130344673f36f83be1232739d..5ff933398ceebb3307273eb19798f396c1fa16d1 100644 (file)
 
 #if ENABLE(INSPECTOR)
 
+#include "Frame.h"
+#include "GraphicsContext.h"
+#include "InjectedScriptHost.h"
+#include "InspectorAgent.h"
+#include "InspectorBackendDispatcher.h"
+#include "InspectorDebuggerAgent.h"
 #include "InspectorClient.h"
+#include "InspectorFrontend.h"
+#include "InspectorFrontendClient.h"
+#include "InspectorInstrumentation.h"
 #include "Page.h"
+#include "ScriptObject.h"
+#include "Settings.h"
 
 namespace WebCore {
 
-// 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.
+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* inspectorClient)
-    : InspectorAgent(this, page, inspectorClient)
+    : m_inspectorAgent(new InspectorAgent(this, page, inspectorClient))
+    , m_inspectorBackendDispatcher(new InspectorBackendDispatcher(m_inspectorAgent.get()))
+    , m_inspectedPage(page)
+    , m_inspectorClient(inspectorClient)
+    , m_openingFrontend(false)
+{
+}
+
+InspectorController::~InspectorController()
+{
+}
+
+void InspectorController::setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient> inspectorFrontendClient)
+{
+    m_inspectorFrontendClient = inspectorFrontendClient;
+}
+
+bool InspectorController::hasInspectorFrontendClient() const
+{
+    return m_inspectorFrontendClient;
+}
+
+void InspectorController::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
+{
+    if (world != mainThreadNormalWorld())
+        return;
+
+    // If the page is supposed to serve as InspectorFrontend notify inspector frontend
+    // client that it's cleared so that the client can expose inspector bindings.
+    if (m_inspectorFrontendClient && frame == m_inspectedPage->mainFrame())
+        m_inspectorFrontendClient->windowObjectCleared();
+}
+
+void InspectorController::startTimelineProfiler()
+{
+    m_inspectorAgent->startTimelineProfiler();
+}
+
+void InspectorController::stopTimelineProfiler()
+{
+    m_inspectorAgent->stopTimelineProfiler();
+}
+
+void InspectorController::connectFrontend()
+{
+    m_openingFrontend = false;
+    m_inspectorFrontend = new InspectorFrontend(m_inspectorClient);
+    m_inspectorAgent->setFrontend(m_inspectorFrontend.get());
+
+    if (!InspectorInstrumentation::hasFrontends())
+        ScriptController::setCaptureCallStackForUncaughtExceptions(true);
+    InspectorInstrumentation::frontendCreated();
+}
+
+void InspectorController::disconnectFrontend()
+{
+    m_inspectorAgent->disconnectFrontend();
+}
+
+void InspectorController::disconnectFrontendImpl()
+{
+    if (!m_inspectorFrontend)
+        return;
+
+    m_inspectorFrontend.clear();
+
+    InspectorInstrumentation::frontendDeleted();
+    if (!InspectorInstrumentation::hasFrontends())
+        ScriptController::setCaptureCallStackForUncaughtExceptions(false);
+}
+
+void InspectorController::show()
+{
+    if (!enabled())
+        return;
+
+    if (m_openingFrontend)
+        return;
+
+    if (m_inspectorFrontend)
+        m_inspectorFrontend->bringToFront();
+    else {
+        m_openingFrontend = true;
+        m_inspectorClient->openInspectorFrontend(this);
+    }
+}
+
+void InspectorController::close()
+{
+    if (!m_inspectorFrontend)
+        return;
+    m_inspectorFrontend->disconnectFromBackend();
+    disconnectFrontend();
+}
+
+void InspectorController::restoreInspectorStateFromCookie(const String& inspectorStateCookie)
+{
+    m_inspectorAgent->restoreInspectorStateFromCookie(inspectorStateCookie);
+}
+
+void InspectorController::evaluateForTestInFrontend(long callId, const String& script)
+{
+    m_inspectorAgent->evaluateForTestInFrontend(callId, script);
+}
+
+void InspectorController::drawNodeHighlight(GraphicsContext& context) const
+{
+    m_inspectorAgent->drawNodeHighlight(context);
+}
+
+void InspectorController::inspect(Node* node)
+{
+    if (!enabled())
+        return;
+
+    show();
+
+    m_inspectorAgent->inspect(node);
+}
+
+bool InspectorController::enabled() const
+{
+    if (!m_inspectedPage)
+        return false;
+
+    return m_inspectedPage->settings()->developerExtrasEnabled();
+}
+
+void InspectorController::showPanel(const String& panel)
 {
+    if (!enabled())
+        return;
+
+    show();
+
+    m_inspectorAgent->showPanel(panel);
 }
 
+bool InspectorController::timelineProfilerEnabled()
+{
+    return m_inspectorAgent->timelineAgent();
+}
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+void InspectorController::enableProfiler()
+{
+    m_inspectorAgent->enableProfiler();
+}
+
+void InspectorController::disableProfiler()
+{
+    m_inspectorAgent->disableProfiler();
+}
+
+bool InspectorController::profilerEnabled()
+{
+    return m_inspectorAgent->profilerEnabled();
+}
+
+bool InspectorController::debuggerEnabled()
+{
+    return m_inspectorAgent->debuggerEnabled();
+}
+
+void InspectorController::showAndEnableDebugger()
+{
+    m_inspectorAgent->showAndEnableDebugger();
+}
+
+void InspectorController::disableDebugger()
+{
+    m_inspectorAgent->disableDebugger();
+}
+
+void InspectorController::startUserInitiatedProfiling()
+{
+    m_inspectorAgent->startUserInitiatedProfiling();
+}
+
+void InspectorController::stopUserInitiatedProfiling()
+{
+    m_inspectorAgent->stopUserInitiatedProfiling();
+}
+
+bool InspectorController::isRecordingUserInitiatedProfile() const
+{
+    return m_inspectorAgent->isRecordingUserInitiatedProfile();
+}
+
+void InspectorController::setInspectorExtensionAPI(const String& source)
+{
+    m_inspectorAgent->setInspectorExtensionAPI(source);
+}
+
+void InspectorController::resume()
+{
+    if (InspectorDebuggerAgent* debuggerAgent = m_inspectorAgent->debuggerAgent())
+        debuggerAgent->resume();
+}
+
+void InspectorController::hideHighlight()
+{
+    m_inspectorAgent->hideHighlight();
+}
+
+void InspectorController::dispatchMessageFromFrontend(const String& message)
+{
+    m_inspectorBackendDispatcher->dispatch(message);
+}
+
+#endif
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
index 42e9615c8ceb7debce5fd174b89bc0419991d763..e30228e3074bf4434a7fe318614f08803d86c3e0 100644 (file)
 #ifndef InspectorController_h
 #define InspectorController_h
 
-#include "InspectorAgent.h"
+#include "PlatformString.h"
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
 
+class DOMWrapperWorld;
+class Frame;
+class GraphicsContext;
+class InspectorAgent;
+class InspectorBackendDispatcher;
 class InspectorClient;
+class InspectorFrontend;
+class InspectorFrontendClient;
 class Page;
+class PostWorkerNotificationToFrontendTask;
+class Node;
 
-// 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 {
+class InspectorController {
+    WTF_MAKE_NONCOPYABLE(InspectorController);
+    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;
+
     InspectorController(Page*, InspectorClient*);
+    ~InspectorController();
+
+    Page* inspectedPage() { return m_inspectedPage; }
+
+    bool enabled() const;
+
+    void show();
+    void showPanel(const String& panel);
+    void close();
+
+    void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient>);
+    bool hasInspectorFrontendClient() const;
+    void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
+    void setInspectorExtensionAPI(const String& source);
+    void dispatchMessageFromFrontend(const String& message);
+
+    bool hasFrontend() const { return m_inspectorFrontend; }
+    void connectFrontend();
+    void disconnectFrontend();
+    void restoreInspectorStateFromCookie(const String& inspectorCookie);
+
+    void inspect(Node*);
+    void drawNodeHighlight(GraphicsContext&) const;
+    void hideHighlight();
+
+    void evaluateForTestInFrontend(long callId, const String& script);
+
+    void startTimelineProfiler();
+    void stopTimelineProfiler();
+    bool timelineProfilerEnabled();
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+    bool profilerEnabled();
+    void enableProfiler();
+    void startUserInitiatedProfiling();
+    bool isRecordingUserInitiatedProfile() const;
+    void stopUserInitiatedProfiling();
+    void disableProfiler();
+    void showAndEnableDebugger();
+    bool debuggerEnabled();
+    void disableDebugger();
+    void resume();
+#endif
+
+private:
+    friend class InspectorAgent;
+    friend class PostWorkerNotificationToFrontendTask;
+
+    void disconnectFrontendImpl(); // used by InspectorAgent
+    void frontendLoaded();
+
+    OwnPtr<InspectorAgent> m_inspectorAgent;
+    OwnPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
+    OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
+    OwnPtr<InspectorFrontend> m_inspectorFrontend;
+    Page* m_inspectedPage;
+    InspectorClient* m_inspectorClient;
+    bool m_openingFrontend;
 };
 
 }
index cecbc76d2a15690d1cb5ed60e1b7be7e20090001..833057d8659b653f7f8183843ff1374b6c92c517 100644 (file)
@@ -161,7 +161,7 @@ unsigned InspectorFrontendClientLocal::constrainedAttachedWindowHeight(unsigned
 
 void InspectorFrontendClientLocal::sendMessageToBackend(const String& message)
 {
-    m_inspectorController->inspectorBackendDispatcher()->dispatch(message);
+    m_inspectorController->dispatchMessageFromFrontend(message);
 }
 
 } // namespace WebCore
index 1796256dde919c755898f80277b7fe78ca6a808f..f2e66bcb1511aafee36911306854a3824fa03c38 100644 (file)
@@ -201,8 +201,8 @@ void InspectorFrontendHost::moveWindowBy(float x, float y) const
 
 void InspectorFrontendHost::setExtensionAPI(const String& script)
 {
-    InspectorAgent* inspector = m_frontendPage->inspectorController();
-    inspector->setInspectorExtensionAPI(script);
+    ASSERT(m_frontendPage->inspectorController());
+    m_frontendPage->inspectorController()->setInspectorExtensionAPI(script);
 }
 
 String InspectorFrontendHost::localizedStringsURL()
index ca758a048ffe32e415c294a4a62e428b6579c917..074505eb8f5f7565bf85cceee531b7171536b4e3 100644 (file)
@@ -551,7 +551,7 @@ void InspectorInstrumentation::consoleMarkTimelineImpl(InspectorAgent* inspector
         String message;
         arguments->getFirstArgumentAsString(message);
         timelineAgent->didMarkTimeline(message);
-    }
+     }
 }
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
@@ -569,24 +569,17 @@ void InspectorInstrumentation::addProfileImpl(InspectorAgent* inspectorAgent, Re
     }
 }
 
-bool InspectorInstrumentation::profilerEnabledImpl(InspectorAgent* inspectorAgent)
-{
-    if (!inspectorAgent->enabled())
-        return false;
-
-    InspectorProfilerAgent* profilerAgent = inspectorAgent->profilerAgent();
-    if (!profilerAgent)
-        return false;
-
-    return profilerAgent->enabled();
-}
-
 String InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(InspectorAgent* inspectorAgent, bool incrementProfileNumber)
 {
     if (InspectorProfilerAgent* profilerAgent = inspectorAgent->profilerAgent())
         return profilerAgent->getCurrentUserInitiatedProfileName(incrementProfileNumber);
     return "";
 }
+
+bool InspectorInstrumentation::profilerEnabledImpl(InspectorAgent* inspectorAgent)
+{
+    return inspectorAgent->profilerEnabled();
+}
 #endif
 
 #if ENABLE(DATABASE)
index a437ba2a4b686e2c3c213630aee9d100fc9005e1..1e382ca1c2e08fd7d3e514c58c29352357ba37be 100644 (file)
@@ -140,8 +140,8 @@ public:
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     static void addStartProfilingMessageToConsole(Page*, const String& title, unsigned lineNumber, const String& sourceURL);
     static void addProfile(Page*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
-    static bool profilerEnabled(Page*);
     static String getCurrentUserInitiatedProfileName(Page*, bool incrementProfileNumber);
+    static bool profilerEnabled(Page*);
 #endif
 
 #if ENABLE(DATABASE)
@@ -176,8 +176,10 @@ public:
     static void frontendCreated() { s_frontendCounter += 1; }
     static void frontendDeleted() { s_frontendCounter -= 1; }
     static bool hasFrontends() { return s_frontendCounter; }
+    static bool hasFrontend(Page*);
 #else
     static bool hasFrontends() { return false; }
+    static bool hasFrontend(Page*) { return false; }
 #endif
 
 private:
@@ -254,8 +256,8 @@ private:
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     static void addStartProfilingMessageToConsoleImpl(InspectorAgent*, const String& title, unsigned lineNumber, const String& sourceURL);
     static void addProfileImpl(InspectorAgent*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
-    static bool profilerEnabledImpl(InspectorAgent*);
     static String getCurrentUserInitiatedProfileNameImpl(InspectorAgent*, bool incrementProfileNumber);
+    static bool profilerEnabledImpl(InspectorAgent*);
 #endif
 
 #if ENABLE(DATABASE)
@@ -834,6 +836,16 @@ inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
 }
 #endif
 
+inline bool InspectorInstrumentation::hasFrontend(Page* page)
+{
+#if ENABLE(INSPECTOR)
+    return inspectorAgentWithFrontendForPage(page);
+#else
+    return false;
+#endif
+}
+
+
 #if ENABLE(INSPECTOR)
 inline InspectorAgent* InspectorInstrumentation::inspectorAgentForContext(ScriptExecutionContext* context)
 {
index f575c7f8fcd13a9abd1066ceaa36da88f6ddd838..7dfbdca4570abbf2c028ef7a6472d9cb924bdc27 100644 (file)
@@ -2975,10 +2975,10 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass
     if (!m_frame->page())
         return;
 
-#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) && USE(JSC)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
     if (Page* page = m_frame->page()) {
         if (page->mainFrame() == m_frame)
-            page->inspectorController()->resume();
+            m_frame->page()->inspectorController()->resume();
     }
 #endif
 
@@ -3380,6 +3380,11 @@ void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
 
     m_client->dispatchDidClearWindowObjectInWorld(world);
 
+#if ENABLE(INSPECTOR)
+    if (Page* page = m_frame->page())
+        page->inspectorController()->didClearWindowObjectInWorld(m_frame, world);
+#endif
+
     InspectorInstrumentation::didClearWindowObjectInWorld(m_frame, world);
 }
 
index 73e179fc3c5db6ff77080039dd1bc989089686c6..391db098133ad32ea303d681c49cd7c1ff5c7762 100644 (file)
@@ -1,3 +1,17 @@
+2011-02-02  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: move InspectorController's methods from InspectorAgent to InspectorController.
+
+        https://bugs.webkit.org/show_bug.cgi?id=53169
+
+        Minor change enforced by major changes in WebCore/inspector/InspectorController.
+
+        * src/WebDevToolsAgentImpl.cpp:
+        (WebKit::WebDevToolsAgentImpl::dispatchOnInspectorBackend):
+        * src/WebViewImpl.h:
+
 2011-02-07  Alexey Marinichev  <amarinichev@chromium.org>
 
         Reviewed by Kenneth Russell.
index 5c039f1689bc34df2b3721bab59ff47f82030d70..2f93d05858b26b0aa592431b03b54970919d832e 100644 (file)
@@ -222,7 +222,7 @@ void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe)
 
 void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message)
 {
-    inspectorController()->inspectorBackendDispatcher()->dispatch(message);
+    inspectorController()->dispatchMessageFromFrontend(message);
 }
 
 void WebDevToolsAgentImpl::inspectElementAt(const WebPoint& point)
index d164a48e9adba7b38f148b20455adad073c7b6c7..7640ceba48ec29a97f18cce0bb72dee4e775429b 100644 (file)
@@ -53,6 +53,7 @@
 
 namespace WebCore {
 class ChromiumDataObject;
+class DocumentLoader;
 class Frame;
 class HistoryItem;
 class HitTestResult;
index b6c8c00ac8b6d3f6df911fdfaf8ac6fabd9900e8..2f16d4f7d1f000b515803cb9ab6058581bc74733 100644 (file)
@@ -1,3 +1,17 @@
+2011-02-02  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: move InspectorController's methods from InspectorAgent to InspectorController.
+
+        https://bugs.webkit.org/show_bug.cgi?id=53169
+
+        Minor change enforced by major changes in WebCore/inspector/InspectorController.
+
+        * WebCoreSupport/InspectorClientGtk.cpp:
+        * webkit/webkitwebinspector.cpp:
+        (webkit_web_inspector_get_property):
+
 2011-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Reviewed by Martin Robinson.
index bd6a198e82a4c31b1fb5baf19292c45882d8c4b1..66f375aceb56bf1824725bd6749e53241ee6b849 100644 (file)
@@ -23,6 +23,7 @@
 #include "Frame.h"
 #include "InspectorController.h"
 #include "NotImplemented.h"
+#include "Page.h"
 #include "PlatformString.h"
 #include "webkitversion.h"
 #include "webkitwebinspector.h"
index df63c6340cf36b724be400df0bf052df0d2a496c..8b5b5ac4bbfd6253de97ab757cb7412dab27edc1 100644 (file)
@@ -29,6 +29,7 @@
 #include "HitTestResult.h"
 #include "InspectorClientGtk.h"
 #include "InspectorController.h"
+#include "InspectorInstrumentation.h"
 #include "IntPoint.h"
 #include "Page.h"
 #include "RenderLayer.h"
@@ -397,7 +398,7 @@ static void webkit_web_inspector_get_property(GObject* object, guint prop_id, GV
 #endif
         break;
     case PROP_TIMELINE_PROFILING_ENABLED:
-        g_value_set_boolean(value, priv->page->inspectorController()->timelineAgent() != 0);
+        g_value_set_boolean(value, priv->page->inspectorController()->timelineProfilerEnabled());
         break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
index a769d1de7a599c4fe7b17fb8ed3c1bb42e8ed98a..ecaddf8a6101edac1bde7bbb809f0d0a98def2a4 100644 (file)
@@ -1,3 +1,16 @@
+2011-02-02  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: move InspectorController's methods from InspectorAgent to InspectorController.
+
+        https://bugs.webkit.org/show_bug.cgi?id=53169
+
+        Minor change enforced by major changes in WebCore/inspector/InspectorController.
+
+        * WebInspector/WebInspector.mm:
+        (-[WebInspector isTimelineProfilingEnabled]):
+
 2011-02-07  Enrica Casucci  <enrica@apple.com>
 
         Reviewed Adam Roben and Darin Adler.
index 8ab049f8de525d902b5378d06c4608bc7703ea53..c000f0c3b04a4354da4875d70b3fda5e66ce2125 100644 (file)
@@ -157,7 +157,7 @@ using namespace WebCore;
 - (BOOL)isTimelineProfilingEnabled
 {
     if (Page* page = core(_webView))
-        return page->inspectorController()->timelineAgent() ? YES : NO;
+        return page->inspectorController()->timelineProfilerEnabled() ? YES : NO;
     return NO;
 }
 
index 6aec5e245cc521877de536d02b105bbd86d545cf..f364b28b17ec38d11711b5facf461f0f6ac6cc79 100644 (file)
@@ -32,7 +32,6 @@
 #include "InspectorClientQt.h"
 
 #include "Frame.h"
-#include "InspectorBackendDispatcher.h"
 #include "InspectorController.h"
 #include "InspectorFrontend.h"
 #include "InspectorServerQt.h"
index bad26a4ee6b90e2e5a571576b6c61aec75eb3948..f83deb2b9410854efa72c38b6c22a5885b7cf2e0 100644 (file)
@@ -20,7 +20,6 @@
 #include "config.h"
 #include "InspectorServerQt.h"
 
-#include "InspectorBackendDispatcher.h"
 #include "InspectorClientQt.h"
 #include "InspectorController.h"
 #include "MD5.h"
@@ -364,7 +363,7 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead()
 #if ENABLE(INSPECTOR)
         if (m_inspectorClient) {
           InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->d->page->inspectorController();
-          inspectorController->inspectorBackendDispatcher()->dispatch(QString::fromUtf8(payload));
+          inspectorController->dispatchMessageFromFrontend(QString::fromUtf8(payload));
         }
 #endif
 
index da6239713688392164a48e30d04ebc05ee04cdfd..e62392ca4450f57de5d4baa3beb5f0ae9651fd38 100644 (file)
@@ -1,3 +1,16 @@
+2011-02-02  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: move InspectorController's methods from InspectorAgent to InspectorController.
+
+        https://bugs.webkit.org/show_bug.cgi?id=53169
+
+        Minor change enforced by major changes in WebCore/inspector/InspectorController.
+
+        * WebInspector.cpp:
+        (WebInspector::isTimelineProfilingEnabled):
+
 2011-02-07  Enrica Casucci  <enrica@apple.com>
 
         Reviewed Adam Roben and Darin Adler.
index c3823b21203cc31ad96366fcbeb1b63537364c2b..4e95fd1701dc297d2cad54da9e9af15f274522c1 100644 (file)
@@ -277,7 +277,7 @@ HRESULT STDMETHODCALLTYPE WebInspector::isTimelineProfilingEnabled(BOOL* isEnabl
     if (!page)
         return S_OK;
 
-    *isEnabled = page->inspectorController()->timelineAgent() != 0;
+    *isEnabled = page->inspectorController()->timelineProfilerEnabled();
     return S_OK;
 }