[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

loislo at chromium.org loislo at chromium.org
Wed Dec 22 13:33:26 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9777aacd90a8a72436471a522711fe871b390d1b
Author: loislo at chromium.org <loislo at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 20 15:47:06 2010 +0000

    2010-09-20  Ilya Tikhonovsky  <loislo at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: merge Inspector client runtime events into the serialized inspector state object.
    
            Drive-by rename getBackendSettings -> getInspectorState to better reflect the nature of the data.
    
            https://bugs.webkit.org/show_bug.cgi?id=45974
    
            WebCore:
    
            * inspector/Inspector.idl:
            * inspector/InspectorClient.h:
            (WebCore::InspectorClient::updateInspectorStateCookie):
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::saveApplicationSettings):
            (WebCore::InspectorController::getInspectorState):
            (WebCore::InspectorController::updateInspectorStateCookie):
            (WebCore::InspectorController::restoreInspectorStateFromCookie):
            (WebCore::InspectorController::getSettings):
            (WebCore::InspectorController::setMonitoringXHREnabled):
            (WebCore::InspectorController::restoreDebugger):
            (WebCore::InspectorController::restoreProfiler):
            (WebCore::InspectorController::setResourceTrackingEnabled):
            (WebCore::InspectorController::ensureSettingsLoaded):
            (WebCore::InspectorController::startTimelineProfiler):
            (WebCore::InspectorController::stopTimelineProfiler):
            (WebCore::InspectorController::enableProfiler):
            (WebCore::InspectorController::disableProfiler):
            (WebCore::InspectorController::enableDebuggerFromFrontend):
            (WebCore::InspectorController::disableDebugger):
            * inspector/InspectorController.h:
            * inspector/front-end/ConsoleView.js:
            (WebInspector.ConsoleView.prototype._handleContextMenuEvent):
            * inspector/front-end/ResourcesPanel.js:
            (WebInspector.ResourcesPanel.prototype._toggleResourceTracking):
            * inspector/front-end/Settings.js:
            (WebInspector.Settings.initialize):
            * inspector/front-end/inspector.js:
            (WebInspector.doLoadedDone.populateInspectorState):
            (WebInspector.doLoadedDone):
    
            WebKit/chromium:
    
            * src/InspectorClientImpl.cpp:
            (WebKit::InspectorClientImpl::updateInspectorStateCookie):
            * src/InspectorClientImpl.h:
            * src/WebDevToolsAgentImpl.cpp:
            (WebKit::WebDevToolsAgentImpl::setRuntimeProperty):
            (WebKit::WebDevToolsAgentImpl::setApuAgentEnabled):
            (WebKit::WebDevToolsAgentImpl::updateInspectorStateCookie):
            * src/WebDevToolsAgentImpl.h:
    
            LayoutTests:
    
            * http/tests/inspector/console-xhr-logging.html:
            * inspector/report-API-errors-expected.txt:
            * inspector/report-API-errors.html:
    
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67852 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c9790aa..50c40fc 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-20  Ilya Tikhonovsky  <loislo at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: merge Inspector client runtime events into the serialized inspector state object.
+
+        Drive-by rename getBackendSettings -> getInspectorState to better reflect the nature of the data.
+
+        https://bugs.webkit.org/show_bug.cgi?id=45974
+
+        * http/tests/inspector/console-xhr-logging.html:
+        * inspector/report-API-errors-expected.txt:
+        * inspector/report-API-errors.html:
+
 2010-09-20  Csaba Osztrogonác  <ossy at webkit.org>
 
         [Qt]REGRESSION? (r67762): 23 layout tests fail
