[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

yurys at chromium.org yurys at chromium.org
Sun Feb 20 22:57:28 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 7382e72a7a62376bc5078cc80a233037aec651dc
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 14 14:57:21 2011 +0000

    2011-01-13  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: extract console related functionality into InspectorConsoleAgent
            https://bugs.webkit.org/show_bug.cgi?id=52282
    
            * CMakeLists.txt:
            * GNUmakefile.am:
            * WebCore.gypi:
            * WebCore.pro:
            * inspector/CodeGeneratorInspector.pm:
            * inspector/ConsoleMessage.cpp:
            (WebCore::ConsoleMessage::~ConsoleMessage):
            * inspector/ConsoleMessage.h:
            * inspector/Inspector.idl:
            * inspector/InspectorConsoleAgent.cpp: Added.
            (WebCore::InspectorConsoleAgent::InspectorConsoleAgent):
            (WebCore::InspectorConsoleAgent::~InspectorConsoleAgent):
            (WebCore::InspectorConsoleAgent::setConsoleMessagesEnabled):
            (WebCore::InspectorConsoleAgent::clearConsoleMessages):
            (WebCore::InspectorConsoleAgent::reset):
            (WebCore::InspectorConsoleAgent::setFrontend):
            (WebCore::InspectorConsoleAgent::addMessageToConsole):
            (WebCore::InspectorConsoleAgent::startTiming):
            (WebCore::InspectorConsoleAgent::stopTiming):
            (WebCore::InspectorConsoleAgent::count):
            (WebCore::InspectorConsoleAgent::resourceRetrievedByXMLHttpRequest):
            (WebCore::InspectorConsoleAgent::didReceiveResponse):
            (WebCore::InspectorConsoleAgent::didFailLoading):
            (WebCore::InspectorConsoleAgent::addConsoleMessage):
            * inspector/InspectorConsoleAgent.h: Added.
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::InspectorController):
            (WebCore::InspectorController::clearConsoleMessages):
            (WebCore::InspectorController::connectFrontend):
            (WebCore::InspectorController::disconnectFrontend):
            (WebCore::InspectorController::didCommitLoad):
            * inspector/InspectorController.h:
            (WebCore::InspectorController::consoleAgent):
            * inspector/InspectorInstrumentation.cpp:
            (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
            (WebCore::InspectorInstrumentation::didFailLoadingImpl):
            (WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl):
            (WebCore::InspectorInstrumentation::addMessageToConsole):
            (WebCore::InspectorInstrumentation::count):
            (WebCore::InspectorInstrumentation::startTiming):
            (WebCore::InspectorInstrumentation::stopTiming):
            (WebCore::InspectorInstrumentation::addStartProfilingMessageToConsole):
            * inspector/InspectorInstrumentation.h:
            * inspector/InspectorProfilerAgent.cpp:
            (WebCore::InspectorProfilerAgent::addProfileFinishedMessageToConsole):
            (WebCore::InspectorProfilerAgent::addStartProfilingMessageToConsole):
            * inspector/front-end/ConsoleView.js:
            (WebInspector.ConsoleView):
            (WebInspector.ConsoleView.prototype.addConsoleMessage):
            (WebInspector.ConsoleView.prototype.updateConsoleMessageExpiredCount):
            (WebInspector.ConsoleView.prototype.consoleMessagesCleared):
            * inspector/front-end/inspector.js:
            * page/Console.cpp:
            (WebCore::Console::addMessage):
            (WebCore::Console::count):
            (WebCore::Console::profile):
            (WebCore::Console::time):
            (WebCore::Console::timeEnd):
            (WebCore::Console::group):
            (WebCore::Console::groupCollapsed):
            (WebCore::Console::groupEnd):
            * page/Console.h:
            * page/Console.idl:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75792 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index f8e3156..8050b48 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -1155,6 +1155,7 @@ SET(WebCore_SOURCES
     inspector/InspectorBrowserDebuggerAgent.cpp
     inspector/InspectorCSSAgent.cpp
     inspector/InspectorClient.cpp
+    inspector/InspectorConsoleAgent.cpp
     inspector/InspectorController.cpp
     inspector/InspectorDOMAgent.cpp
     inspector/InspectorDOMStorageAgent.cpp
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 021226a..782e4dc 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,74 @@
+2011-01-13  Yury Semikhatsky  <yurys at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: extract console related functionality into InspectorConsoleAgent
+        https://bugs.webkit.org/show_bug.cgi?id=52282
+
+        * CMakeLists.txt:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/ConsoleMessage.cpp:
+        (WebCore::ConsoleMessage::~ConsoleMessage):
+        * inspector/ConsoleMessage.h:
+        * inspector/Inspector.idl:
+        * inspector/InspectorConsoleAgent.cpp: Added.
+        (WebCore::InspectorConsoleAgent::InspectorConsoleAgent):
+        (WebCore::InspectorConsoleAgent::~InspectorConsoleAgent):
+        (WebCore::InspectorConsoleAgent::setConsoleMessagesEnabled):
+        (WebCore::InspectorConsoleAgent::clearConsoleMessages):
+        (WebCore::InspectorConsoleAgent::reset):
+        (WebCore::InspectorConsoleAgent::setFrontend):
+        (WebCore::InspectorConsoleAgent::addMessageToConsole):
+        (WebCore::InspectorConsoleAgent::startTiming):
+        (WebCore::InspectorConsoleAgent::stopTiming):
+        (WebCore::InspectorConsoleAgent::count):
+        (WebCore::InspectorConsoleAgent::resourceRetrievedByXMLHttpRequest):
+        (WebCore::InspectorConsoleAgent::didReceiveResponse):
+        (WebCore::InspectorConsoleAgent::didFailLoading):
+        (WebCore::InspectorConsoleAgent::addConsoleMessage):
+        * inspector/InspectorConsoleAgent.h: Added.
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::clearConsoleMessages):
+        (WebCore::InspectorController::connectFrontend):
+        (WebCore::InspectorController::disconnectFrontend):
+        (WebCore::InspectorController::didCommitLoad):
+        * inspector/InspectorController.h:
+        (WebCore::InspectorController::consoleAgent):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
+        (WebCore::InspectorInstrumentation::didFailLoadingImpl):
+        (WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl):
+        (WebCore::InspectorInstrumentation::addMessageToConsole):
+        (WebCore::InspectorInstrumentation::count):
+        (WebCore::InspectorInstrumentation::startTiming):
+        (WebCore::InspectorInstrumentation::stopTiming):
+        (WebCore::InspectorInstrumentation::addStartProfilingMessageToConsole):
+        * inspector/InspectorInstrumentation.h:
+        * inspector/InspectorProfilerAgent.cpp:
+        (WebCore::InspectorProfilerAgent::addProfileFinishedMessageToConsole):
+        (WebCore::InspectorProfilerAgent::addStartProfilingMessageToConsole):
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView):
+        (WebInspector.ConsoleView.prototype.addConsoleMessage):
+        (WebInspector.ConsoleView.prototype.updateConsoleMessageExpiredCount):
+        (WebInspector.ConsoleView.prototype.consoleMessagesCleared):
+        * inspector/front-end/inspector.js:
+        * page/Console.cpp:
+        (WebCore::Console::addMessage):
+        (WebCore::Console::count):
+        (WebCore::Console::profile):
+        (WebCore::Console::time):
+        (WebCore::Console::timeEnd):
+        (WebCore::Console::group):
+        (WebCore::Console::groupCollapsed):
+        (WebCore::Console::groupEnd):
+        * page/Console.h:
+        * page/Console.idl:
+
 2011-01-14  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am
