2011-02-09 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Feb 2011 14:48:50 +0000 (14:48 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Feb 2011 14:48:50 +0000 (14:48 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: follow up on InspectorAgent split -
        removing unnecessary methods from InspectorController.
        https://bugs.webkit.org/show_bug.cgi?id=54093

        * WebCore.exp.in:
        * inspector/InspectorAgent.cpp:
        (WebCore::InspectorAgent::stopUserInitiatedProfiling):
        (WebCore::InspectorAgent::showAndEnableDebugger):
        (WebCore::InspectorAgent::enabled):
        (WebCore::InspectorAgent::showConsole):
        * inspector/InspectorAgent.h:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::InspectorController):
        (WebCore::InspectorController::didClearWindowObjectInWorld):
        (WebCore::InspectorController::showConsole):
        (WebCore::InspectorController::enabled):
        (WebCore::InspectorController::inspectedPage):
        * inspector/InspectorController.h:
        * inspector/InspectorFrontendClientLocal.cpp:
2011-02-09  Pavel Feldman  <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: follow up on InspectorAgent split -
        removing unnecessary methods from InspectorController.
        https://bugs.webkit.org/show_bug.cgi?id=54093

        * WebInspector/WebInspector.mm:
        (-[WebInspector showConsole:]):
        (-[WebInspector stopProfilingJavaScript:]):
2011-02-09  Pavel Feldman  <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: follow up on InspectorAgent split -
        removing unnecessary methods from InspectorController.
        https://bugs.webkit.org/show_bug.cgi?id=54093

        * WebInspector.cpp:
        (WebInspector::showConsole):
        (WebInspector::toggleProfilingJavaScript):
2011-02-09  Pavel Feldman  <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: follow up on InspectorAgent split -
        removing unnecessary methods from InspectorController.
        https://bugs.webkit.org/show_bug.cgi?id=54093

        * WebProcess/WebPage/WebInspector.cpp:
        (WebKit::WebInspector::showConsole):
        (WebKit::WebInspector::stopJavaScriptProfiling):

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

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
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/WebKit/mac/ChangeLog
Source/WebKit/mac/WebInspector/WebInspector.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebInspector.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebInspector.cpp

index 30b5726..8110579 100644 (file)
@@ -1,3 +1,27 @@
+2011-02-09  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: follow up on InspectorAgent split -
+        removing unnecessary methods from InspectorController.
+        https://bugs.webkit.org/show_bug.cgi?id=54093
+
+        * WebCore.exp.in:
+        * inspector/InspectorAgent.cpp:
+        (WebCore::InspectorAgent::stopUserInitiatedProfiling):
+        (WebCore::InspectorAgent::showAndEnableDebugger):
+        (WebCore::InspectorAgent::enabled):
+        (WebCore::InspectorAgent::showConsole):
+        * inspector/InspectorAgent.h:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::didClearWindowObjectInWorld):
+        (WebCore::InspectorController::showConsole):
+        (WebCore::InspectorController::enabled):
+        (WebCore::InspectorController::inspectedPage):
+        * inspector/InspectorController.h:
+        * inspector/InspectorFrontendClientLocal.cpp:
+
 2011-02-07  Chris Marrin  <cmarrin@apple.com>
 
         Reviewed by Simon Fraser.
index 096834d..57c7202 100644 (file)
@@ -1405,8 +1405,6 @@ __ZN7WebCore22GeolocationServiceMock8setErrorEN3WTF10PassRefPtrINS_13PositionErr
 
 #if ENABLE(INSPECTOR)
 __ZN7WebCore15InspectorClient31doDispatchMessageOnFrontendPageEPNS_4PageERKN3WTF6StringE
-__ZN7WebCore19InspectorController12ConsolePanelE
-__ZN7WebCore19InspectorController13ProfilesPanelE
 __ZN7WebCore19InspectorController14enableProfilerEv
 __ZN7WebCore19InspectorController15debuggerEnabledEv
 __ZN7WebCore19InspectorController15disableDebuggerEv
@@ -1415,6 +1413,7 @@ __ZN7WebCore19InspectorController15profilerEnabledEv
 __ZN7WebCore19InspectorController18disconnectFrontendEv
 __ZN7WebCore19InspectorController20stopTimelineProfilerEv
 __ZN7WebCore19InspectorController21showAndEnableDebuggerEv
+__ZN7WebCore19InspectorController11showConsoleEv
 __ZN7WebCore19InspectorController21startTimelineProfilerEv
 __ZN7WebCore19InspectorController23timelineProfilerEnabledEv
 __ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKN3WTF6StringE