diff --git a/LayoutTests/http/tests/inspector/console-xhr-logging.html b/LayoutTests/http/tests/inspector/console-xhr-logging.html
index 0bd755b..533dcf0 100755
--- a/LayoutTests/http/tests/inspector/console-xhr-logging.html
+++ b/LayoutTests/http/tests/inspector/console-xhr-logging.html
@@ -45,7 +45,7 @@ function requestHelper(method, url)
 
 function frontend_enableXMLHttpRequestLogging(testController)
 {
-    InspectorBackend.setMonitoringXHR(true, function(newStatus) {
+    InspectorBackend.setMonitoringXHREnabled(true, function(newStatus) {
          if (newStatus)
             testController.notifyDone("enabled");
     });
@@ -58,7 +58,7 @@ function frontend_enableXMLHttpRequestLogging(testController)
 
 function frontend_disableXMLHttpRequestLogging(testController)
 {
-    InspectorBackend.setMonitoringXHR(false, function(newStatus) {
+    InspectorBackend.setMonitoringXHREnabled(false, function(newStatus) {
         if (!newStatus)
             testController.notifyDone("disabled");
     });
diff --git a/LayoutTests/inspector/report-API-errors-expected.txt b/LayoutTests/inspector/report-API-errors-expected.txt
index a2c5043..abab55e 100644
--- a/LayoutTests/inspector/report-API-errors-expected.txt
+++ b/LayoutTests/inspector/report-API-errors-expected.txt
@@ -1,7 +1,7 @@
 Tests that InspectorBackendStub is catching incorrect arguments.
 
-Protocol Error: Invalid type of argument 'enable' for 'InspectorBackend.setMonitoringXHR' call. It should be 'boolean' but it is 'number'.
-Protocol Error: Invalid number of arguments for 'InspectorBackend.setMonitoringXHR' call. It should have the next arguments '{"enable":"boolean"}'.
-Protocol Error: Optional callback argument for 'InspectorBackend.setMonitoringXHR' call should be a function but its type is 'string'.
+Protocol Error: Invalid type of argument 'enable' for 'InspectorBackend.setMonitoringXHREnabled' call. It should be 'boolean' but it is 'number'.
+Protocol Error: Invalid number of arguments for 'InspectorBackend.setMonitoringXHREnabled' call. It should have the next arguments '{"enable":"boolean"}'.
+Protocol Error: Optional callback argument for 'InspectorBackend.setMonitoringXHREnabled' call should be a function but its type is 'string'.
 Protocol Error: Attempted to dispatch an unimplemented WebInspector method 'something-strange'
 
diff --git a/LayoutTests/inspector/report-API-errors.html b/LayoutTests/inspector/report-API-errors.html
index edd2dfe..a2bc280 100644
--- a/LayoutTests/inspector/report-API-errors.html
+++ b/LayoutTests/inspector/report-API-errors.html
@@ -11,11 +11,11 @@ function test()
         InspectorTest.addResult(String.sprintf.apply(this, arguments));
     }
 
-    InspectorBackend.setMonitoringXHR(1);
-    InspectorBackend.setMonitoringXHR();
-    InspectorBackend.setMonitoringXHR(true, "not a function");
-    InspectorBackend.setMonitoringXHR(true, undefined);
-    InspectorBackend.setMonitoringXHR(false, undefined);
+    InspectorBackend.setMonitoringXHREnabled(1);
+    InspectorBackend.setMonitoringXHREnabled();
+    InspectorBackend.setMonitoringXHREnabled(true, "not a function");
+    InspectorBackend.setMonitoringXHREnabled(true, undefined);
+    InspectorBackend.setMonitoringXHREnabled(false, undefined);
     WebInspector_syncDispatch('{"type": "event", "domain": "dom", "event": "something-strange", "data": {}}');
 
     InspectorTest.completeTest();
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9383e27..2aff585 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,44 @@
+2010-09-20  Ilya Tikhonovsky  <loislo at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: merge Inspector client runtime events into the serialized inspector state object.
+
+        Drive-by rename getBackendSettings -> getInspectorState to better reflect the nature of the data.
+
+        https://bugs.webkit.org/show_bug.cgi?id=45974
+
+        * inspector/Inspector.idl:
+        * inspector/InspectorClient.h:
+        (WebCore::InspectorClient::updateInspectorStateCookie):
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::saveApplicationSettings):
+        (WebCore::InspectorController::getInspectorState):
+        (WebCore::InspectorController::updateInspectorStateCookie):
+        (WebCore::InspectorController::restoreInspectorStateFromCookie):
+        (WebCore::InspectorController::getSettings):
+        (WebCore::InspectorController::setMonitoringXHREnabled):
+        (WebCore::InspectorController::restoreDebugger):
+        (WebCore::InspectorController::restoreProfiler):
+        (WebCore::InspectorController::setResourceTrackingEnabled):
+        (WebCore::InspectorController::ensureSettingsLoaded):
+        (WebCore::InspectorController::startTimelineProfiler):
+        (WebCore::InspectorController::stopTimelineProfiler):
+        (WebCore::InspectorController::enableProfiler):
+        (WebCore::InspectorController::disableProfiler):
+        (WebCore::InspectorController::enableDebuggerFromFrontend):
+        (WebCore::InspectorController::disableDebugger):
+        * inspector/InspectorController.h:
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype._handleContextMenuEvent):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel.prototype._toggleResourceTracking):
+        * inspector/front-end/Settings.js:
+        (WebInspector.Settings.initialize):
+        * inspector/front-end/inspector.js:
+        (WebInspector.doLoadedDone.populateInspectorState):
+        (WebInspector.doLoadedDone):
+
 2010-09-20  Dirk Schulze  <krit at webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl
index 7dad9af..ae136b2 100644
--- a/WebCore/inspector/Inspector.idl
+++ b/WebCore/inspector/Inspector.idl
@@ -98,6 +98,7 @@ module core {
         [handler=Controller] void populateScriptObjects();
 
         [handler=Controller] void getSettings(out Object settings);
+        [handler=Controller] void getInspectorState(out Object state);
         [handler=Controller] void storeLastActivePanel(in String panelName);
 
         [handler=Controller] void saveApplicationSettings(in String settings);
@@ -106,9 +107,9 @@ module core {
         [handler=Controller] void enableSearchingForNode();
         [handler=Controller] void disableSearchingForNode();
 
-        [handler=Controller] void setMonitoringXHR(in boolean enable, out boolean newState);
+        [handler=Controller] void setMonitoringXHREnabled(in boolean enable, out boolean newState);
 
-        [handler=Controller] void setResourceTracking(in boolean enable, in boolean always, out boolean newState);
+        [handler=Controller] void setResourceTrackingEnabled(in boolean enabled, in boolean always, out boolean newState);
         [handler=Controller] void getResourceContent(in unsigned long identifier, out String content);
         [handler=Controller] void reloadPage();
 
diff --git a/WebCore/inspector/InspectorClient.h b/WebCore/inspector/InspectorClient.h
index acd8b28..bb71b13 100644
--- a/WebCore/inspector/InspectorClient.h
+++ b/WebCore/inspector/InspectorClient.h
@@ -54,10 +54,7 @@ public:
     // Navigation can cause some WebKit implementations to change the view / page / inspector controller instance.
     // However, there are some inspector controller states that should survive navigation (such as tracking resources
     // or recording timeline). Following callbacks allow embedders to track these states.
-    virtual void resourceTrackingWasEnabled() { };
-    virtual void resourceTrackingWasDisabled() { };
-    virtual void timelineProfilerWasStarted() { };
-    virtual void timelineProfilerWasStopped() { };
+    virtual void updateInspectorStateCookie(const String&) { };
 };
 
 } // namespace WebCore
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 73126d7..5f8f190 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -119,26 +119,28 @@ using namespace std;
 
 namespace WebCore {
 
-static const char* const resourceTrackingEnabledSettingName = "resourceTrackingEnabled";
-static const char* const debuggerEnabledSettingName = "debuggerEnabled";
-static const char* const profilerEnabledSettingName = "profilerEnabled";
-static const char* const inspectorAttachedHeightName = "inspectorAttachedHeight";
+static const char* const frontendSettingsSettingName = "frontendSettings";
+
+static const char* const debuggerAlwaysEnabledSettingName = "debuggerEnabled";
 static const char* const lastActivePanel = "lastActivePanel";
+static const char* const monitoringXHRSettingName = "xhrMonitor";
+static const char* const resourceTrackingAlwaysEnabledSettingName = "resourceTrackingEnabled";
+static const char* const profilerAlwaysEnabledSettingName = "profilerEnabled";
+
+static const char* const timelineProfilerEnabledStateName = "timelineProfilerEnabled";
+static const char* const resourceTrackingEnabledStateName = "resourceTrackingEnabled";
+static const char* const monitoringXHRStateName = "monitoringXHREnabled";
+
+static const char* const inspectorAttachedHeightName = "inspectorAttachedHeight";
+
 const char* const InspectorController::ElementsPanel = "elements";
 const char* const InspectorController::ConsolePanel = "console";
 const char* const InspectorController::ScriptsPanel = "scripts";
 const char* const InspectorController::ProfilesPanel = "profiles";
 
-static const char* const monitoringXHRSettingName = "xhrMonitor";
 
 static int connectedFrontendCount = 0;
 
-const String& InspectorController::frontendSettingsSettingName()
-{
-    DEFINE_STATIC_LOCAL(String, settingName, ("frontendSettings"));
-    return settingName;
-}
-
 const String& InspectorController::inspectorStartsAttachedSettingName()
 {
     DEFINE_STATIC_LOCAL(String, settingName, ("inspectorStartsAttached"));
@@ -242,7 +244,7 @@ void InspectorController::setSetting(const String& key, const String& value)
 
 void InspectorController::saveApplicationSettings(const String& settings)
 {
-    setSetting(InspectorController::frontendSettingsSettingName(), settings);
+    setSetting(frontendSettingsSettingName, settings);
 }
 
 void InspectorController::saveSessionSettings(const String& settingsJSON)
@@ -250,20 +252,47 @@ void InspectorController::saveSessionSettings(const String& settingsJSON)
     m_sessionSettings = InspectorValue::parseJSON(settingsJSON);
 }
 
-String InspectorController::getBackendSettings()
+void InspectorController::getInspectorState(RefPtr<InspectorObject>* state)
+{
+    (*state)->setBoolean(monitoringXHRStateName, m_monitoringXHR);
+    (*state)->setBoolean(resourceTrackingEnabledStateName, m_resourceTrackingEnabled);
+}
+
+void InspectorController::updateInspectorStateCookie()
 {
-    RefPtr<InspectorObject> runtimeSettings = InspectorObject::create();
-    runtimeSettings->setBoolean(monitoringXHRSettingName, m_monitoringXHR);
-    runtimeSettings->setBoolean(resourceTrackingEnabledSettingName, m_resourceTrackingEnabled);
-    return runtimeSettings->toJSONString();
+    RefPtr<InspectorObject> state = InspectorObject::create();
+    state->setBoolean(monitoringXHRStateName, m_monitoringXHR);
+    state->setBoolean(resourceTrackingEnabledStateName, m_resourceTrackingEnabled);
+    state->setBoolean(timelineProfilerEnabledStateName, m_timelineAgent);
+    m_client->updateInspectorStateCookie(state->toJSONString());
+}
+
+void InspectorController::restoreInspectorStateFromCookie(const String& inspectorStateString)
+{
+    RefPtr<InspectorValue> inspectorStateValue = InspectorValue::parseJSON(inspectorStateString);
+    if (!inspectorStateValue)
+        return;
+
+    RefPtr<InspectorObject> inspectorState = inspectorStateValue->asObject();
+    if (!inspectorState)
+        return;
+
+    inspectorState->getBoolean(monitoringXHRStateName, &m_monitoringXHR);
+    inspectorState->getBoolean(resourceTrackingEnabledStateName, &m_resourceTrackingEnabled);
+
+    bool timelineProfilerEnabled = false;
+    inspectorState->getBoolean(timelineProfilerEnabledStateName, &timelineProfilerEnabled);
+    if (timelineProfilerEnabled)
+        startTimelineProfiler();
+    else
+        stopTimelineProfiler();
 }
 
 void InspectorController::getSettings(RefPtr<InspectorObject>* settings)
 {
     *settings = InspectorObject::create();
-    (*settings)->setString("application", setting(frontendSettingsSettingName()));
+    (*settings)->setString("application", setting(frontendSettingsSettingName));
     (*settings)->setString("session", m_sessionSettings->toJSONString());
-    (*settings)->setString("backend", getBackendSettings());
 }
 
 void InspectorController::inspect(Node* node)
@@ -471,13 +500,14 @@ void InspectorController::setSearchingForNode(bool enabled)
     }
 }
 
-void InspectorController::setMonitoringXHR(bool enabled, bool* newState)
+void InspectorController::setMonitoringXHREnabled(bool enabled, bool* newState)
 {
     *newState = enabled;
     if (m_monitoringXHR == enabled)
         return;
     m_monitoringXHR = enabled;
     setSetting(monitoringXHRSettingName, enabled ? "true" : "false");
+    updateInspectorStateCookie();
 }
 
 void InspectorController::connectFrontend()
@@ -682,7 +712,7 @@ void InspectorController::restoreDebugger()
     if (InspectorDebuggerAgent::isDebuggerAlwaysEnabled())
         enableDebuggerFromFrontend(false);
     else {
-        String debuggerEnabled = setting(debuggerEnabledSettingName);
+        String debuggerEnabled = setting(debuggerAlwaysEnabledSettingName);
         if (debuggerEnabled == "true" || m_attachDebuggerWhenShown)
             enableDebugger();
     }
@@ -695,7 +725,7 @@ void InspectorController::restoreProfiler()
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     m_profilerAgent->setFrontend(m_frontend.get());
     if (!ScriptProfiler::isProfilerAlwaysEnabled()) {
-        String profilerEnabledSetting = setting(profilerEnabledSettingName);
+        String profilerEnabledSetting = setting(profilerAlwaysEnabledSettingName);
         if (profilerEnabledSetting == "true")
             enableProfiler();
     }
@@ -1131,12 +1161,22 @@ void InspectorController::scriptImported(unsigned long identifier, const String&
         resource->updateScriptObject(m_frontend.get());
 }
 
-void InspectorController::setResourceTracking(bool enable, bool always, bool* newState)
+void InspectorController::setResourceTrackingEnabled(bool enable)
+{
+    if (!enabled())
+        return;
+
+    ASSERT(m_inspectedPage);
+    m_resourceTrackingEnabled = enable;
+    updateInspectorStateCookie();
+}
+
+void InspectorController::setResourceTrackingEnabled(bool enable, bool always, bool* newState)
 {
     *newState = enable;
 
     if (always)
-        setSetting(resourceTrackingEnabledSettingName, enable ? "true" : "false");
+        setSetting(resourceTrackingAlwaysEnabledSettingName, enable ? "true" : "false");
 
     if (m_resourceTrackingEnabled == enable)
         return;
@@ -1144,20 +1184,10 @@ void InspectorController::setResourceTracking(bool enable, bool always, bool* ne
     ASSERT(m_inspectedPage);
     m_resourceTrackingEnabled = enable;
 
-    if (enable) {
-        m_client->resourceTrackingWasEnabled();
+    if (enable)
         m_inspectedPage->mainFrame()->redirectScheduler()->scheduleRefresh(true);
-    } else
-        m_client->resourceTrackingWasDisabled();
-}
-
-void InspectorController::setResourceTracking(bool enable)
-{
-    if (!enabled())
-        return;
 
-    ASSERT(m_inspectedPage);
-    m_resourceTrackingEnabled = enable;
+    updateInspectorStateCookie();
 }
 
 void InspectorController::ensureSettingsLoaded()
@@ -1166,14 +1196,15 @@ void InspectorController::ensureSettingsLoaded()
         return;
     m_settingsLoaded = true;
 
-    String resourceTracking = setting(resourceTrackingEnabledSettingName);
-    if (resourceTracking == "true")
+    String resourceTrackingAlwaysEnabled = setting(resourceTrackingAlwaysEnabledSettingName);
+    if (resourceTrackingAlwaysEnabled == "true")
         m_resourceTrackingEnabled = true;
-    m_client->resourceTrackingWasEnabled();
 
-    String monitoringXHR = setting(monitoringXHRSettingName);
-    if (monitoringXHR == "true")
+    String monitoringXHRAlwaysEnabled = setting(monitoringXHRSettingName);
+    if (monitoringXHRAlwaysEnabled == "true")
         m_monitoringXHR = true;
+
+    updateInspectorStateCookie();
 }
 
 void InspectorController::startTimelineProfiler()
@@ -1187,7 +1218,8 @@ void InspectorController::startTimelineProfiler()
     m_timelineAgent = new InspectorTimelineAgent(m_frontend.get());
     if (m_frontend)
         m_frontend->timelineProfilerWasStarted();
-    m_client->timelineProfilerWasStarted();
+
+    updateInspectorStateCookie();
 }
 
 void InspectorController::stopTimelineProfiler()