index eb33b5d..6c364ab 100644
--- a/Source/WebCore/GNUmakefile.am
+++ b/Source/WebCore/GNUmakefile.am
@@ -1952,6 +1952,8 @@ webcore_sources += \
 	Source/WebCore/inspector/InspectorClient.h \
 	Source/WebCore/inspector/InspectorController.cpp \
 	Source/WebCore/inspector/InspectorController.h \
+	Source/WebCore/inspector/InspectorConsoleAgent.cpp \
+	Source/WebCore/inspector/InspectorConsoleAgent.h \
 	Source/WebCore/inspector/InspectorCSSAgent.cpp \
 	Source/WebCore/inspector/InspectorCSSAgent.h \
 	Source/WebCore/inspector/InspectorDatabaseAgent.cpp \
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index da087fd..6552492 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -2006,6 +2006,8 @@
             'inspector/InspectorBrowserDebuggerAgent.h',
             'inspector/InspectorClient.cpp',
             'inspector/InspectorClient.h',
+            'inspector/InspectorConsoleAgent.cpp',
+            'inspector/InspectorConsoleAgent.h',
             'inspector/InspectorController.cpp',
             'inspector/InspectorController.h',
             'inspector/InspectorCSSAgent.cpp',
diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro
index bb76ba7..5edae33 100644
--- a/Source/WebCore/WebCore.pro
+++ b/Source/WebCore/WebCore.pro
@@ -1046,6 +1046,7 @@ SOURCES += \
     inspector/InspectorBrowserDebuggerAgent.cpp \
     inspector/InspectorCSSAgent.cpp \
     inspector/InspectorClient.cpp \
+    inspector/InspectorConsoleAgent.cpp \
     inspector/InspectorController.cpp \
     inspector/InspectorDatabaseAgent.cpp \
     inspector/InspectorDatabaseResource.cpp \
@@ -1938,6 +1939,7 @@ HEADERS += \
     inspector/InjectedScriptHost.h \
     inspector/InspectorApplicationCacheAgent.h \
     inspector/InspectorBrowserDebuggerAgent.h \
+    inspector/InspectorConsoleAgent.h \
     inspector/InspectorController.h \
     inspector/InspectorCSSAgent.h \
     inspector/InspectorDatabaseAgent.h \
diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index 654c44f..39671a0 100755
--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -65026,6 +65026,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\inspector\InspectorConsoleAgent.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\inspector\InspectorConsoleAgent.h"
+				>
+			</File>
+			<File
 				RelativePath="..\inspector\InspectorController.cpp"
 				>
 			</File>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 32e022c..f2c42de 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -5590,6 +5590,8 @@
 		EDE3A5000C7A430600956A37 /* ColorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = EDE3A4FF0C7A430600956A37 /* ColorMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEC98020AED7E170059137F /* WebCorePrefix.h */; };
 		F33F0282120947F200E5743A /* ScriptProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F0281120947F200E5743A /* ScriptProfile.cpp */; };
+		F3335BF812E07DC300D33011 /* InspectorConsoleAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3335BF612E07DC300D33011 /* InspectorConsoleAgent.cpp */; };
+		F3335BF912E07DC300D33011 /* InspectorConsoleAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = F3335BF712E07DC300D33011 /* InspectorConsoleAgent.h */; };
 		F33F053D120B0DA500E5743A /* InspectorDebuggerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F053B120B0DA500E5743A /* InspectorDebuggerAgent.cpp */; };
 		F33F053E120B0DA500E5743A /* InspectorDebuggerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = F33F053C120B0DA500E5743A /* InspectorDebuggerAgent.h */; };
 		F344C7141125B82C00F26EEE /* InspectorFrontendClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11928,6 +11930,8 @@
 		EDE3A4FF0C7A430600956A37 /* ColorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorMac.h; sourceTree = "<group>"; };
 		EDEC98020AED7E170059137F /* WebCorePrefix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCorePrefix.h; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
 		F33F0281120947F200E5743A /* ScriptProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptProfile.cpp; sourceTree = "<group>"; };
+		F3335BF612E07DC300D33011 /* InspectorConsoleAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorConsoleAgent.cpp; sourceTree = "<group>"; };
+		F3335BF712E07DC300D33011 /* InspectorConsoleAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorConsoleAgent.h; sourceTree = "<group>"; };
 		F33F053B120B0DA500E5743A /* InspectorDebuggerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDebuggerAgent.cpp; sourceTree = "<group>"; };
 		F33F053C120B0DA500E5743A /* InspectorDebuggerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDebuggerAgent.h; sourceTree = "<group>"; };
 		F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendClient.h; sourceTree = "<group>"; };
@@ -12931,6 +12935,8 @@
 				F3D4C47712E07663003DA150 /* InspectorBrowserDebuggerAgent.h */,
 				7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */,
 				1C81B9580E97330800266E07 /* InspectorClient.h */,
+				F3335BF612E07DC300D33011 /* InspectorConsoleAgent.cpp */,
+				F3335BF712E07DC300D33011 /* InspectorConsoleAgent.h */,
 				1C81B9570E97330800266E07 /* InspectorController.cpp */,
 				1C81B9560E97330800266E07 /* InspectorController.h */,
 				82AB1741124B99EC00C5069D /* InspectorCSSAgent.cpp */,
@@ -20814,6 +20820,7 @@
 				B885E8D511E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h in Headers */,
 				4F707A9A11EF679400ACDA69 /* InspectorBackendDispatcher.h in Headers */,
 				1C81B95C0E97330800266E07 /* InspectorClient.h in Headers */,
+				F3335BF912E07DC300D33011 /* InspectorConsoleAgent.h in Headers */,
 				1C81B95A0E97330800266E07 /* InspectorController.h in Headers */,
 				82AB1744124B99EC00C5069D /* InspectorCSSAgent.h in Headers */,
 				7AB0B1C11211A62200A76940 /* InspectorDatabaseAgent.h in Headers */,
@@ -23546,6 +23553,7 @@
 				B885E8D411E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp in Sources */,
 				4F707A9911EF679400ACDA69 /* InspectorBackendDispatcher.cpp in Sources */,
 				7A1F2B52126C61B20006A7E6 /* InspectorClient.cpp in Sources */,
+				F3335BF812E07DC300D33011 /* InspectorConsoleAgent.cpp in Sources */,
 				1C81B95B0E97330800266E07 /* InspectorController.cpp in Sources */,
 				82AB1743124B99EC00C5069D /* InspectorCSSAgent.cpp in Sources */,
 				7AB0B1C01211A62200A76940 /* InspectorDatabaseAgent.cpp in Sources */,
diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.pm b/Source/WebCore/inspector/CodeGeneratorInspector.pm
index 30cc565..b7be15e 100644
--- a/Source/WebCore/inspector/CodeGeneratorInspector.pm
+++ b/Source/WebCore/inspector/CodeGeneratorInspector.pm
@@ -20,6 +20,11 @@ $typeTransform{"CSS"} = {
     "header" => "InspectorCSSAgent.h",
     "domainAccessor" => "m_inspectorController->m_cssAgent",
 };