@@ -1423,7 +1422,6 @@ __ZN7WebCore19InspectorController26stopUserInitiatedProfilingEv
 __ZN7WebCore19InspectorController27startUserInitiatedProfilingEv
 __ZN7WebCore19InspectorController4showEv
 __ZN7WebCore19InspectorController5closeEv
-__ZN7WebCore19InspectorController9showPanelERKN3WTF6StringE
 __ZN7WebCore28InspectorFrontendClientLocal12moveWindowByEff
 __ZN7WebCore28InspectorFrontendClientLocal14frontendLoadedEv
 __ZN7WebCore28InspectorFrontendClientLocal15canAttachWindowEv
index 607c7af..d8b27ed 100644 (file)
@@ -136,6 +136,10 @@ static const char debuggerEnabled[] = "debuggerEnabled";
 static const char profilerEnabled[] = "profilerEnabled";
 }
 
+static const char scriptsPanelName[] = "scripts";
+static const char consolePanelName[] = "console";
+static const char profilesPanelName[] = "profiles";
+
 InspectorAgent::InspectorAgent(InspectorController* inspectorController, Page* page, InspectorClient* client)
     : m_inspectorController(inspectorController)
     , m_inspectedPage(page)
@@ -905,6 +909,7 @@ void InspectorAgent::stopUserInitiatedProfiling()
         return;
     m_profilerAgent->stopUserInitiatedProfiling();
     m_state->setBoolean(InspectorAgentState::userInitiatedProfiling, false);
+    showPanel(profilesPanelName);
 }
 
 bool InspectorAgent::profilerEnabled() const
@@ -938,7 +943,7 @@ void InspectorAgent::showAndEnableDebugger()
 
     if (!m_frontend) {
         m_state->setBoolean(InspectorAgentState::debuggerEnabled, true);
-        showPanel(InspectorController::ScriptsPanel);
+        showPanel(scriptsPanelName);
     } else
         enableDebugger(true);
 }
@@ -1293,7 +1298,14 @@ void InspectorAgent::reloadPage(bool ignoreCache)
 
 bool InspectorAgent::enabled() const
 {
-    return m_inspectorController->enabled();
+    if (!m_inspectedPage)
+        return false;
+    return m_inspectedPage->settings()->developerExtrasEnabled();
+}
+
+void InspectorAgent::showConsole()
+{
+    showPanel(consolePanelName);
 }
 
 void InspectorAgent::showPanel(const String& panel)
index e1cc07b..721272f 100644 (file)
@@ -122,7 +122,7 @@ public:
     KURL inspectedURL() const;
     KURL inspectedURLWithoutFragment() const;
     void reloadPage(bool ignoreCache);
-    void showPanel(const String& panel);
+    void showConsole();
 
     void restoreInspectorStateFromCookie(const String& inspectorCookie);
 
@@ -252,6 +252,7 @@ public:
     void applyUserAgentOverride(String* userAgent) const;
 
 private:
+    void showPanel(const String& panel);
     void pushDataCollectedOffline();
     void restoreDebugger(bool eraseStickyBreakpoints);
     enum ProfilerRestoreAction {
index 5ff9333..8b3109b 100644 (file)
 
 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* inspectorClient)
     : m_inspectorAgent(new InspectorAgent(this, page, inspectorClient))
     , m_inspectorBackendDispatcher(new InspectorBackendDispatcher(m_inspectorAgent.get()))
-    , m_inspectedPage(page)
     , m_inspectorClient(inspectorClient)
     , m_openingFrontend(false)
 {
@@ -84,7 +78,7 @@ void InspectorController::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWo
 
     // 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())
+    if (m_inspectorFrontendClient && frame == m_inspectorAgent->inspectedPage()->mainFrame())
         m_inspectorFrontendClient->windowObjectCleared();
 }
 
@@ -165,6 +159,14 @@ void InspectorController::drawNodeHighlight(GraphicsContext& context) const
     m_inspectorAgent->drawNodeHighlight(context);
 }
 
+void InspectorController::showConsole()
+{
+    if (!enabled())
+        return;
+    show();
+    m_inspectorAgent->showConsole();
+}
+
 void InspectorController::inspect(Node* node)
 {
     if (!enabled())
@@ -177,20 +179,12 @@ void InspectorController::inspect(Node* node)
 
 bool InspectorController::enabled() const
 {
-    if (!m_inspectedPage)
-        return false;
-
-    return m_inspectedPage->settings()->developerExtrasEnabled();
+    return m_inspectorAgent->enabled();
 }
 
-void InspectorController::showPanel(const String& panel)
+Page* InspectorController::inspectedPage() const
 {
-    if (!enabled())
-        return;
-
-    show();
-
-    m_inspectorAgent->showPanel(panel);
+    return m_inspectorAgent->inspectedPage();
 }
 
 bool InspectorController::timelineProfilerEnabled()
index e30228e..78d59e6 100644 (file)
@@ -54,26 +54,20 @@ 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;
+    Page* inspectedPage() 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; }
@@ -81,6 +75,7 @@ public:
     void disconnectFrontend();
     void restoreInspectorStateFromCookie(const String& inspectorCookie);
 