@@ -1201,7 +1233,8 @@ void InspectorController::stopTimelineProfiler()
     m_timelineAgent = 0;
     if (m_frontend)
         m_frontend->timelineProfilerWasStopped();
-    m_client->timelineProfilerWasStopped();
+
+    updateInspectorStateCookie();
 }
 
 #if ENABLE(WORKERS)
@@ -1573,14 +1606,14 @@ bool InspectorController::profilerEnabled() const
 void InspectorController::enableProfiler(bool always, bool skipRecompile)
 {
     if (always)
-        setSetting(profilerEnabledSettingName, "true");
+        setSetting(profilerAlwaysEnabledSettingName, "true");
     m_profilerAgent->enable(skipRecompile);
 }
 
 void InspectorController::disableProfiler(bool always)
 {
     if (always)
-        setSetting(profilerEnabledSettingName, "false");
+        setSetting(profilerAlwaysEnabledSettingName, "false");
     m_profilerAgent->disable();
 }
 #endif
@@ -1590,7 +1623,7 @@ void InspectorController::enableDebuggerFromFrontend(bool always)
 {
     ASSERT(!debuggerEnabled());
     if (always)
-        setSetting(debuggerEnabledSettingName, "true");
+        setSetting(debuggerAlwaysEnabledSettingName, "true");
 
     ASSERT(m_inspectedPage);
 
@@ -1621,7 +1654,7 @@ void InspectorController::disableDebugger(bool always)
         return;
 
     if (always)
-        setSetting(debuggerEnabledSettingName, "false");
+        setSetting(debuggerAlwaysEnabledSettingName, "false");
 
     ASSERT(m_inspectedPage);
 
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index 60523b6..6752044 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -129,6 +129,8 @@ public:
     void saveSessionSettings(const String&);
     void getSettings(RefPtr<InspectorObject>*);
 
+    void restoreInspectorStateFromCookie(const String& inspectorState);
+
     void inspect(Node*);
     void highlight(Node*);
     void hideHighlight();
@@ -174,8 +176,8 @@ public:
     void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
     void scriptImported(unsigned long identifier, const String& sourceString);
 
-    void setResourceTracking(bool enable);
-    void setResourceTracking(bool enable, bool always, bool* newState);
+    void setResourceTrackingEnabled(bool enabled);
+    void setResourceTrackingEnabled(bool enabled, bool always, bool* newState);
     bool resourceTrackingEnabled() const { return m_resourceTrackingEnabled; }
 
     void ensureSettingsLoaded();
@@ -275,8 +277,8 @@ public:
     static const String& inspectorStartsAttachedSettingName();
 
 private:
-    static const String& frontendSettingsSettingName();
-    String getBackendSettings();
+    void updateInspectorStateCookie();
+    void getInspectorState(RefPtr<InspectorObject>* state);
 
     friend class InspectorBackend;
     friend class InspectorBackendDispatcher;
@@ -292,7 +294,7 @@ private:
     void enableSearchingForNode() { setSearchingForNode(true); }
     void disableSearchingForNode() { setSearchingForNode(false); }
 
-    void setMonitoringXHR(bool enabled, bool* newState);
+    void setMonitoringXHREnabled(bool enabled, bool* newState);
     void storeLastActivePanel(const String& panelName);
     InspectorDOMAgent* domAgent() { return m_domAgent.get(); }
     void releaseFrontendLifetimeAgents();
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index 72a0172..6f8bd8b 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -405,7 +405,7 @@ WebInspector.ConsoleView.prototype = {
         {
             WebInspector.monitoringXHREnabled = newState;
         }
-        var itemAction = InspectorBackend.setMonitoringXHR.bind(InspectorBackend, !WebInspector.monitoringXHREnabled, monitoringXHRWasChanged);
+        var itemAction = InspectorBackend.setMonitoringXHREnabled.bind(InspectorBackend, !WebInspector.monitoringXHREnabled, monitoringXHRWasChanged);
         contextMenu.appendCheckboxItem(WebInspector.UIString("XMLHttpRequest logging"), itemAction, WebInspector.monitoringXHREnabled);
         contextMenu.appendItem(WebInspector.UIString("Clear Console"), this.requestClearMessages.bind(this));
         contextMenu.show(event);
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
index 0c6abe0..f329b1a 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -765,11 +765,11 @@ WebInspector.ResourcesPanel.prototype = {
             this.sortingSelectElement.visible = false;
             WebInspector.resources = {};
             WebInspector.resourceURLMap = {};
-            InspectorBackend.setResourceTracking(false, true, callback);
+            InspectorBackend.setResourceTrackingEnabled(false, true, callback);
         } else {
             this.largerResourcesButton.visible = true;
             this.sortingSelectElement.visible = true;
-            InspectorBackend.setResourceTracking(true, !!optionalAlways, callback);
+            InspectorBackend.setResourceTrackingEnabled(true, !!optionalAlways, callback);
         }
     },
 
diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js
index 52a8bd0..63f2641 100644
--- a/WebCore/inspector/front-end/Settings.js
+++ b/WebCore/inspector/front-end/Settings.js
@@ -82,21 +82,9 @@ WebInspector.Settings.initialize = function()
         WebInspector.sessionSettings.dispatchEventToListeners("loaded");
     }
 