+$typeTransform{"Console"} = {
+    "forward" => "InspectorConsoleAgent",
+    "header" => "InspectorConsoleAgent.h",
+    "domainAccessor" => "m_inspectorController->m_consoleAgent",
+};
 $typeTransform{"Debugger"} = {
     "forward" => "InspectorDebuggerAgent",
     "header" => "InspectorDebuggerAgent.h",
diff --git a/Source/WebCore/inspector/ConsoleMessage.cpp b/Source/WebCore/inspector/ConsoleMessage.cpp
index b22a6ef..8d56a5a 100644
--- a/Source/WebCore/inspector/ConsoleMessage.cpp
+++ b/Source/WebCore/inspector/ConsoleMessage.cpp
@@ -82,6 +82,10 @@ ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, c
 {
 }
 
+ConsoleMessage::~ConsoleMessage()
+{
+}
+
 void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHost* injectedScriptHost)
 {
     RefPtr<InspectorObject> jsonObj = InspectorObject::create();
diff --git a/Source/WebCore/inspector/ConsoleMessage.h b/Source/WebCore/inspector/ConsoleMessage.h
index 06a17d4..310aa8e 100644
--- a/Source/WebCore/inspector/ConsoleMessage.h
+++ b/Source/WebCore/inspector/ConsoleMessage.h
@@ -51,6 +51,7 @@ public:
     ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, unsigned li, const String& u);
     ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
     ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, const String& responseUrl, unsigned long identifier);
+    ~ConsoleMessage();
 
     void addToFrontend(InspectorFrontend*, InjectedScriptHost*);
     void updateRepeatCountInConsole(InspectorFrontend* frontend);
diff --git a/Source/WebCore/inspector/InjectedScriptHost.cpp b/Source/WebCore/inspector/InjectedScriptHost.cpp
index 8d6c8e7..3fd70e4 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.cpp
+++ b/Source/WebCore/inspector/InjectedScriptHost.cpp
@@ -43,6 +43,7 @@
 #include "HTMLFrameOwnerElement.h"
 #include "InjectedScript.h"
 #include "InspectorClient.h"
+#include "InspectorConsoleAgent.h"
 #include "InspectorController.h"
 #include "InspectorDOMAgent.h"
 #include "InspectorFrontend.h"
@@ -83,7 +84,7 @@ InjectedScriptHost::~InjectedScriptHost()
 void InjectedScriptHost::clearConsoleMessages()
 {
     if (m_inspectorController)
-        m_inspectorController->clearConsoleMessages();
+        m_inspectorController->consoleAgent()->clearConsoleMessages();
 }
 
 void InjectedScriptHost::copyText(const String& text)
