2011-03-22 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Mar 2011 09:21:58 +0000 (09:21 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Mar 2011 09:21:58 +0000 (09:21 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: protocol cleanup. ConsoleAgent.
        https://bugs.webkit.org/show_bug.cgi?id=56806

        renamed method: void setConsoleMessagesEnabled(in boolean enabled, out boolean newState); => void enable(out long expiredMessagesCount);
        new method: disable()
        deleted method: [event] void consoleMessageExpiredCountUpdate(out unsigned long count); delete it. The counter will be transfered as out argument of enable command.

        * inspector/protocol/console-agent-expected.txt:
        * inspector/protocol/console-agent.html:
2011-03-22  Ilya Tikhonovsky  <loislo@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: protocol cleanup. ConsoleAgent.
        https://bugs.webkit.org/show_bug.cgi?id=56806

        renamed method: void setConsoleMessagesEnabled(in boolean enabled, out boolean newState); => void enable(out long expiredMessagesCount);
        new method: disable()
        deleted method: [event] void consoleMessageExpiredCountUpdate(out unsigned long count); delete it. The counter will be transfered as out argument of enable command.

        * inspector/ConsoleMessage.cpp:
        (WebCore::ConsoleMessage::updateRepeatCountInConsole):
        * inspector/Inspector.json:
        * inspector/InspectorConsoleAgent.cpp:
        (WebCore::InspectorConsoleAgent::enable):
        (WebCore::InspectorConsoleAgent::disable):
        * inspector/InspectorConsoleAgent.h:
        * inspector/front-end/ConsoleView.js:
        (WebInspector.ConsoleView.prototype._registerConsoleDomainDispatcher.dispatcher.consoleMessageRepeatCountUpdated):
        (WebInspector.ConsoleView.prototype.setConsoleMessageExpiredCount):
        * inspector/front-end/inspector.js:

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

LayoutTests/ChangeLog
LayoutTests/inspector/protocol/console-agent-expected.txt
LayoutTests/inspector/protocol/console-agent.html
Source/WebCore/ChangeLog
Source/WebCore/inspector/ConsoleMessage.cpp
Source/WebCore/inspector/Inspector.json
Source/WebCore/inspector/InspectorConsoleAgent.cpp
Source/WebCore/inspector/InspectorConsoleAgent.h
Source/WebCore/inspector/front-end/ConsoleView.js
Source/WebCore/inspector/front-end/inspector.js

index 7454b8f6295ba1e87141bfcf0f4a0a6afdf5fe1a..6ef3c6ef9b75fce356f601426dbf20d6e3f7fae1 100644 (file)
@@ -1,3 +1,17 @@
+2011-03-22  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: protocol cleanup. ConsoleAgent.
+        https://bugs.webkit.org/show_bug.cgi?id=56806
+
+        renamed method: void setConsoleMessagesEnabled(in boolean enabled, out boolean newState); => void enable(out long expiredMessagesCount);
+        new method: disable()
+        deleted method: [event] void consoleMessageExpiredCountUpdate(out unsigned long count); delete it. The counter will be transfered as out argument of enable command.
+
+        * inspector/protocol/console-agent-expected.txt:
+        * inspector/protocol/console-agent.html:
+
 2011-03-21  Abhishek Arya  <inferno@chromium.org>
 
         Reviewed by Eric Seidel.
index ee5356be06ea2f0714b8c999dee04cb6e8e6453c..1fb83f2c01e5f16649cbda72c3ca4759035b06fb 100644 (file)
@@ -3,36 +3,31 @@ CONSOLE MESSAGE: line 1: test
 Protocol stability test. It is dumping request/response pairs of ConsoleAgent functions.
 
 -----------------------------------------------------------
-ConsoleAgent.setConsoleMessagesEnabled(false)
+ConsoleAgent.disable()
 
 request:
 {
     id : <number>
     domain : "Console"
-    command : "setConsoleMessagesEnabled"
+    command : "disable"
     arguments : {
-        enabled : false
     }
 }
 
 response:
 {
     requestId : <number>
-    body : {
-        newState : false
-    }
 }
 
 -----------------------------------------------------------
-ConsoleAgent.setConsoleMessagesEnabled(true)
+ConsoleAgent.enable()
 
 request:
 {
     id : <number>
     domain : "Console"
-    command : "setConsoleMessagesEnabled"
+    command : "enable"
     arguments : {
-        enabled : true
     }
 }
 
@@ -40,7 +35,7 @@ response:
 {
     requestId : <number>
     body : {
-        newState : true
+        expiredMessagesCount : 0
     }
 }
 
@@ -84,11 +79,11 @@ event ConsoleAgent.consoleMessage
     }
 }
 