-    function populateBackendSettings(settingsString)
-    {
-        var settings = JSON.parse(settingsString);
-
-        WebInspector.monitoringXHREnabled = settings.monitoringXHREnabled;
-        if (settings.resourceTrackingEnabled)
-            WebInspector.panels.resources.resourceTrackingWasEnabled();
-        else
-            WebInspector.panels.resources.resourceTrackingWasDisabled();
-    }
-
     InspectorBackend.getSettings(function(settings) {
         populateApplicationSettings(settings.application);
         populateSessionSettings(settings.session);
-        populateBackendSettings(settings.backend);
     });
 }
 
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index aee9258..f6fa06b 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -582,6 +582,16 @@ WebInspector.doLoadedDone = function()
 
     this.extensionServer.initExtensions();
 
+    function populateInspectorState(inspectorState)
+    {
+        WebInspector.monitoringXHREnabled = inspectorState.monitoringXHREnabled;
+        if (inspectorState.resourceTrackingEnabled)
+            WebInspector.panels.resources.resourceTrackingWasEnabled();
+        else
+            WebInspector.panels.resources.resourceTrackingWasDisabled();
+    }
+    InspectorBackend.getInspectorState(populateInspectorState);
+
     InspectorBackend.populateScriptObjects();
 
     // As a DOMAgent method, this needs to happen after the frontend has loaded and the agent is available.
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 47b0e63..3602ff2 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,22 @@
+2010-09-20  Ilya Tikhonovsky  <loislo at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: merge Inspector client runtime events into the serialized inspector state object.
+
+        Drive-by rename getBackendSettings -> getInspectorState to better reflect the nature of the data.
+
+        https://bugs.webkit.org/show_bug.cgi?id=45974
+
+        * src/InspectorClientImpl.cpp:
+        (WebKit::InspectorClientImpl::updateInspectorStateCookie):
+        * src/InspectorClientImpl.h:
+        * src/WebDevToolsAgentImpl.cpp:
+        (WebKit::WebDevToolsAgentImpl::setRuntimeProperty):
+        (WebKit::WebDevToolsAgentImpl::setApuAgentEnabled):
+        (WebKit::WebDevToolsAgentImpl::updateInspectorStateCookie):
+        * src/WebDevToolsAgentImpl.h:
+
 2010-09-19  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r67749.