diff --git a/Source/WebCore/inspector/Inspector.idl b/Source/WebCore/inspector/Inspector.idl
index b11d9fe..2d89b4a 100644
--- a/Source/WebCore/inspector/Inspector.idl
+++ b/Source/WebCore/inspector/Inspector.idl
@@ -75,12 +75,12 @@ module core {
         // Console API
         ///////////////////////////////////////////////////////////////////////
 
-        [domain=Inspector] void setConsoleMessagesEnabled(in boolean enabled, out boolean newState);
-        [notify, domain=Inspector] void addConsoleMessage(out Object messageObj);
-        [notify, domain=Inspector] void updateConsoleMessageExpiredCount(out unsigned long count);
-        [notify, domain=Inspector] void updateConsoleMessageRepeatCount(out unsigned long count);
-        [domain=Inspector] void clearConsoleMessages();
-        [notify, domain=Inspector] void consoleMessagesCleared();
+        [domain=Console] void setConsoleMessagesEnabled(in boolean enabled, out boolean newState);
+        [notify, domain=Console] void addConsoleMessage(out Object messageObj);
+        [notify, domain=Console] void updateConsoleMessageExpiredCount(out unsigned long count);
+        [notify, domain=Console] void updateConsoleMessageRepeatCount(out unsigned long count);
+        [domain=Console] void clearConsoleMessages();
+        [notify, domain=Console] void consoleMessagesCleared();
 
         ///////////////////////////////////////////////////////////////////////
         // Network API
diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.cpp b/Source/WebCore/inspector/InspectorConsoleAgent.cpp
new file mode 100644
index 0000000..d5ad491
--- /dev/null
+++ b/Source/WebCore/inspector/InspectorConsoleAgent.cpp
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "config.h"
+#include "InspectorConsoleAgent.h"
+
+#if ENABLE(INSPECTOR)
+#include "Console.h"
+#include "ConsoleMessage.h"
+#include "InjectedScriptHost.h"
+#include "InspectorController.h"
+#include "InspectorDOMAgent.h"
+#include "InspectorFrontend.h"
+#include "InspectorState.h"
+#include "ResourceError.h"
+#include "ResourceResponse.h"
+#include "ScriptArguments.h"
+#include "ScriptCallStack.h"
+#include <wtf/CurrentTime.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/text/StringConcatenate.h>
+
+namespace WebCore {
+
+static const unsigned maximumConsoleMessages = 1000;
+static const unsigned expireConsoleMessagesStep = 100;
+
+InspectorConsoleAgent::InspectorConsoleAgent(InspectorController* inspectorController, InspectorState* state)
+    : m_inspectorController(inspectorController)
+    , m_state(state)
+    , m_frontend(0)
+    , m_previousMessage(0)
+    , m_expiredConsoleMessageCount(0)
+{
+}
+
+InspectorConsoleAgent::~InspectorConsoleAgent()
+{
+    m_inspectorController = 0;
+}
+
+void InspectorConsoleAgent::setConsoleMessagesEnabled(bool enabled, bool* newState)
+{
+    *newState = enabled;
+    setConsoleMessagesEnabled(enabled);
+}
+
+void InspectorConsoleAgent::clearConsoleMessages()
+{
+    m_consoleMessages.clear();
+    m_expiredConsoleMessageCount = 0;
+    m_previousMessage = 0;
+    m_inspectorController->injectedScriptHost()->releaseWrapperObjectGroup(0 /* release the group in all scripts */, "console");
+    if (InspectorDOMAgent* domAgent = m_inspectorController->domAgent())
+        domAgent->releaseDanglingNodes();
+    if (m_frontend)
+        m_frontend->consoleMessagesCleared();
+}
+
+void InspectorConsoleAgent::reset()
+{
+    clearConsoleMessages();
+    m_times.clear();
+    m_counts.clear();
+}
+
+void InspectorConsoleAgent::setFrontend(InspectorFrontend* frontend)
+{
+    m_frontend = frontend;
+}
+
+void InspectorConsoleAgent::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
+{
+    if (!m_inspectorController->enabled())
+        return;
+    addConsoleMessage(new ConsoleMessage(source, type, level, message, arguments, callStack));
+}
+
+void InspectorConsoleAgent::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
+{
+    if (!m_inspectorController->enabled())
+        return;
+    addConsoleMessage(new ConsoleMessage(source, type, level, message, lineNumber, sourceID));
+}
+
+void InspectorConsoleAgent::startTiming(const String& title)
+{
+    // Follow Firebug's behavior of requiring a title that is not null or
+    // undefined for timing functions
+    if (title.isNull())
+        return;
+
+    m_times.add(title, currentTime() * 1000);
+}
+
+void InspectorConsoleAgent::stopTiming(const String& title, unsigned lineNumber, const String& sourceName)
+{
+    // Follow Firebug's behavior of requiring a title that is not null or
+    // undefined for timing functions
+    if (title.isNull())
+        return;
+
+    HashMap<String, double>::iterator it = m_times.find(title);
+    if (it == m_times.end())
+        return;
+
+    double startTime = it->second;
+    m_times.remove(it);
+
+    double elapsed = currentTime() * 1000 - startTime;
+    String message = title + String::format(": %.0fms", elapsed);
+    addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceName);
+}
+
+void InspectorConsoleAgent::count(const String& title, unsigned lineNumber, const String& sourceID)
+{
+    String identifier = makeString(title, '@', sourceID, ':', String::number(lineNumber));
+    HashMap<String, unsigned>::iterator it = m_counts.find(identifier);
+    int count;
+    if (it == m_counts.end())
+        count = 1;
+    else {
+        count = it->second + 1;
+        m_counts.remove(it);
+    }
+
+    m_counts.add(identifier, count);
+
+    String message = makeString(title, ": ", String::number(count));
+    addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceID);
+}
+
+void InspectorConsoleAgent::resourceRetrievedByXMLHttpRequest(const String& url, const String& sendURL, unsigned sendLineNumber)
+{
+    if (!m_inspectorController->enabled())
+        return;
+    if (m_state->getBoolean(InspectorState::monitoringXHR))
+        addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + url + "\".", sendLineNumber, sendURL);
+}
+
+void InspectorConsoleAgent::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
+{
+    if (!m_inspectorController->enabled())
+        return;
+
+    if (response.httpStatusCode() >= 400) {
+        String message = makeString("Failed to load resource: the server responded with a status of ", String::number(response.httpStatusCode()), " (", response.httpStatusText(), ')');
+        addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, response.url().string(), identifier));
+    }
+}
+
+void InspectorConsoleAgent::didFailLoading(unsigned long identifier, const ResourceError& error)
+{
+    if (!m_inspectorController->enabled())
+        return;
+
+    String message = "Failed to load resource";
+    if (!error.localizedDescription().isEmpty())
+        message += ": " + error.localizedDescription();
+    addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, error.failingURL(), identifier));
+}
+
+void InspectorConsoleAgent::setConsoleMessagesEnabled(bool enabled)
+{
+    m_state->setBoolean(InspectorState::consoleMessagesEnabled, enabled);
+    if (!m_inspectorController->enabled())
+        return;
+    if (m_expiredConsoleMessageCount)
+        m_frontend->updateConsoleMessageExpiredCount(m_expiredConsoleMessageCount);
+    unsigned messageCount = m_consoleMessages.size();
+    for (unsigned i = 0; i < messageCount; ++i)
+        m_consoleMessages[i]->addToFrontend(m_frontend, m_inspectorController->injectedScriptHost());
+}
+
+void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> consoleMessage)
+{
+    ASSERT(m_inspectorController->enabled());
+    ASSERT_ARG(consoleMessage, consoleMessage);
+
+    if (m_previousMessage && m_previousMessage->isEqual(consoleMessage.get())) {
+        m_previousMessage->incrementCount();
+        if (m_state->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend)
+            m_previousMessage->updateRepeatCountInConsole(m_frontend);
+    } else {
+        m_previousMessage = consoleMessage.get();
+        m_consoleMessages.append(consoleMessage);
+        if (m_state->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend)
+            m_previousMessage->addToFrontend(m_frontend, m_inspectorController->injectedScriptHost());
+    }
+
+    if (!m_frontend && m_consoleMessages.size() >= maximumConsoleMessages) {
+        m_expiredConsoleMessageCount += expireConsoleMessagesStep;
+        m_consoleMessages.remove(0, expireConsoleMessagesStep);
+    }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.h b/Source/WebCore/inspector/InspectorConsoleAgent.h
new file mode 100644
index 0000000..b60d745
--- /dev/null
+++ b/Source/WebCore/inspector/InspectorConsoleAgent.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorConsoleAgent_h
+#define InspectorConsoleAgent_h
+
+#include "Console.h"
+#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+#if ENABLE(INSPECTOR)
+
+class ConsoleMessage;
+class InspectorController;
+class InspectorFrontend;
+class InspectorState;
+class ResourceError;
+class ResourceResponse;
+class ScriptArguments;
+class ScriptCallStack;
+class ScriptProfile;
+
+class InspectorConsoleAgent : public Noncopyable {
+public:
+    InspectorConsoleAgent(InspectorController*, InspectorState*);
+    ~InspectorConsoleAgent();
+
+    void setConsoleMessagesEnabled(bool enabled, bool* newState);
+    void clearConsoleMessages();
+    void reset();
+    void setFrontend(InspectorFrontend*);
+
+    void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
+    void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
+
+    void startTiming(const String& title);
+    void stopTiming(const String& title, unsigned lineNumber, const String& sourceName);
+    void count(const String& title, unsigned lineNumber, const String& sourceID);
+
+    void resourceRetrievedByXMLHttpRequest(const String& url, const String& sendURL, unsigned sendLineNumber);
+    void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
+    void didFailLoading(unsigned long identifier, const ResourceError&);
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+    void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
+    void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL);
+#endif
+
+private:
+    void setConsoleMessagesEnabled(bool);
+    void addConsoleMessage(PassOwnPtr<ConsoleMessage>);
+
+    InspectorController* m_inspectorController;
+    InspectorState* m_state;
+    InspectorFrontend* m_frontend;
+    ConsoleMessage* m_previousMessage;
+    Vector<OwnPtr<ConsoleMessage> > m_consoleMessages;
+    unsigned m_expiredConsoleMessageCount;
+    HashMap<String, unsigned> m_counts;
+    HashMap<String, double> m_times;
+};
+
+#endif
+
+} // namespace WebCore
+
+#endif // !defined(InspectorConsoleAgent_h)
diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp
index e59600e..85a948d 100644
--- a/Source/WebCore/inspector/InspectorController.cpp
+++ b/Source/WebCore/inspector/InspectorController.cpp
@@ -35,8 +35,6 @@
 #include "CachedResource.h"
 #include "CachedResourceLoader.h"
 #include "Chrome.h"
-#include "Console.h"
-#include "ConsoleMessage.h"
 #include "Cookie.h"
 #include "CookieJar.h"
 #include "DOMWindow.h"
@@ -61,6 +59,7 @@
 #include "InspectorBrowserDebuggerAgent.h"
 #include "InspectorCSSAgent.h"
 #include "InspectorClient.h"
+#include "InspectorConsoleAgent.h"
 #include "InspectorDOMAgent.h"
 #include "InspectorDOMStorageResource.h"
 #include "InspectorDatabaseResource.h"
@@ -132,24 +131,20 @@ const char* const InspectorController::ConsolePanel = "console";
 const char* const InspectorController::ScriptsPanel = "scripts";
 const char* const InspectorController::ProfilesPanel = "profiles";
 
-static const unsigned maximumConsoleMessages = 1000;
-static const unsigned expireConsoleMessagesStep = 100;
-
 InspectorController::InspectorController(Page* page, InspectorClient* client)
     : m_inspectedPage(page)
     , m_client(client)
     , m_openingFrontend(false)
     , m_cssAgent(new InspectorCSSAgent())
-    , m_expiredConsoleMessageCount(0)
-    , m_previousMessage(0)
+    , m_state(new InspectorState(client))
     , m_inspectorBackendDispatcher(new InspectorBackendDispatcher(this))
     , m_injectedScriptHost(InjectedScriptHost::create(this))
+    , m_consoleAgent(new InspectorConsoleAgent(this, m_state.get()))
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     , m_attachDebuggerWhenShown(false)
     , m_profilerAgent(InspectorProfilerAgent::create(this))
 #endif
 {
-    m_state = new InspectorState(client);
     ASSERT_ARG(page, page);
     ASSERT_ARG(client, client);
 }
@@ -308,85 +303,6 @@ void InspectorController::hideHighlight()
     m_client->hideHighlight();
 }
 