-event ConsoleAgent.consoleMessageRepeatCountUpdate
+event ConsoleAgent.consoleMessageRepeatCountUpdated
 {
     type : "event"
     domain : "Console"
-    event : "consoleMessageRepeatCountUpdate"
+    event : "consoleMessageRepeatCountUpdated"
     body : {
         count : 2
     }
@@ -188,13 +183,13 @@ response:
 ===========================================================
 Coverage for ConsoleAgent
 {
-    setConsoleMessagesEnabled : "checked"
+    enable : "checked"
+    disable : "checked"
     clearConsoleMessages : "checked"
     setMonitoringXHREnabled : "checked"
     addInspectedNode : "checked"
     consoleMessage : "checked"
-    consoleMessageExpiredCountUpdate : "not checked"
-    consoleMessageRepeatCountUpdate : "checked"
+    consoleMessageRepeatCountUpdated : "checked"
     consoleMessagesCleared : "checked"
 }
 
index 0329294ad06aefd681499b7904690f8054883d1b..da1e31d719c9826a3e3d952d972e629651a8d18d 100644 (file)
@@ -7,8 +7,8 @@
 function test()
 {
     var testSuite = [
-        ["ConsoleAgent", "setConsoleMessagesEnabled", false],
-        ["ConsoleAgent", "setConsoleMessagesEnabled", true],
+        ["ConsoleAgent", "disable"],
+        ["ConsoleAgent", "enable"],
         ["RuntimeAgent", "evaluate", "console.info('test'); console.info('test')", "test-group", false],
         ["ConsoleAgent", "clearConsoleMessages"],
         ["ConsoleAgent", "setMonitoringXHREnabled", true],
index 3c2dcc551c98d0102668f360ae40fa2dbba220a8..05cda8943213e080b33b0efec7039b45d3219bf0 100644 (file)
@@ -1,3 +1,26 @@
+2011-03-22  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: protocol cleanup. ConsoleAgent.
+        https://bugs.webkit.org/show_bug.cgi?id=56806
+
+        renamed method: void setConsoleMessagesEnabled(in boolean enabled, out boolean newState); => void enable(out long expiredMessagesCount);
+        new method: disable()
+        deleted method: [event] void consoleMessageExpiredCountUpdate(out unsigned long count); delete it. The counter will be transfered as out argument of enable command.
+
+        * inspector/ConsoleMessage.cpp:
+        (WebCore::ConsoleMessage::updateRepeatCountInConsole):
+        * inspector/Inspector.json:
+        * inspector/InspectorConsoleAgent.cpp:
+        (WebCore::InspectorConsoleAgent::enable):
+        (WebCore::InspectorConsoleAgent::disable):
+        * inspector/InspectorConsoleAgent.h:
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype._registerConsoleDomainDispatcher.dispatcher.consoleMessageRepeatCountUpdated):
+        (WebInspector.ConsoleView.prototype.setConsoleMessageExpiredCount):
+        * inspector/front-end/inspector.js:
+
 2011-03-22  Kent Tamura  <tkent@chromium.org>
 
         Reviewed by Eric Seidel.
index 5f5b4fbb5d72601f5c1359de49ce2e31b2a2af71..de61ef84fea557bc8283b9306f50ae6db9046ff8 100644 (file)
@@ -120,7 +120,7 @@ void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, Injecte
 
 void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend::Console* frontend)
 {
-    frontend->consoleMessageRepeatCountUpdate(m_repeatCount);
+    frontend->consoleMessageRepeatCountUpdated(m_repeatCount);
 }
 
 bool ConsoleMessage::isEqual(ConsoleMessage* msg) const
index 9d3364f999e5936fa13ee705c1568024f9858bf9..773a3b8a42fc86599734e777b5f0b8ae92f0d364 100644 (file)
         "types": [],
         "commands": [
             {
-                "name": "setConsoleMessagesEnabled",
-                "parameters": [
-                    { "name": "enabled", "type": "boolean" }
-                ],
+                "name": "enable",
                 "returns": [
-                    { "name": "newState", "type": "boolean" }
+                   { "name": "expiredMessagesCount", "type": "integer" }
                 ]
             },
+            {
+                "name": "disable"
+           },
             {
                 "name": "clearConsoleMessages"
             },
                     { "name": "messageObj", "$ref": "ConsoleMessage" }
                 ]
             },