diff --git a/WebKit/chromium/src/InspectorClientImpl.cpp b/WebKit/chromium/src/InspectorClientImpl.cpp
index 76acbb2..77150bb 100644
--- a/WebKit/chromium/src/InspectorClientImpl.cpp
+++ b/WebKit/chromium/src/InspectorClientImpl.cpp
@@ -100,28 +100,10 @@ bool InspectorClientImpl::sendMessageToFrontend(const WTF::String& message)
     return false;
 }
 
-void InspectorClientImpl::resourceTrackingWasEnabled()
+void InspectorClientImpl::updateInspectorStateCookie(const WTF::String& inspectorState)
 {
     if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->resourceTrackingWasEnabled();
-}
-
-void InspectorClientImpl::resourceTrackingWasDisabled()
-{
-    if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->resourceTrackingWasDisabled();
-}
-
-void InspectorClientImpl::timelineProfilerWasStarted()
-{
-    if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->timelineProfilerWasStarted();
-}
-
-void InspectorClientImpl::timelineProfilerWasStopped()
-{
-    if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->timelineProfilerWasStopped();
+        agent->updateInspectorStateCookie(inspectorState);
 }
 
 WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent()
diff --git a/WebKit/chromium/src/InspectorClientImpl.h b/WebKit/chromium/src/InspectorClientImpl.h
index 34fcdc3..78d34e3 100644
--- a/WebKit/chromium/src/InspectorClientImpl.h
+++ b/WebKit/chromium/src/InspectorClientImpl.h
@@ -58,10 +58,7 @@ public:
 
     virtual bool sendMessageToFrontend(const WTF::String&);
 