-void InspectorController::setConsoleMessagesEnabled(bool enabled, bool* newState)
-{
-    *newState = enabled;
-    setConsoleMessagesEnabled(enabled);
-}
-
-void InspectorController::setConsoleMessagesEnabled(bool enabled)
-{
-    m_state->setBoolean(InspectorState::consoleMessagesEnabled, enabled);
-    if (!enabled)
-        return;
-
-    if (m_expiredConsoleMessageCount)
-        m_frontend->updateConsoleMessageExpiredCount(m_expiredConsoleMessageCount);
-    unsigned messageCount = m_consoleMessages.size();
-    for (unsigned i = 0; i < messageCount; ++i)
-        m_consoleMessages[i]->addToFrontend(m_frontend.get(), m_injectedScriptHost.get());
-}
-
-void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
-{
-    if (!enabled())
-        return;
-
-    addConsoleMessage(new ConsoleMessage(source, type, level, message, arguments, callStack));
-}
-
-void InspectorController::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
-{
-    if (!enabled())
-        return;
-
-    addConsoleMessage(new ConsoleMessage(source, type, level, message, lineNumber, sourceID));
-}
-
-void InspectorController::addConsoleMessage(PassOwnPtr<ConsoleMessage> consoleMessage)
-{
-    ASSERT(enabled());
-    ASSERT_ARG(consoleMessage, consoleMessage);
-
-    if (m_previousMessage && m_previousMessage->isEqual(consoleMessage.get())) {
-        m_previousMessage->incrementCount();
-        if (m_state->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend)
-            m_previousMessage->updateRepeatCountInConsole(m_frontend.get());
-    } else {
-        m_previousMessage = consoleMessage.get();
-        m_consoleMessages.append(consoleMessage);
-        if (m_state->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend)
-            m_previousMessage->addToFrontend(m_frontend.get(), m_injectedScriptHost.get());
-    }
-
-    if (!m_frontend && m_consoleMessages.size() >= maximumConsoleMessages) {
-        m_expiredConsoleMessageCount += expireConsoleMessagesStep;
-        m_consoleMessages.remove(0, expireConsoleMessagesStep);
-    }
-}
-
-void InspectorController::clearConsoleMessages()
-{
-    m_consoleMessages.clear();
-    m_expiredConsoleMessageCount = 0;
-    m_previousMessage = 0;
-    m_injectedScriptHost->releaseWrapperObjectGroup(0 /* release the group in all scripts */, "console");
-    if (m_domAgent)
-        m_domAgent->releaseDanglingNodes();
-    if (m_frontend)
-        m_frontend->consoleMessagesCleared();
-}
-
-void InspectorController::startGroup(PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack, bool collapsed)
-{
-    addConsoleMessage(new ConsoleMessage(JSMessageSource, collapsed ? StartGroupCollapsedMessageType : StartGroupMessageType, LogMessageLevel, "", arguments, callStack));
-}
-
-void InspectorController::endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL)
-{
-    addConsoleMessage(new ConsoleMessage(source, EndGroupMessageType, LogMessageLevel, String(), lineNumber, sourceURL));
-}
-
 void InspectorController::markTimeline(const String& message)
 {
     if (timelineAgent())
@@ -490,6 +406,8 @@ void InspectorController::connectFrontend()
     if (m_timelineAgent)
         m_timelineAgent->resetFrontendProxyObject(m_frontend.get());
 
+    m_consoleAgent->setFrontend(m_frontend.get());
+
     // Initialize Web Inspector title.
     m_frontend->inspectedURLChanged(m_inspectedPage->mainFrame()->loader()->url().string());
 
@@ -573,6 +491,7 @@ void InspectorController::disconnectFrontend()
     m_profilerAgent->setFrontend(0);
     m_profilerAgent->stopUserInitiatedProfiling(true);
 #endif
+    m_consoleAgent->setFrontend(0);
 
     releaseFrontendLifetimeAgents();
     m_timelineAgent.clear();
@@ -717,10 +636,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
             m_frontend->inspectedURLChanged(loader->url().string());
 
         m_injectedScriptHost->discardInjectedScripts();
-        clearConsoleMessages();
-
-        m_times.clear();
-        m_counts.clear();
+        m_consoleAgent->reset();
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
         if (m_debuggerAgent) {
@@ -816,37 +732,6 @@ void InspectorController::willSendRequest(ResourceRequest& request)
     }
 }
 
-void InspectorController::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
-{
-    if (!enabled())
-        return;
-
-    if (response.httpStatusCode() >= 400) {
-        String message = makeString("Failed to load resource: the server responded with a status of ", String::number(response.httpStatusCode()), " (", response.httpStatusText(), ')');
-        addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, response.url().string(), identifier));
-    }
-}
-
-void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& error)
-{
-    if (!enabled())
-        return;
-
-    String message = "Failed to load resource";
-    if (!error.localizedDescription().isEmpty())
-        message += ": " + error.localizedDescription();
-    addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, error.failingURL(), identifier));
-}
-
-void InspectorController::resourceRetrievedByXMLHttpRequest(const String& url, const String& sendURL, unsigned sendLineNumber)
-{
-    if (!enabled())
-        return;
-
-    if (m_state->getBoolean(InspectorState::monitoringXHR))
-        addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + url + "\".", sendLineNumber, sendURL);
-}
-
 void InspectorController::ensureSettingsLoaded()
 {
     if (m_settings)
@@ -1113,17 +998,6 @@ void InspectorController::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsig
     m_profilerAgent->addProfile(prpProfile, lineNumber, sourceURL);
 }
 
-void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL)
-{
-    m_profilerAgent->addProfileFinishedMessageToConsole(prpProfile, lineNumber, sourceURL);
-}
-
-void InspectorController::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL)
-{
-    m_profilerAgent->addStartProfilingMessageToConsole(title, lineNumber, sourceURL);
-}
-
-
 bool InspectorController::isRecordingUserInitiatedProfile() const
 {
     return m_profilerAgent->isRecordingUserInitiatedProfile();
@@ -1598,42 +1472,6 @@ void InspectorController::openInInspectedWindow(const String& url)
     newFrame->loader()->changeLocation(mainFrame->document()->securityOrigin(), newFrame->loader()->completeURL(url), "", false, false);
 }
 
-void InspectorController::count(const String& title, unsigned lineNumber, const String& sourceID)
-{
-    String identifier = makeString(title, '@', sourceID, ':', String::number(lineNumber));
-    HashMap<String, unsigned>::iterator it = m_counts.find(identifier);
-    int count;
-    if (it == m_counts.end())
-        count = 1;
-    else {
-        count = it->second + 1;
-        m_counts.remove(it);
-    }
-
-    m_counts.add(identifier, count);
-
-    String message = makeString(title, ": ", String::number(count));
-    addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceID);
-}
-
-void InspectorController::startTiming(const String& title)
-{
-    m_times.add(title, currentTime() * 1000);
-}
-
-bool InspectorController::stopTiming(const String& title, double& elapsed)
-{
-    HashMap<String, double>::iterator it = m_times.find(title);
-    if (it == m_times.end())
-        return false;
-
-    double startTime = it->second;
-    m_times.remove(it);
-
-    elapsed = currentTime() * 1000 - startTime;
-    return true;
-}
-
 InjectedScript InspectorController::injectedScriptForNodeId(long id)
 {
 
diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h
index 4cbe931..12ad0bf 100644
--- a/Source/WebCore/inspector/InspectorController.h
+++ b/Source/WebCore/inspector/InspectorController.h
@@ -45,7 +45,6 @@ namespace WebCore {
 
 class CachedResource;
 class CharacterData;
-class ConsoleMessage;
 class Database;
 class Document;
 class DocumentLoader;
@@ -59,6 +58,7 @@ class InspectorArray;
 class InspectorBackendDispatcher;
 class InspectorBrowserDebuggerAgent;
 class InspectorClient;
+class InspectorConsoleAgent;
 class InspectorCSSAgent;
 class InspectorDOMAgent;
 class InspectorDOMStorageAgent;
@@ -143,11 +143,8 @@ public:
     void reuseFrontend();
     void disconnectFrontend();
 
-    void setConsoleMessagesEnabled(bool enabled, bool* newState);
-    void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack>);
-    void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String&);
-    void clearConsoleMessages();
-    const Vector<OwnPtr<ConsoleMessage> >& consoleMessages() const { return m_consoleMessages; }
+    InspectorConsoleAgent* consoleAgent() const { return m_consoleAgent.get(); }
+    InspectorDOMAgent* domAgent() const { return m_domAgent.get(); }
 
     bool searchingForNodeInPage() const;
     void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