+    void showConsole();
     void inspect(Node*);
     void drawNodeHighlight(GraphicsContext&) const;
     void hideHighlight();
@@ -115,7 +110,6 @@ private:
     OwnPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
     OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
     OwnPtr<InspectorFrontend> m_inspectorFrontend;
-    Page* m_inspectedPage;
     InspectorClient* m_inspectorClient;
     bool m_openingFrontend;
 };
index 833057d..36864f3 100644 (file)
@@ -77,7 +77,7 @@ InspectorFrontendClientLocal::~InspectorFrontendClientLocal()
     m_frontendPage = 0;
     m_inspectorController = 0;
 }
-    
+
 void InspectorFrontendClientLocal::windowObjectCleared()
 {
     // FIXME: don't keep reference to the script state
index ae4e275..66ceeaa 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-09  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: follow up on InspectorAgent split -
+        removing unnecessary methods from InspectorController.
+        https://bugs.webkit.org/show_bug.cgi?id=54093
+
+        * WebInspector/WebInspector.mm:
+        (-[WebInspector showConsole:]):
+        (-[WebInspector stopProfilingJavaScript:]):
+
 2011-02-08  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Jon Honeycutt and Maciej Stachowiak.
index c000f0c..f38c7ef 100644 (file)
@@ -68,7 +68,7 @@ using namespace WebCore;
 - (void)showConsole:(id)sender
 {
     if (Page* page = core(_webView))
-        page->inspectorController()->showPanel(InspectorController::ConsolePanel);
+        page->inspectorController()->showConsole();
 }
 
 - (void)showTimeline:(id)sender
@@ -132,7 +132,6 @@ using namespace WebCore;
     if (!page)
         return;
     page->inspectorController()->stopUserInitiatedProfiling();
-    page->inspectorController()->showPanel(InspectorController::ProfilesPanel);
 }
 
 - (BOOL)isJavaScriptProfilingEnabled
index ed0dd13..38c3c82 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-09  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: follow up on InspectorAgent split -
+        removing unnecessary methods from InspectorController.
+        https://bugs.webkit.org/show_bug.cgi?id=54093
+
+        * WebInspector.cpp:
+        (WebInspector::showConsole):
+        (WebInspector::toggleProfilingJavaScript):
+
 2011-02-08  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index 4e95fd1..ec35099 100644 (file)
@@ -110,7 +110,7 @@ HRESULT STDMETHODCALLTYPE WebInspector::showConsole()
 {
     if (m_webView)
         if (Page* page = m_webView->page())
-            page->inspectorController()->showPanel(InspectorController::ConsolePanel);
+            page->inspectorController()->showConsole();
 
     return S_OK;
 }
@@ -205,10 +205,9 @@ HRESULT STDMETHODCALLTYPE WebInspector::toggleProfilingJavaScript()
 
     InspectorController* inspector = page->inspectorController();
 
-    if (inspector->isRecordingUserInitiatedProfile()) {
+    if (inspector->isRecordingUserInitiatedProfile())
         inspector->stopUserInitiatedProfiling();
-        inspector->showPanel(InspectorController::ProfilesPanel);
-    } else
+    else
         inspector->startUserInitiatedProfiling();
 
     return S_OK;
index 6b960e3..0f51158 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-09  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: follow up on InspectorAgent split -
+        removing unnecessary methods from InspectorController.
+        https://bugs.webkit.org/show_bug.cgi?id=54093
+
+        * WebProcess/WebPage/WebInspector.cpp:
+        (WebKit::WebInspector::showConsole):
+        (WebKit::WebInspector::stopJavaScriptProfiling):
+
 2011-02-09  Alejandro G. Castro  <alex@igalia.com>
 
         Reviewed by Martin Robinson.
index cde90f9..4b3fdaf 100644 (file)
@@ -104,7 +104,7 @@ void WebInspector::evaluateScriptForTest(long callID, const String& script)
 
 void WebInspector::showConsole()
 {
-    m_page->corePage()->inspectorController()->showPanel(InspectorController::ConsolePanel);
+    m_page->corePage()->inspectorController()->showConsole();
 }
 
 void WebInspector::startJavaScriptDebugging()
@@ -132,7 +132,6 @@ void WebInspector::stopJavaScriptProfiling()
 {
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     m_page->corePage()->inspectorController()->stopUserInitiatedProfiling();
-    m_page->corePage()->inspectorController()->showPanel(InspectorController::ProfilesPanel);
 #endif
 }