-    virtual void resourceTrackingWasEnabled();
-    virtual void resourceTrackingWasDisabled();
-    virtual void timelineProfilerWasStarted();
-    virtual void timelineProfilerWasStopped();
+    virtual void updateInspectorStateCookie(const WTF::String&);
 private:
     WebDevToolsAgentImpl* devToolsAgent();
 
diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
index 9ba63ec..c7bb050 100644
--- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
+++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
@@ -36,7 +36,6 @@
 #include "InjectedScriptHost.h"
 #include "InspectorBackendDispatcher.h"
 #include "InspectorController.h"
-#include "InspectorValues.h"
 #include "Page.h"
 #include "PageGroup.h"
 #include "PlatformString.h"
@@ -68,8 +67,6 @@ using WebCore::InjectedScriptHost;
 using WebCore::InspectorArray;
 using WebCore::InspectorBackendDispatcher;
 using WebCore::InspectorController;
-using WebCore::InspectorObject;
-using WebCore::InspectorValue;
 using WebCore::Node;
 using WebCore::Page;
 using WebCore::ResourceError;
@@ -83,10 +80,9 @@ namespace WebKit {
 
 namespace {
 
-static const char kFrontendConnectedFeatureName[] = "frontend-connected";
-static const char kResourceTrackingFeatureName[] = "resource-tracking";
-static const char kTimelineFeatureName[] = "timeline-profiler";
 static const char kApuAgentFeatureName[] = "apu-agent";
+static const char kFrontendConnectedFeatureName[] = "frontend-connected";
+static const char kInspectorStateFeatureName[] = "inspector-state";
 
 class ClientMessageLoopAdapter : public WebCore::ScriptDebugServer::ClientMessageLoop {
 public:
@@ -252,11 +248,9 @@ void WebDevToolsAgentImpl::setRuntimeProperty(const WebString& name, const WebSt
 {
     if (name == kApuAgentFeatureName)
         setApuAgentEnabled(value == "true");
-    else if (name == kTimelineFeatureName)
-        setTimelineProfilingEnabled(value == "true");
-    else if (name == kResourceTrackingFeatureName) {
+    else if (name == kInspectorStateFeatureName) {
         InspectorController* ic = inspectorController();
-        ic->setResourceTracking(value == "true");
+        ic->restoreInspectorStateFromCookie(value);
     } else if (name == kFrontendConnectedFeatureName && !inspectorController()->hasFrontend()) {
         inspectorController()->injectedScriptHost()->setInjectedScriptSource(value);
         connectFrontend(true);
@@ -275,13 +269,13 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled)
         if (!m_resourceTrackingWasEnabled) {
             // TODO(knorton): Introduce some kind of agents dependency here so that
             // user could turn off resource tracking while apu agent is on.
-            ic->setResourceTracking(true);
+            ic->setResourceTrackingEnabled(true);
         }
         m_debuggerAgentImpl->setAutoContinueOnException(true);
     } else {
       ic->stopTimelineProfiler();
       if (!m_resourceTrackingWasEnabled)
-          ic->setResourceTracking(false);
+          ic->setResourceTrackingEnabled(false);
       m_resourceTrackingWasEnabled = false;
     }
     m_client->runtimePropertyChanged(
@@ -408,24 +402,9 @@ bool WebDevToolsAgentImpl::sendMessageToFrontend(const WTF::String& message)
     return true;
 }
 
-void WebDevToolsAgentImpl::resourceTrackingWasEnabled()
-{
-    m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "true");
-}
-
-void WebDevToolsAgentImpl::resourceTrackingWasDisabled()
-{
-    m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "false");
-}
-
-void WebDevToolsAgentImpl::timelineProfilerWasStarted()
-{
-    m_client->runtimePropertyChanged(kTimelineFeatureName, "true");
-}
-
-void WebDevToolsAgentImpl::timelineProfilerWasStopped()
+void WebDevToolsAgentImpl::updateInspectorStateCookie(const WTF::String& state)
 {
-    m_client->runtimePropertyChanged(kTimelineFeatureName, "false");
+    m_client->runtimePropertyChanged(kInspectorStateFeatureName, state);
 }
 
 void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script)
diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h
index 1d306c4..47c4ccf 100644
--- a/WebKit/chromium/src/WebDevToolsAgentImpl.h
+++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h
@@ -93,10 +93,7 @@ public:
     virtual void hideHighlight();
     virtual void populateSetting(const WTF::String& key, WTF::String* value);
     virtual void storeSetting(const WTF::String& key, const WTF::String& value);
-    virtual void resourceTrackingWasEnabled();
-    virtual void resourceTrackingWasDisabled();
-    virtual void timelineProfilerWasStarted();
-    virtual void timelineProfilerWasStopped();
+    virtual void updateInspectorStateCookie(const WTF::String&);
     virtual bool sendMessageToFrontend(const WTF::String&);
 
     int hostId() { return m_hostId; }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list