@@ -206,20 +203,10 @@ public:
     void openInInspectedWindow(const String& url);
     void drawElementTitle(GraphicsContext&, const IntRect& boundingBox, const FloatRect& overlayRect, WebCore::Settings*) const;
 
-    void count(const String& title, unsigned lineNumber, const String& sourceID);
-
-    void startTiming(const String& title);
-    bool stopTiming(const String& title, double& elapsed);
-
-    void startGroup(PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack> callFrame, bool collapsed = false);
-    void endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL);
-
     void markTimeline(const String& message);
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     void addProfile(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
-    void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
-    void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL);
     bool isRecordingUserInitiatedProfile() const;
     String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
     void startProfiling() { startUserInitiatedProfiling(); }
@@ -265,14 +252,10 @@ private:
     friend class InjectedScriptHost;
 
     void willSendRequest(ResourceRequest&);
-    void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
-    void didFailLoading(unsigned long identifier, const ResourceError&);
-    void resourceRetrievedByXMLHttpRequest(const String& url, const String& sendURL, unsigned sendLineNumber);
 
     void ensureSettingsLoaded();
 
     void getInspectorState(RefPtr<InspectorObject>* state);
-    void setConsoleMessagesEnabled(bool);
 
     void populateScriptObjects();
     void restoreDebugger();
@@ -302,8 +285,6 @@ private:
 
     void focusNode();
 
-    void addConsoleMessage(PassOwnPtr<ConsoleMessage>);
-
     bool isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl);
 
     void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
@@ -338,10 +319,6 @@ private:
 
     RefPtr<Node> m_nodeToFocus;
     RefPtr<InspectorResourceAgent> m_resourceAgent;
-    Vector<OwnPtr<ConsoleMessage> > m_consoleMessages;
-    unsigned m_expiredConsoleMessageCount;
-    HashMap<String, double> m_times;
-    HashMap<String, unsigned> m_counts;
 
 #if ENABLE(DATABASE)
     typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
@@ -354,9 +331,9 @@ private:
 
     String m_showAfterVisible;
     RefPtr<Node> m_highlightedNode;
-    ConsoleMessage* m_previousMessage;
     OwnPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
     RefPtr<InjectedScriptHost> m_injectedScriptHost;
+    OwnPtr<InspectorConsoleAgent> m_consoleAgent;
 
     Vector<pair<long, String> > m_pendingEvaluateTestCommands;
     Vector<String> m_scriptsToEvaluateOnLoad;
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp
index 0d7f2fe..67fa77e 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp
+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp
@@ -39,11 +39,15 @@
 #include "EventContext.h"
 #include "InspectorApplicationCacheAgent.h"
 #include "InspectorBrowserDebuggerAgent.h"
+#include "InspectorConsoleAgent.h"
 #include "InspectorController.h"
 #include "InspectorDOMAgent.h"
 #include "InspectorDebuggerAgent.h"
+#include "InspectorProfilerAgent.h"
 #include "InspectorResourceAgent.h"
 #include "InspectorTimelineAgent.h"
+#include "ScriptArguments.h"
+#include "ScriptCallStack.h"
 #include "XMLHttpRequest.h"
 #include <wtf/text/CString.h>
 
@@ -409,8 +413,7 @@ void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorIns
     InspectorController* ic = cookie.first;
     if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
         resourceAgent->didReceiveResponse(identifier, loader, response);
-    // FIXME(52282): move this to console agent.
-    ic->didReceiveResponse(identifier, response);
+    ic->m_consoleAgent->didReceiveResponse(identifier, response);
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
         timelineAgent->didReceiveResourceResponse();
 }
@@ -431,8 +434,7 @@ void InspectorInstrumentation::didFinishLoadingImpl(InspectorController* ic, uns
 
 void InspectorInstrumentation::didFailLoadingImpl(InspectorController* ic, unsigned long identifier, const ResourceError& error)
 {
-    // FIXME(52282): move this to console agent.
-    ic->didFailLoading(identifier, error);
+    ic->m_consoleAgent->didFailLoading(identifier, error);
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(ic))
         timelineAgent->didFinishLoadingResource(identifier, true, 0);
     if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
@@ -441,7 +443,7 @@ void InspectorInstrumentation::didFailLoadingImpl(InspectorController* ic, unsig
 
 void InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl(InspectorController* ic, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
 {
-    ic->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber);
+    ic->m_consoleAgent->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber);
     if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
         resourceAgent->setInitialContent(identifier, sourceString, "XHR");
 }
@@ -505,6 +507,49 @@ void InspectorInstrumentation::updateApplicationCacheStatusImpl(InspectorControl
 }
 #endif
 
+void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
+{
+    if (!page)
+        return;
+    page->inspectorController()->consoleAgent()->addMessageToConsole(source, type, level, message, arguments, callStack);
+}
+
+void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
+{
+    if (!page)
+        return;
+    page->inspectorController()->consoleAgent()->addMessageToConsole(source, type, level, message, lineNumber, sourceID);
+}
+
+void InspectorInstrumentation::count(Page* page, const String& title, unsigned lineNumber, const String& sourceID)
+{
+    if (!page)
+        return;
+    page->inspectorController()->consoleAgent()->count(title, lineNumber, sourceID);
+}
+
+void InspectorInstrumentation::startTiming(Page* page, const String& title)
+{
+    if (!page)
+        return;
+    page->inspectorController()->consoleAgent()->startTiming(title);
+}
+
+void InspectorInstrumentation::stopTiming(Page* page, const String& title, unsigned lineNumber, const String& sourceName)
+{
+    if (!page)
+        return;
+    page->inspectorController()->consoleAgent()->stopTiming(title, lineNumber, sourceName);
+}
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+void InspectorInstrumentation::addStartProfilingMessageToConsole(InspectorController* ic, const String& title, unsigned lineNumber, const String& sourceURL)
+{
+    if (InspectorProfilerAgent* profilerAgent = ic->m_profilerAgent.get())
+        profilerAgent->addStartProfilingMessageToConsole(title, lineNumber, sourceURL);
+}
+#endif
+
 bool InspectorInstrumentation::hasFrontend(InspectorController* inspectorController)
 {
     return inspectorController->hasFrontend();
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h
index a037794..7f744f4 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.h
+++ b/Source/WebCore/inspector/InspectorInstrumentation.h
@@ -49,6 +49,8 @@ class KURL;
 class Node;
 class ResourceRequest;
 class ResourceResponse;
+class ScriptArguments;
+class ScriptCallStack;
 class ScriptExecutionContext;
 class XMLHttpRequest;
 
@@ -118,6 +120,18 @@ public:
 #endif
     static void networkStateChanged(Page*);
     static void updateApplicationCacheStatus(Frame*);
+
+    static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
+    static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String&);
+
+    static void count(Page*, const String& title, unsigned lineNumber, const String& sourceID);
+    static void startTiming(Page*, const String& title);
+    static void stopTiming(Page*, const String& title, unsigned lineNumber, const String& sourceName);
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+    static void addStartProfilingMessageToConsole(InspectorController*, const String& title, unsigned lineNumber, const String& sourceURL);
+#endif
+
 #if ENABLE(INSPECTOR)
     static void frontendCreated() { s_frontendCounter += 1; }
     static void frontendDeleted() { s_frontendCounter -= 1; }
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
index ac67a1a..da9b67d 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
@@ -33,6 +33,7 @@
 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
 
 #include "Console.h"
+#include "InspectorConsoleAgent.h"
 #include "InspectorController.h"
 #include "InspectorFrontend.h"
 #include "InspectorValues.h"
@@ -90,13 +91,13 @@ void InspectorProfilerAgent::addProfileFinishedMessageToConsole(PassRefPtr<Scrip
     RefPtr<ScriptProfile> profile = prpProfile;
     String title = profile->title();
     String message = makeString("Profile \"webkit-profile://", CPUProfileType, '/', encodeWithURLEscapeSequences(title), '#', String::number(profile->uid()), "\" finished.");
-    m_inspectorController->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
+    m_inspectorController->consoleAgent()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
 }
 
 void InspectorProfilerAgent::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL)
 {
     String message = makeString("Profile \"webkit-profile://", CPUProfileType, '/', encodeWithURLEscapeSequences(title), "#0\" started.");
-    m_inspectorController->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
+    m_inspectorController->consoleAgent()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
 }
 
 PassRefPtr<InspectorObject> InspectorProfilerAgent::createProfileHeader(const ScriptProfile& profile)
