Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (108046 => 108047)
--- trunk/Source/WebCore/CMakeLists.txt 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/CMakeLists.txt 2012-02-17 08:33:30 UTC (rev 108047)
@@ -892,6 +892,7 @@
inspector/InspectorClient.cpp
inspector/InspectorConsoleAgent.cpp
inspector/InspectorController.cpp
+ inspector/InspectorCounters.cpp
inspector/InspectorDOMAgent.cpp
inspector/InspectorDOMDebuggerAgent.cpp
inspector/InspectorDOMStorageAgent.cpp
Modified: trunk/Source/WebCore/ChangeLog (108046 => 108047)
--- trunk/Source/WebCore/ChangeLog 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/ChangeLog 2012-02-17 08:33:30 UTC (rev 108047)
@@ -1,3 +1,64 @@
+2012-02-16 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: use static counters for estimation of allocated Documents, Nodes and JS EventListeners
+ https://bugs.webkit.org/show_bug.cgi?id=78825
+
+ Introduced static counters of allocated Documents, Nodes and JS EventListeners.
+ Their values are displayed on the Timeline panel.
+
+ Reviewed by Pavel Feldman.
+
+ * CMakeLists.txt:
+ * English.lproj/localizedStrings.js:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::JSEventListener):
+ (WebCore::JSEventListener::~JSEventListener):
+ * bindings/v8/V8AbstractEventListener.cpp:
+ (WebCore::V8AbstractEventListener::V8AbstractEventListener):
+ (WebCore::V8AbstractEventListener::~V8AbstractEventListener):
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ (WebCore::Document::~Document):
+ * dom/Document.h:
+ (WebCore::Node::Node):
+ * dom/Node.cpp:
+ (WebCore::Node::~Node):
+ * inspector/InspectorAllInOne.cpp:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ * inspector/InspectorCounters.cpp: Added.
+ (WebCore):
+ (WebCore::InspectorCounters::counterValue):
+ * inspector/InspectorCounters.h: Added.
+ (WebCore):
+ (InspectorCounters):
+ (WebCore::InspectorCounters::incrementCounter):
+ (WebCore::InspectorCounters::decrementCounter):
+ * inspector/InspectorTimelineAgent.cpp:
+ (WebCore::InspectorTimelineAgent::didCallFunction):
+ (WebCore::InspectorTimelineAgent::didDispatchEvent):
+ (WebCore::InspectorTimelineAgent::didWriteHTML):
+ (WebCore::InspectorTimelineAgent::didFireTimer):
+ (WebCore::InspectorTimelineAgent::didEvaluateScript):
+ (WebCore::InspectorTimelineAgent::setHeapSizeStatistic):
+ (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
+ * inspector/InspectorTimelineAgent.h:
+ (WebCore):
+ (WebCore::InspectorTimelineAgent::create):
+ (InspectorTimelineAgent):
+ * inspector/front-end/MemoryStatistics.js:
+ (WebInspector.MemoryStatistics):
+ (WebInspector.MemoryStatistics.prototype.addTimlineEvent):
+ (WebInspector.MemoryStatistics.prototype._draw.getDocumentCount):
+ (WebInspector.MemoryStatistics.prototype._refreshCurrentValues):
+ * inspector/front-end/TimelinePanel.js:
+ (WebInspector.TimelinePanel.prototype._onTimelineEventRecorded):
+
2012-02-16 Cris Neckar <[email protected]>
Correct a misleading comment regarding string delimiters in CSS parsing.
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js
(Binary files differ)
Modified: trunk/Source/WebCore/GNUmakefile.list.am (108046 => 108047)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-02-17 08:33:30 UTC (rev 108047)
@@ -2377,6 +2377,8 @@
Source/WebCore/inspector/InspectorConsoleAgent.cpp \
Source/WebCore/inspector/InspectorConsoleAgent.h \
Source/WebCore/inspector/InspectorConsoleInstrumentation.h \
+ Source/WebCore/inspector/InspectorCounters.cpp \
+ Source/WebCore/inspector/InspectorCounters.h \
Source/WebCore/inspector/InspectorCSSAgent.cpp \
Source/WebCore/inspector/InspectorCSSAgent.h \
Source/WebCore/inspector/InspectorDatabaseAgent.cpp \
Modified: trunk/Source/WebCore/Target.pri (108046 => 108047)
--- trunk/Source/WebCore/Target.pri 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/Target.pri 2012-02-17 08:33:30 UTC (rev 108047)
@@ -869,6 +869,7 @@
inspector/InspectorClient.cpp \
inspector/InspectorConsoleAgent.cpp \
inspector/InspectorController.cpp \
+ inspector/InspectorCounters.cpp \
inspector/InspectorDatabaseAgent.cpp \
inspector/InspectorDatabaseResource.cpp \
inspector/InspectorDebuggerAgent.cpp \
@@ -1938,6 +1939,7 @@
inspector/InspectorConsoleAgent.h \
inspector/InspectorConsoleInstrumentation.h \
inspector/InspectorController.h \
+ inspector/InspectorCounters.h \
inspector/InspectorCSSAgent.h \
inspector/InspectorDatabaseAgent.h \
inspector/InspectorDatabaseInstrumentation.h \
Modified: trunk/Source/WebCore/WebCore.gypi (108046 => 108047)
--- trunk/Source/WebCore/WebCore.gypi 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/WebCore.gypi 2012-02-17 08:33:30 UTC (rev 108047)
@@ -2366,6 +2366,8 @@
'inspector/InspectorConsoleAgent.h',
'inspector/InspectorConsoleInstrumentation.h',
'inspector/InspectorController.cpp',
+ 'inspector/InspectorCounters.cpp',
+ 'inspector/InspectorCounters.h',
'inspector/InspectorDOMAgent.cpp',
'inspector/InspectorDOMDebuggerAgent.cpp',
'inspector/InspectorDOMDebuggerAgent.h',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (108046 => 108047)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-02-17 08:33:30 UTC (rev 108047)
@@ -71598,6 +71598,30 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\inspector\InspectorCounters.h"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\InspectorCounters.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Production|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\inspector\InspectorController.h"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (108046 => 108047)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-02-17 08:33:30 UTC (rev 108047)
@@ -5882,6 +5882,8 @@
F316396B1329481A00A649CB /* InjectedScriptManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F31639691329481A00A649CB /* InjectedScriptManager.cpp */; };
F316396C1329481A00A649CB /* InjectedScriptManager.h in Headers */ = {isa = PBXBuildFile; fileRef = F316396A1329481A00A649CB /* InjectedScriptManager.h */; };
F316396E1329487600A649CB /* JSInjectedScriptManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F316396D1329487600A649CB /* JSInjectedScriptManager.cpp */; };
+ F325A40A14EE36FA007324E2 /* InspectorCounters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F325A40814EE36FA007324E2 /* InspectorCounters.cpp */; };
+ F325A40B14EE36FA007324E2 /* InspectorCounters.h in Headers */ = {isa = PBXBuildFile; fileRef = F325A40914EE36FA007324E2 /* InspectorCounters.h */; };
F3335BF812E07DC300D33011 /* InspectorConsoleAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3335BF612E07DC300D33011 /* InspectorConsoleAgent.cpp */; };
F3335BF912E07DC300D33011 /* InspectorConsoleAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = F3335BF712E07DC300D33011 /* InspectorConsoleAgent.h */; };
F33F0282120947F200E5743A /* ScriptProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F33F0281120947F200E5743A /* ScriptProfile.cpp */; };
@@ -12902,6 +12904,8 @@
F31639691329481A00A649CB /* InjectedScriptManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScriptManager.cpp; sourceTree = "<group>"; };
F316396A1329481A00A649CB /* InjectedScriptManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScriptManager.h; sourceTree = "<group>"; };
F316396D1329487600A649CB /* JSInjectedScriptManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInjectedScriptManager.cpp; sourceTree = "<group>"; };
+ F325A40814EE36FA007324E2 /* InspectorCounters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorCounters.cpp; sourceTree = "<group>"; };
+ F325A40914EE36FA007324E2 /* InspectorCounters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorCounters.h; 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>"; };
F33F0281120947F200E5743A /* ScriptProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptProfile.cpp; sourceTree = "<group>"; };
@@ -14098,6 +14102,8 @@
F3F5CF1012ED81A80084C569 /* InspectorConsoleInstrumentation.h */,
1C81B9570E97330800266E07 /* InspectorController.cpp */,
1C81B9560E97330800266E07 /* InspectorController.h */,
+ F325A40814EE36FA007324E2 /* InspectorCounters.cpp */,
+ F325A40914EE36FA007324E2 /* InspectorCounters.h */,
82AB1741124B99EC00C5069D /* InspectorCSSAgent.cpp */,
82AB1742124B99EC00C5069D /* InspectorCSSAgent.h */,
7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */,
@@ -22562,6 +22568,7 @@
F3335BF912E07DC300D33011 /* InspectorConsoleAgent.h in Headers */,
F3F5CF1112ED81A80084C569 /* InspectorConsoleInstrumentation.h in Headers */,
1C81B95A0E97330800266E07 /* InspectorController.h in Headers */,
+ F325A40B14EE36FA007324E2 /* InspectorCounters.h in Headers */,
82AB1744124B99EC00C5069D /* InspectorCSSAgent.h in Headers */,
7AB0B1C11211A62200A76940 /* InspectorDatabaseAgent.h in Headers */,
F3F5CF1312ED81B30084C569 /* InspectorDatabaseInstrumentation.h in Headers */,
@@ -25602,6 +25609,7 @@
7A1F2B52126C61B20006A7E6 /* InspectorClient.cpp in Sources */,
F3335BF812E07DC300D33011 /* InspectorConsoleAgent.cpp in Sources */,
1C81B95B0E97330800266E07 /* InspectorController.cpp in Sources */,
+ F325A40A14EE36FA007324E2 /* InspectorCounters.cpp in Sources */,
82AB1743124B99EC00C5069D /* InspectorCSSAgent.cpp in Sources */,
7AB0B1C01211A62200A76940 /* InspectorDatabaseAgent.cpp in Sources */,
41F062150F5F192600A07EAC /* InspectorDatabaseResource.cpp in Sources */,
Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (108046 => 108047)
--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp 2012-02-17 08:33:30 UTC (rev 108047)
@@ -22,6 +22,7 @@
#include "Event.h"
#include "Frame.h"
+#include "InspectorCounters.h"
#include "JSEvent.h"
#include "JSEventTarget.h"
#include "JSMainThreadExecState.h"
@@ -44,11 +45,12 @@
m_jsFunction.setMayBeNull(*m_isolatedWorld->globalData(), wrapper, function);
else
ASSERT(!function);
-
+ InspectorCounters::incrementCounter(InspectorCounters::JSEventListenerCounter);
}
JSEventListener::~JSEventListener()
{
+ InspectorCounters::decrementCounter(InspectorCounters::JSEventListenerCounter);
}
JSObject* JSEventListener::initializeJSFunction(ScriptExecutionContext*) const
Modified: trunk/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp (108046 => 108047)
--- trunk/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp 2012-02-17 08:33:30 UTC (rev 108047)
@@ -35,6 +35,7 @@
#include "Document.h"
#include "Event.h"
#include "Frame.h"
+#include "InspectorCounters.h"
#include "V8Binding.h"
#include "V8Event.h"
#include "V8EventListenerList.h"
@@ -57,6 +58,7 @@
, m_isAttribute(isAttribute)
, m_worldContext(worldContext)
{
+ InspectorCounters::incrementCounter(InspectorCounters::JSEventListenerCounter);
}
V8AbstractEventListener::~V8AbstractEventListener()
@@ -67,6 +69,7 @@
V8EventListenerList::clearWrapper(listener, m_isAttribute);
}
disposeListenerObject();
+ InspectorCounters::decrementCounter(InspectorCounters::JSEventListenerCounter);
}
void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event* event)
Modified: trunk/Source/WebCore/dom/Document.cpp (108046 => 108047)
--- trunk/Source/WebCore/dom/Document.cpp 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-02-17 08:33:30 UTC (rev 108047)
@@ -100,6 +100,7 @@
#include "HitTestRequest.h"
#include "HitTestResult.h"
#include "ImageLoader.h"
+#include "InspectorCounters.h"
#include "InspectorInstrumentation.h"
#include "Logging.h"
#include "MediaQueryList.h"
@@ -510,6 +511,7 @@
#ifndef NDEBUG
m_updatingStyleSelector = false;
#endif
+ InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter);
}
static void histogramMutationEventUsage(const unsigned short& listenerTypes)
@@ -586,6 +588,8 @@
// as well as Node. See a comment on TreeScope.h for the reason.
if (hasRareData())
clearRareData();
+
+ InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter);
}
void Document::removedLastRef()
Modified: trunk/Source/WebCore/dom/Document.h (108046 => 108047)
--- trunk/Source/WebCore/dom/Document.h 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/dom/Document.h 2012-02-17 08:33:30 UTC (rev 108047)
@@ -36,6 +36,7 @@
#include "DocumentEventQueue.h"
#include "DocumentTiming.h"
#include "IconURL.h"
+#include "InspectorCounters.h"
#include "IntRect.h"
#include "LayoutTypes.h"
#include "PageVisibilityState.h"
@@ -1486,6 +1487,7 @@
#if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS)
trackForDebugging();
#endif
+ InspectorCounters::incrementCounter(InspectorCounters::NodeCounter);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/Node.cpp (108046 => 108047)
--- trunk/Source/WebCore/dom/Node.cpp 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/dom/Node.cpp 2012-02-17 08:33:30 UTC (rev 108047)
@@ -63,7 +63,7 @@
#include "HTMLElement.h"
#include "HTMLFrameOwnerElement.h"
#include "HTMLNames.h"
-#include "InspectorInstrumentation.h"
+#include "InspectorCounters.h"
#include "KeyboardEvent.h"
#include "LabelsNodeList.h"
#include "Logging.h"
@@ -405,6 +405,8 @@
if (doc)
doc->guardDeref();
+
+ InspectorCounters::decrementCounter(InspectorCounters::NodeCounter);
}
void Node::setDocument(Document* document)
Modified: trunk/Source/WebCore/inspector/InspectorAllInOne.cpp (108046 => 108047)
--- trunk/Source/WebCore/inspector/InspectorAllInOne.cpp 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/inspector/InspectorAllInOne.cpp 2012-02-17 08:33:30 UTC (rev 108047)
@@ -41,6 +41,7 @@
#include "InspectorClient.cpp"
#include "InspectorConsoleAgent.cpp"
#include "InspectorController.cpp"
+#include "InspectorCounters.cpp"
#include "InspectorDOMAgent.cpp"
#include "InspectorDOMDebuggerAgent.cpp"
#include "InspectorDOMStorageAgent.cpp"
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (108046 => 108047)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2012-02-17 08:33:30 UTC (rev 108047)
@@ -110,13 +110,8 @@
OwnPtr<InspectorDOMStorageAgent> domStorageAgentPtr(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_state.get()));
InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get();
m_agents.append(domStorageAgentPtr.release());
-
-
- OwnPtr<InspectorMemoryAgent>memoryAgentPtr = InspectorMemoryAgent::create(m_instrumentingAgents.get(), m_state.get(), m_page, m_domAgent);
- InspectorMemoryAgent* memoryAgent = memoryAgentPtr.get();
- m_agents.append(memoryAgentPtr.release());
-
- m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), m_state.get(), memoryAgent));
+ m_agents.append(InspectorMemoryAgent::create(m_instrumentingAgents.get(), m_state.get(), m_page, m_domAgent));
+ m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), m_state.get()));
m_agents.append(InspectorApplicationCacheAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent));
OwnPtr<InspectorResourceAgent> resourceAgentPtr(InspectorResourceAgent::create(m_instrumentingAgents.get(), pageAgent, inspectorClient, m_state.get()));
Added: trunk/Source/WebCore/inspector/InspectorCounters.cpp (0 => 108047)
--- trunk/Source/WebCore/inspector/InspectorCounters.cpp (rev 0)
+++ trunk/Source/WebCore/inspector/InspectorCounters.cpp 2012-02-17 08:33:30 UTC (rev 108047)
@@ -0,0 +1,47 @@
+/*
+* Copyright (C) 2012 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:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * 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.
+* * Neither the name of Google Inc. nor the names of its
+* contributors may be used to endorse or promote products derived from
+* this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+* OWNER OR 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 "InspectorCounters.h"
+
+#if ENABLE(INSPECTOR)
+
+namespace WebCore {
+
+int InspectorCounters::s_counters[CounterTypeLength];
+
+int InspectorCounters::counterValue(CounterType type)
+{
+ return s_counters[type];
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
Property changes on: trunk/Source/WebCore/inspector/InspectorCounters.cpp
___________________________________________________________________
Added: svn:eol-style
Added: trunk/Source/WebCore/inspector/InspectorCounters.h (0 => 108047)
--- trunk/Source/WebCore/inspector/InspectorCounters.h (rev 0)
+++ trunk/Source/WebCore/inspector/InspectorCounters.h 2012-02-17 08:33:30 UTC (rev 108047)
@@ -0,0 +1,73 @@
+/*
+* Copyright (C) 2012 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:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * 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.
+* * Neither the name of Google Inc. nor the names of its
+* contributors may be used to endorse or promote products derived from
+* this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+* OWNER OR 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 InspectorCounters_h
+#define InspectorCounters_h
+
+namespace WebCore {
+
+class InspectorCounters {
+public:
+ enum CounterType {
+ DocumentCounter,
+ NodeCounter,
+ JSEventListenerCounter,
+ CounterTypeLength
+ };
+
+ static inline void incrementCounter(CounterType type)
+ {
+#if ENABLE(INSPECTOR)
+ ++s_counters[type];
+#endif
+ }
+
+ static inline void decrementCounter(CounterType type)
+ {
+#if ENABLE(INSPECTOR)
+ --s_counters[type];
+#endif
+ }
+
+#if ENABLE(INSPECTOR)
+ static int counterValue(CounterType);
+#endif
+
+private:
+ InspectorCounters();
+
+#if ENABLE(INSPECTOR)
+ static int s_counters[CounterTypeLength];
+#endif
+};
+
+} // namespace WebCore
+
+#endif // !defined(InspectorCounters_h)
Property changes on: trunk/Source/WebCore/inspector/InspectorCounters.h
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (108046 => 108047)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2012-02-17 08:33:30 UTC (rev 108047)
@@ -35,8 +35,8 @@
#include "Event.h"
#include "IdentifiersFactory.h"
+#include "InspectorCounters.h"
#include "InspectorFrontend.h"
-#include "InspectorMemoryAgent.h"
#include "InspectorState.h"
#include "InstrumentingAgents.h"
#include "IntRect.h"
@@ -177,7 +177,6 @@
void InspectorTimelineAgent::didCallFunction()
{
- collectDomCounters();
didCompleteCurrentRecord(TimelineRecordType::FunctionCall);
}
@@ -188,7 +187,6 @@
void InspectorTimelineAgent::didDispatchEvent()
{
- collectDomCounters();
didCompleteCurrentRecord(TimelineRecordType::EventDispatch);
}
@@ -232,7 +230,6 @@
if (!m_recordStack.isEmpty()) {
TimelineRecordEntry entry = m_recordStack.last();
entry.data->setNumber("endLine", endLine);
- collectDomCounters();
didCompleteCurrentRecord(TimelineRecordType::ParseHTML);
}
}
@@ -254,7 +251,6 @@
void InspectorTimelineAgent::didFireTimer()
{
- collectDomCounters();
didCompleteCurrentRecord(TimelineRecordType::TimerFire);
}
@@ -285,7 +281,6 @@
void InspectorTimelineAgent::didEvaluateScript()
{
- collectDomCounters();
didCompleteCurrentRecord(TimelineRecordType::EvaluateScript);
}
@@ -394,24 +389,15 @@
record->setNumber("usedHeapSize", usedHeapSize);
record->setNumber("totalHeapSize", totalHeapSize);
+ if (m_state->getBoolean(TimelineAgentState::includeMemoryDetails)) {
+ RefPtr<InspectorObject> counters = InspectorObject::create();
+ counters->setNumber("nodes", InspectorCounters::counterValue(InspectorCounters::NodeCounter));
+ counters->setNumber("documents", InspectorCounters::counterValue(InspectorCounters::DocumentCounter));
+ counters->setNumber("jsEventListeners", InspectorCounters::counterValue(InspectorCounters::JSEventListenerCounter));
+ record->setObject("counters", counters.release());
+ }
}
-void InspectorTimelineAgent::collectDomCounters()
-{
- if (!m_state->getBoolean(TimelineAgentState::includeMemoryDetails))
- return;
- if (m_recordStack.isEmpty())
- return;
-
- String error;
- RefPtr<InspectorArray> domGroups;
- RefPtr<InspectorObject> strings;
- m_memoryAgent->getDOMNodeCount(&error, domGroups, strings);
-
- if (domGroups)
- m_recordStack.last().record->setArray("domGroups", domGroups.release());
-}
-
void InspectorTimelineAgent::didCompleteCurrentRecord(const String& type)
{
// An empty stack could merely mean that the timeline agent was turned on in the middle of
@@ -428,12 +414,11 @@
}
}
-InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InspectorMemoryAgent* memoryAgent)
+InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state)
: InspectorBaseAgent<InspectorTimelineAgent>("Timeline", instrumentingAgents, state)
, m_frontend(0)
, m_id(1)
, m_maxCallStackDepth(5)
- , m_memoryAgent(memoryAgent)
{
}
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (108046 => 108047)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h 2012-02-17 08:33:30 UTC (rev 108047)
@@ -45,7 +45,6 @@
namespace WebCore {
class Event;
class InspectorFrontend;
-class InspectorMemoryAgent;
class InspectorState;
class InstrumentingAgents;
class IntRect;
@@ -57,9 +56,9 @@
class InspectorTimelineAgent : public InspectorBaseAgent<InspectorTimelineAgent>, ScriptGCEventListener, public InspectorBackendDispatcher::TimelineCommandHandler {
WTF_MAKE_NONCOPYABLE(InspectorTimelineAgent);
public:
- static PassOwnPtr<InspectorTimelineAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, InspectorMemoryAgent* memoryAgent)
+ static PassOwnPtr<InspectorTimelineAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state)
{
- return adoptPtr(new InspectorTimelineAgent(instrumentingAgents, state, memoryAgent));
+ return adoptPtr(new InspectorTimelineAgent(instrumentingAgents, state));
}
~InspectorTimelineAgent();
@@ -141,11 +140,10 @@
String type;
};
- InspectorTimelineAgent(InstrumentingAgents*, InspectorState*, InspectorMemoryAgent*);
+ InspectorTimelineAgent(InstrumentingAgents*, InspectorState*);
void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack);
void setHeapSizeStatistic(InspectorObject* record);
- void collectDomCounters();
void didCompleteCurrentRecord(const String& type);
void appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack);
@@ -172,7 +170,6 @@
typedef Vector<GCEvent> GCEvents;
GCEvents m_gcEvents;
int m_maxCallStackDepth;
- InspectorMemoryAgent* m_memoryAgent;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/front-end/MemoryStatistics.js (108046 => 108047)
--- trunk/Source/WebCore/inspector/front-end/MemoryStatistics.js 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/inspector/front-end/MemoryStatistics.js 2012-02-17 08:33:30 UTC (rev 108047)
@@ -55,7 +55,7 @@
// Populate sidebar
this._counterSidebarElements = [];
- this._domGroups = this._createCounterSidebarElement(WebInspector.UIString("DOM group count:"), true);
+ this._documents = this._createCounterSidebarElement(WebInspector.UIString("Document count:"), true);
this._domNodes = this._createCounterSidebarElement(WebInspector.UIString("DOM node count:"), true);
this._listeners = this._createCounterSidebarElement(WebInspector.UIString("Event listener count:"), false);
@@ -122,28 +122,12 @@
addTimlineEvent: function(event)
{
- var time = event.data.endTime;
- var domGroups = event.data["domGroups"];
-
- var nodeCount = 0;
- for (var i = 0; i < domGroups.length; i++) {
- var counters = domGroups[i].nodeCount;
- for (var j = 0; j < counters.length; j++)
- nodeCount += counters[j].count;
- }
-
- var listenerCount = 0;
- for (var i = 0; i < domGroups.length; i++) {
- var counters = domGroups[i].listenerCount;
- for (var j = 0; j < counters.length; j++)
- listenerCount += counters[j].count;
- }
-
+ var counters = event.data["counters"];
this._counters.push({
- time: time,
- domGroupCount: domGroups.length,
- nodeCount: nodeCount,
- listenerCount: listenerCount
+ time: event.data.endTime,
+ documentCount: counters.documents,
+ nodeCount: counters.nodes,
+ listenerCount: counters.jsEventListeners
});
},
@@ -154,12 +138,12 @@
this._clear();
var graphHeight = Math.round(this._canvas.height / 3);
- function getGroupCount(entry)
+ function getDocumentCount(entry)
{
- return entry.domGroupCount;
+ return entry.documentCount;
}
this._setVerticalClip(0 * graphHeight + 2, graphHeight - 4);
- this._drawPolyline(getGroupCount, "rgba(100,0,0,0.8)");
+ this._drawPolyline(getDocumentCount, "rgba(100,0,0,0.8)");
this._drawBottomBound("rgba(20,20,20,0.8)");
@@ -225,7 +209,7 @@
break;
}
i--;
- this._domGroups._value.textContent = this._counters[i].domGroupCount;
+ this._documents._value.textContent = this._counters[i].documentCount;
this._domNodes._value.textContent = this._counters[i].nodeCount;
this._listeners._value.textContent = this._counters[i].listenerCount;
},
Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (108046 => 108047)
--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js 2012-02-17 08:08:42 UTC (rev 108046)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js 2012-02-17 08:33:30 UTC (rev 108047)
@@ -451,7 +451,7 @@
this._innerAddRecordToTimeline(event.data, this._rootRecord);
this._scheduleRefresh(false);
- if (this._memoryStatistics && event.data["domGroups"])
+ if (this._memoryStatistics && event.data["counters"])
this._memoryStatistics.addTimlineEvent(event);
},