-            {
-                "name": "consoleMessageExpiredCountUpdate",
-                "parameters": [
-                    { "name": "count", "type": "integer" }
-                ]
-            },
-            {
-                "name": "consoleMessageRepeatCountUpdate",
+           {
+                "name": "consoleMessageRepeatCountUpdated",
                 "parameters": [
                     { "name": "count", "type": "integer" }
                 ]
index 2e671b789c426930c4ecc8416f1380e2cc8273cb..47cd2d5534cb458967d4446790ac5eba27ffb17f 100644 (file)
@@ -79,10 +79,20 @@ InspectorConsoleAgent::~InspectorConsoleAgent()
     m_inspectorDOMAgent = 0;
 }
 
-void InspectorConsoleAgent::setConsoleMessagesEnabled(ErrorString*, bool enabled, bool* newState)
+void InspectorConsoleAgent::enable(ErrorString*, int* consoleMessageExpireCount)
 {
-    *newState = enabled;
-    setConsoleMessagesEnabled(enabled);
+    *consoleMessageExpireCount = m_expiredConsoleMessageCount;
+
+    m_inspectorState->setBoolean(ConsoleAgentState::consoleMessagesEnabled, true);
+
+    size_t messageCount = m_consoleMessages.size();
+    for (size_t i = 0; i < messageCount; ++i)
+        m_consoleMessages[i]->addToFrontend(m_frontend, m_injectedScriptManager);
+}
+
+void InspectorConsoleAgent::disable(ErrorString*)
+{
+    m_inspectorState->setBoolean(ConsoleAgentState::consoleMessagesEnabled, false);
 }
 
 void InspectorConsoleAgent::clearConsoleMessages(ErrorString*)
@@ -226,19 +236,6 @@ void InspectorConsoleAgent::addInspectedNode(ErrorString*, int nodeId)
     m_injectedScriptManager->injectedScriptHost()->addInspectedNode(node);
 }
 
-void InspectorConsoleAgent::setConsoleMessagesEnabled(bool enabled)
-{
-    m_inspectorState->setBoolean(ConsoleAgentState::consoleMessagesEnabled, enabled);
-    if (!enabled || !m_frontend)
-        return;
-
-    if (m_expiredConsoleMessageCount)
-        m_frontend->consoleMessageExpiredCountUpdate(m_expiredConsoleMessageCount);
-    unsigned messageCount = m_consoleMessages.size();
-    for (unsigned i = 0; i < messageCount; ++i)
-        m_consoleMessages[i]->addToFrontend(m_frontend, m_injectedScriptManager);
-}
-
 void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> consoleMessage)
 {
     ASSERT(m_inspectorAgent->enabled());
index 7989457827181a119f6452d2c452792c6013a7f5..2b753b5f4f522f5c3b2bc37ab4e4647abea297d2 100644 (file)
@@ -58,7 +58,8 @@ public:
     InspectorConsoleAgent(InstrumentingAgents*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorDOMAgent*);
     ~InspectorConsoleAgent();
 
-    void setConsoleMessagesEnabled(ErrorString* error, bool enabled, bool* newState);
+    void enable(ErrorString*, int* consoleMessageExpireCount);
+    void disable(ErrorString*);
     void clearConsoleMessages(ErrorString* error);
     void reset();
     void setFrontend(InspectorFrontend*);
@@ -82,7 +83,6 @@ public:
     void addInspectedNode(ErrorString*, int nodeId);
 
 private:
-    void setConsoleMessagesEnabled(bool);
     void addConsoleMessage(PassOwnPtr<ConsoleMessage>);
 
     InstrumentingAgents* m_instrumentingAgents;
index d4ee2b1027c525f452ca7af4077bf9e6581374fc..f3e34254eef0fe3225d50296019a1f13d7ac4160 100644 (file)
@@ -121,13 +121,7 @@ WebInspector.ConsoleView.prototype = {
                 console.addMessage(consoleMessage);
             },
 
-            consoleMessageExpiredCountUpdate: function(count)
-            {
-                var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count);
-                console.addMessage(WebInspector.ConsoleMessage.createTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
-            },
-
-            consoleMessageRepeatCountUpdate: function(count)
+            consoleMessageRepeatCountUpdated: function(count)
             {
                 var msg = console.previousMessage;
                 var prevRepeatCount = msg.totalRepeatCount;
@@ -154,6 +148,14 @@ WebInspector.ConsoleView.prototype = {
         InspectorBackend.registerDomainDispatcher("Console", dispatcher);
     },
 
+    setConsoleMessageExpiredCount: function(count)
+    {
+        if (count) {
+            var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count);
+            this.addMessage(WebInspector.ConsoleMessage.createTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
+        }
+    },
+
     _updateFilter: function(e)
     {
         var isMac = WebInspector.isMac();
index d27685caa7245ac9a3ce067b27fed0cc96b55a29..8fbd727e88b16d15b7d01315529b1bc3ddc00a44 100644 (file)
@@ -505,7 +505,7 @@ WebInspector.doLoadedDone = function()
 
     if (WebInspector.settings.monitoringXHREnabled)
         ConsoleAgent.setMonitoringXHREnabled(true);
-    ConsoleAgent.setConsoleMessagesEnabled(true);
+    ConsoleAgent.enable(this.console.setConsoleMessageExpiredCount.bind(this.console));
 
     WebInspector.showPanel(WebInspector.settings.lastActivePanel);