diff --git a/Source/WebCore/inspector/front-end/ConsoleView.js b/Source/WebCore/inspector/front-end/ConsoleView.js
index f2b7ca1..a40030e 100644
--- a/Source/WebCore/inspector/front-end/ConsoleView.js
+++ b/Source/WebCore/inspector/front-end/ConsoleView.js
@@ -97,9 +97,63 @@ WebInspector.ConsoleView = function(drawer)
         "node":   this._formatnode,
         "string": this._formatstring
     };
+
+    this._registerConsoleDomainDispatcher();
 }
 
 WebInspector.ConsoleView.prototype = {
+    _registerConsoleDomainDispatcher: function() {
+        var console = this;
+        var dispatcher = {
+            addConsoleMessage: function(payload)
+            {
+                var consoleMessage = new WebInspector.ConsoleMessage(
+                    payload.source,
+                    payload.type,
+                    payload.level,
+                    payload.line,
+                    payload.url,
+                    payload.repeatCount,
+                    payload.message,
+                    payload.parameters,
+                    payload.stackTrace,
+                    payload.requestId);
+                console.addMessage(consoleMessage);
+            },
+
+            updateConsoleMessageExpiredCount: 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));
+            },
+
+            updateConsoleMessageRepeatCount: function(count)
+            {
+                var msg = console.previousMessage;
+                var prevRepeatCount = msg.totalRepeatCount;
+
+                if (!console.commandSincePreviousMessage) {
+                    msg.repeatDelta = count - prevRepeatCount;
+                    msg.repeatCount = msg.repeatCount + msg.repeatDelta;
+                    msg.totalRepeatCount = count;
+                    msg._updateRepeatCount();
+                    console._incrementErrorWarningCount(msg);
+                } else {
+                    var msgCopy = new WebInspector.ConsoleMessage(msg.source, msg.type, msg.level, msg.line, msg.url, count - prevRepeatCount, msg._messageText, msg._parameters, msg._stackTrace, msg._requestId);
+                    msgCopy.totalRepeatCount = count;
+                    msgCopy._formatMessage();
+                    console.addMessage(msgCopy);
+                }
+            },
+
+            consoleMessagesCleared: function()
+            {
+                console.clearMessages();
+            }
+        }
+        InspectorBackend.registerDomainDispatcher("Console", dispatcher);
+    },
+
     _updateFilter: function(e)
     {
         var isMac = WebInspector.isMac();
@@ -247,25 +301,6 @@ WebInspector.ConsoleView.prototype = {
             this._scheduleScrollIntoView();
     },
 
-    updateMessageRepeatCount: function(count)
-    {
-        var msg = this.previousMessage;
-        var prevRepeatCount = msg.totalRepeatCount;
-
-        if (!this.commandSincePreviousMessage) {
-            msg.repeatDelta = count - prevRepeatCount;
-            msg.repeatCount = msg.repeatCount + msg.repeatDelta;
-            msg.totalRepeatCount = count;
-            msg._updateRepeatCount();
-            this._incrementErrorWarningCount(msg);
-        } else {
-            var msgCopy = new WebInspector.ConsoleMessage(msg.source, msg.type, msg.level, msg.line, msg.url, count - prevRepeatCount, msg._messageText, msg._parameters, msg._stackTrace, msg._requestId);
-            msgCopy.totalRepeatCount = count;
-            msgCopy._formatMessage();
-            this.addMessage(msgCopy);
-        }
-    },
-
     _incrementErrorWarningCount: function(msg)
     {
         switch (msg.level) {
diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js
index 32ec3bf..cd074fd 100644
--- a/Source/WebCore/inspector/front-end/inspector.js
+++ b/Source/WebCore/inspector/front-end/inspector.js
@@ -1178,11 +1178,6 @@ WebInspector.showPanel = function(panel)
     this.currentPanel = this.panels[panel];
 }
 
-WebInspector.consoleMessagesCleared = function()
-{
-    WebInspector.console.clearMessages();
-}
-
 WebInspector.domContentEventFired = function(time)
 {
     this.panels.audits.mainResourceDOMContentTime = time;
@@ -1240,33 +1235,6 @@ WebInspector.inspectedURLChanged = function(url)
     this.extensionServer.notifyInspectedURLChanged();
 }
 
-WebInspector.updateConsoleMessageExpiredCount = function(count)
-{
-    var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count);
-    WebInspector.console.addMessage(WebInspector.ConsoleMessage.createTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
-}
-
-WebInspector.addConsoleMessage = function(payload)
-{
-    var consoleMessage = new WebInspector.ConsoleMessage(
-        payload.source,
-        payload.type,
-        payload.level,
-        payload.line,
-        payload.url,
-        payload.repeatCount,
-        payload.message,
-        payload.parameters,
-        payload.stackTrace,
-        payload.requestId);
-    this.console.addMessage(consoleMessage);
-}
-
-WebInspector.updateConsoleMessageRepeatCount = function(count)
-{
-    this.console.updateMessageRepeatCount(count);
-}
-
 WebInspector.log = function(message, messageLevel)
 {
     // remember 'this' for setInterval() callback
diff --git a/Source/WebCore/page/Console.cpp b/Source/WebCore/page/Console.cpp
index 219647d..cf91559 100644
--- a/Source/WebCore/page/Console.cpp
+++ b/Source/WebCore/page/Console.cpp
@@ -31,11 +31,11 @@
 
 #include "Chrome.h"
 #include "ChromeClient.h"
-#include "ConsoleMessage.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameTree.h"
 #include "InspectorController.h"
+#include "InspectorInstrumentation.h"
 #include "MemoryInfo.h"
 #include "Page.h"
 #include "PageGroup.h"
@@ -148,9 +148,9 @@ void Console::addMessage(MessageSource source, MessageType type, MessageLevel le
 
 #if ENABLE(INSPECTOR)
     if (callStack)
-        page->inspectorController()->addMessageToConsole(source, type, level, message, 0, callStack);
+        InspectorInstrumentation::addMessageToConsole(page, source, type, level, message, 0, callStack);
     else
-        page->inspectorController()->addMessageToConsole(source, type, level, message, lineNumber, sourceURL);
+        InspectorInstrumentation::addMessageToConsole(page, source, type, level, message, lineNumber, sourceURL);
 #endif
 
     if (!Console::shouldPrintExceptions())
@@ -190,7 +190,7 @@ void Console::addMessage(MessageType type, MessageLevel level, PassRefPtr<Script
         page->chrome()->client()->addMessageToConsole(JSMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.sourceURL());
 
 #if ENABLE(INSPECTOR)
-    page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, message, arguments, callStack);
+    InspectorInstrumentation::addMessageToConsole(page, JSMessageSource, type, level, message, arguments, callStack);
 #endif
 }
 
@@ -260,8 +260,7 @@ void Console::count(PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCall
     // the same bucket as no argument
     String title;
     arguments->getFirstArgumentAsString(title);
-
-    page->inspectorController()->count(title, lastCaller.lineNumber(), lastCaller.sourceURL());
+    InspectorInstrumentation::count(page, title, lastCaller.lineNumber(), lastCaller.sourceURL());
 #else
     UNUSED_PARAM(callStack);
 #endif
@@ -283,33 +282,6 @@ void Console::markTimeline(PassRefPtr<ScriptArguments> arguments, PassRefPtr<Scr
 #endif
 }
 
-#if ENABLE(WML)
-String Console::lastWMLErrorMessage() const
-{
-#if ENABLE(INSPECTOR)
-    Page* page = this->page();
-    if (!page)
-        return String();
-
-    const Vector<OwnPtr<ConsoleMessage> >& consoleMessages = page->inspectorController()->consoleMessages();
-    if (consoleMessages.isEmpty())
-        return String();
-
-    Vector<OwnPtr<ConsoleMessage> >::const_iterator it = consoleMessages.begin();
-    const Vector<OwnPtr<ConsoleMessage> >::const_iterator end = consoleMessages.end();
-
-    for (; it != end; ++it) {
-        ConsoleMessage* message = it->get();
-        if (message->source() != WMLMessageSource)
-            continue;
-
-        return message->message();
-    }
-#endif
-    return String();
-}
-#endif
-
 #if ENABLE(JAVASCRIPT_DEBUGGER)
 
 void Console::profile(const String& title, ScriptState* state, PassRefPtr<ScriptCallStack> callStack)
@@ -337,7 +309,7 @@ void Console::profile(const String& title, ScriptState* state, PassRefPtr<Script
 
 #if ENABLE(INSPECTOR)
     const ScriptCallFrame& lastCaller = callStack->at(0);
-    controller->addStartProfilingMessageToConsole(resolvedTitle, lastCaller.lineNumber(), lastCaller.sourceURL());
+    InspectorInstrumentation::addStartProfilingMessageToConsole(controller, resolvedTitle, lastCaller.lineNumber(), lastCaller.sourceURL());
 #endif
 }
 
@@ -370,16 +342,7 @@ void Console::profileEnd(const String& title, ScriptState* state, PassRefPtr<Scr
 void Console::time(const String& title)
 {
 #if ENABLE(INSPECTOR)
-    Page* page = this->page();
-    if (!page)
-        return;
-
-    // Follow Firebug's behavior of requiring a title that is not null or
-    // undefined for timing functions
-    if (title.isNull())
-        return;
-
-    page->inspectorController()->startTiming(title);
+    InspectorInstrumentation::startTiming(page(), title);
 #else
     UNUSED_PARAM(title);
 #endif
@@ -388,23 +351,8 @@ void Console::time(const String& title)
 void Console::timeEnd(const String& title, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack> callStack)
 {
 #if ENABLE(INSPECTOR)
-    Page* page = this->page();
-    if (!page)
-        return;
-
-    // Follow Firebug's behavior of requiring a title that is not null or
-    // undefined for timing functions
-    if (title.isNull())
-        return;
-
-    double elapsed;
-    if (!page->inspectorController()->stopTiming(title, elapsed))
-        return;
-
-    String message = title + String::format(": %.0fms", elapsed);
-
     const ScriptCallFrame& lastCaller = callStack->at(0);
-    page->inspectorController()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lastCaller.lineNumber(), lastCaller.sourceURL());
+    InspectorInstrumentation::stopTiming(page(), title, lastCaller.lineNumber(), lastCaller.sourceURL());
 #else
     UNUSED_PARAM(title);
     UNUSED_PARAM(callStack);
@@ -414,11 +362,7 @@ void Console::timeEnd(const String& title, PassRefPtr<ScriptArguments>, PassRefP
 void Console::group(PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
 {
 #if ENABLE(INSPECTOR)
-    Page* page = this->page();
-    if (!page)
-        return;
-
-    page->inspectorController()->startGroup(arguments, callStack);
+    InspectorInstrumentation::addMessageToConsole(page(), JSMessageSource, StartGroupMessageType, LogMessageLevel, String(), arguments, callStack);
 #else
     UNUSED_PARAM(arguments);
     UNUSED_PARAM(callStack);
@@ -428,11 +372,7 @@ void Console::group(PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCall
 void Console::groupCollapsed(PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack)
 {
 #if ENABLE(INSPECTOR)
-    Page* page = this->page();
-    if (!page)
-        return;
-
-    page->inspectorController()->startGroup(arguments, callStack, true);
+    InspectorInstrumentation::addMessageToConsole(page(), JSMessageSource, StartGroupCollapsedMessageType, LogMessageLevel, String(), arguments, callStack);
 #else
     UNUSED_PARAM(arguments);
     UNUSED_PARAM(callStack);
@@ -442,11 +382,7 @@ void Console::groupCollapsed(PassRefPtr<ScriptArguments> arguments, PassRefPtr<S
 void Console::groupEnd()
 {
 #if ENABLE(INSPECTOR)
-    Page* page = this->page();
-    if (!page)
-        return;
-
-    page->inspectorController()->endGroup(JSMessageSource, 0, String());
+    InspectorInstrumentation::addMessageToConsole(page(), JSMessageSource, EndGroupMessageType, LogMessageLevel, String(), 0, String());
 #endif
 }
 
diff --git a/Source/WebCore/page/Console.h b/Source/WebCore/page/Console.h
index dd692a2..ceefb38 100644
--- a/Source/WebCore/page/Console.h
+++ b/Source/WebCore/page/Console.h
@@ -101,9 +101,6 @@ public:
     void assertCondition(bool condition, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
     void count(PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
     void markTimeline(PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
-#if ENABLE(WML)
-    String lastWMLErrorMessage() const;
-#endif
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     const ProfilesArray& profiles() const { return m_profiles; }
     void profile(const String&, ScriptState*, PassRefPtr<ScriptCallStack>);
diff --git a/Source/WebCore/page/Console.idl b/Source/WebCore/page/Console.idl
index 503bb91..189280d 100644
--- a/Source/WebCore/page/Console.idl
+++ b/Source/WebCore/page/Console.idl
@@ -42,10 +42,6 @@ module window {
         [CustomArgumentHandling] void count();
         [CustomArgumentHandling] void markTimeline();
 
-#if defined(ENABLE_WML) && ENABLE_WML
-        [DontEnum] DOMString lastWMLErrorMessage();
-#endif
-
 #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
         readonly attribute [CustomGetter] Array profiles;
         [Custom] void profile(in DOMString title);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list