Title: [124208] trunk/Source/WebCore
Revision
124208
Author
loi...@chromium.org
Date
2012-07-31 08:53:15 -0700 (Tue, 31 Jul 2012)

Log Message

Web Inspector: extract MemoryInstrumentationImpl into separate files for future reusing in unit tests
https://bugs.webkit.org/show_bug.cgi?id=92751

Reviewed by Yury Semikhatsky.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/InspectorAllInOne.cpp:
* inspector/InspectorMemoryAgent.cpp:
(WebCore):
* inspector/MemoryInstrumentationImpl.cpp: Added.
(WebCore):
(WebCore::MemoryInstrumentationImpl::MemoryInstrumentationImpl):
(WebCore::MemoryInstrumentationImpl::processDeferredInstrumentedPointers):
(WebCore::MemoryInstrumentationImpl::countObjectSize):
(WebCore::MemoryInstrumentationImpl::deferInstrumentedPointer):
(WebCore::MemoryInstrumentationImpl::visited):
(WebCore::MemoryInstrumentationImpl::selfSize):
* inspector/MemoryInstrumentationImpl.h: Added.
(WebCore):
(MemoryInstrumentationImpl):
(WebCore::MemoryInstrumentationImpl::totalTypeSize):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (124207 => 124208)


--- trunk/Source/WebCore/CMakeLists.txt	2012-07-31 15:51:29 UTC (rev 124207)
+++ trunk/Source/WebCore/CMakeLists.txt	2012-07-31 15:53:15 UTC (rev 124208)
@@ -1533,6 +1533,7 @@
     inspector/InspectorWebGLAgent.cpp
     inspector/InspectorWorkerAgent.cpp
     inspector/InstrumentingAgents.cpp
+    inspector/MemoryInstrumentationImpl.cpp
     inspector/NetworkResourcesData.cpp
     inspector/PageConsoleAgent.cpp
     inspector/PageDebuggerAgent.cpp

Modified: trunk/Source/WebCore/ChangeLog (124207 => 124208)


--- trunk/Source/WebCore/ChangeLog	2012-07-31 15:51:29 UTC (rev 124207)
+++ trunk/Source/WebCore/ChangeLog	2012-07-31 15:53:15 UTC (rev 124208)
@@ -1,3 +1,31 @@
+2012-04-06  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: extract MemoryInstrumentationImpl into separate files for future reusing in unit tests
+        https://bugs.webkit.org/show_bug.cgi?id=92751
+
+        Reviewed by Yury Semikhatsky.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/InspectorAllInOne.cpp:
+        * inspector/InspectorMemoryAgent.cpp:
+        (WebCore):
+        * inspector/MemoryInstrumentationImpl.cpp: Added.
+        (WebCore):
+        (WebCore::MemoryInstrumentationImpl::MemoryInstrumentationImpl):
+        (WebCore::MemoryInstrumentationImpl::processDeferredInstrumentedPointers):
+        (WebCore::MemoryInstrumentationImpl::countObjectSize):
+        (WebCore::MemoryInstrumentationImpl::deferInstrumentedPointer):
+        (WebCore::MemoryInstrumentationImpl::visited):
+        (WebCore::MemoryInstrumentationImpl::selfSize):
+        * inspector/MemoryInstrumentationImpl.h: Added.
+        (WebCore):
+        (MemoryInstrumentationImpl):
+        (WebCore::MemoryInstrumentationImpl::totalTypeSize):
+
 2012-07-31  Mario Sanchez Prada  <msanc...@igalia.com>
 
         [GTK] Add a new and reusable enchant-based spellchecker in WebCore

Modified: trunk/Source/WebCore/GNUmakefile.list.am (124207 => 124208)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-07-31 15:51:29 UTC (rev 124207)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-07-31 15:53:15 UTC (rev 124208)
@@ -2817,6 +2817,8 @@
 	Source/WebCore/inspector/InspectorWorkerResource.h \
 	Source/WebCore/inspector/InstrumentingAgents.cpp \
 	Source/WebCore/inspector/InstrumentingAgents.h \
+	Source/WebCore/inspector/MemoryInstrumentationImpl.cpp \
+	Source/WebCore/inspector/MemoryInstrumentationImpl.h \
 	Source/WebCore/inspector/NetworkResourcesData.cpp \
 	Source/WebCore/inspector/NetworkResourcesData.h \
 	Source/WebCore/inspector/PageConsoleAgent.cpp \

Modified: trunk/Source/WebCore/Target.pri (124207 => 124208)


--- trunk/Source/WebCore/Target.pri	2012-07-31 15:51:29 UTC (rev 124207)
+++ trunk/Source/WebCore/Target.pri	2012-07-31 15:53:15 UTC (rev 124208)
@@ -779,6 +779,7 @@
     inspector/InspectorWebGLAgent.cpp \
     inspector/InspectorWorkerAgent.cpp \
     inspector/InstrumentingAgents.cpp \
+    inspector/MemoryInstrumentationImpl.cpp \
     inspector/NetworkResourcesData.cpp \
     inspector/PageConsoleAgent.cpp \
     inspector/PageDebuggerAgent.cpp \
@@ -1883,6 +1884,7 @@
     inspector/InspectorWebGLInstrumentation.h \
     inspector/InspectorWorkerAgent.h \
     inspector/InstrumentingAgents.h \
+    inspector/MemoryInstrumentationImpl.h \
     inspector/NetworkResourcesData.h \
     inspector/PageConsoleAgent.h \
     inspector/PageDebuggerAgent.h \

Modified: trunk/Source/WebCore/WebCore.gypi (124207 => 124208)


--- trunk/Source/WebCore/WebCore.gypi	2012-07-31 15:51:29 UTC (rev 124207)
+++ trunk/Source/WebCore/WebCore.gypi	2012-07-31 15:53:15 UTC (rev 124208)
@@ -2886,6 +2886,8 @@
             'inspector/InspectorWorkerAgent.h',
             'inspector/InstrumentingAgents.cpp',
             'inspector/InstrumentingAgents.h',
+            'inspector/MemoryInstrumentationImpl.cpp',
+            'inspector/MemoryInstrumentationImpl.h',
             'inspector/NetworkResourcesData.cpp',
             'inspector/NetworkResourcesData.h',
             'inspector/PageConsoleAgent.cpp',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (124207 => 124208)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-07-31 15:51:29 UTC (rev 124207)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-07-31 15:53:15 UTC (rev 124208)
@@ -74955,6 +74955,30 @@
 				>
 			</File>
 			<File
+				RelativePath="..\inspector\MemoryInstrumentationImpl.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\MemoryInstrumentationImpl.h"
+				>
+			</File>
+			<File
 				RelativePath="..\inspector\NetworkResourcesData.cpp"
 				>
 				<FileConfiguration

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (124207 => 124208)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-07-31 15:51:29 UTC (rev 124207)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-07-31 15:53:15 UTC (rev 124208)
@@ -8587,6 +8587,8 @@
 		4F6FDD631341DEDD001F8EE3 /* InspectorPageAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorPageAgent.h; sourceTree = "<group>"; };
 		4F707A9711EF679400ACDA69 /* InspectorBackendDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBackendDispatcher.cpp; sourceTree = "<group>"; };
 		4F707A9811EF679400ACDA69 /* InspectorBackendDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBackendDispatcher.h; sourceTree = "<group>"; };
+		4F8562F0152F5BD100FAE776 /* MemoryInstrumentationImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryInstrumentationImpl.cpp; sourceTree = "<group>"; };
+		4F8562F1152F5BD100FAE776 /* MemoryInstrumentationImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationImpl.h; sourceTree = "<group>"; };
 		4FA3B908125CD12100300BAD /* InspectorState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorState.cpp; sourceTree = "<group>"; };
 		4FA3B909125CD12200300BAD /* InspectorState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorState.h; sourceTree = "<group>"; };
 		4FD8D0F0119C718B002FA825 /* ScriptGCEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptGCEvent.cpp; sourceTree = "<group>"; };
@@ -14631,6 +14633,8 @@
 				F3ABFE0B130E9DA000E7F7D1 /* InstrumentingAgents.h */,
 				1C81BA050E97348300266E07 /* _javascript_CallFrame.idl */,
 				BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */,
+				4F8562F0152F5BD100FAE776 /* MemoryInstrumentationImpl.cpp */,
+				4F8562F1152F5BD100FAE776 /* MemoryInstrumentationImpl.h */,
 				59C27F04138D28C10079B7E2 /* NetworkResourcesData.cpp */,
 				59C27F06138D28CF0079B7E2 /* NetworkResourcesData.h */,
 				F382088A147D35F90010BC06 /* PageConsoleAgent.cpp */,

Modified: trunk/Source/WebCore/inspector/InspectorAllInOne.cpp (124207 => 124208)


--- trunk/Source/WebCore/inspector/InspectorAllInOne.cpp	2012-07-31 15:51:29 UTC (rev 124207)
+++ trunk/Source/WebCore/inspector/InspectorAllInOne.cpp	2012-07-31 15:53:15 UTC (rev 124208)
@@ -69,6 +69,7 @@
 #include "InspectorWebGLAgent.cpp"
 #include "InspectorWorkerAgent.cpp"
 #include "InstrumentingAgents.cpp"
+#include "MemoryInstrumentationImpl.cpp"
 #include "NetworkResourcesData.cpp"
 #include "PageConsoleAgent.cpp"
 #include "PageDebuggerAgent.cpp"

Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp (124207 => 124208)


--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp	2012-07-31 15:51:29 UTC (rev 124207)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp	2012-07-31 15:53:15 UTC (rev 124208)
@@ -44,7 +44,7 @@
 #include "InspectorValues.h"
 #include "InstrumentingAgents.h"
 #include "MemoryCache.h"
-#include "MemoryInstrumentation.h"
+#include "MemoryInstrumentationImpl.h"
 #include "MemoryUsageSupport.h"
 #include "Node.h"
 #include "Page.h"
@@ -101,8 +101,6 @@
 
 namespace {
 
-typedef HashSet<const void*> VisitedObjects;
-
 String nodeName(Node* node)
 {
     if (node->document()->isXHTMLDocument())
@@ -442,70 +440,7 @@
 
 namespace {
 
-class MemoryInstrumentationImpl : public MemoryInstrumentation {
-public:
-    explicit MemoryInstrumentationImpl(VisitedObjects& visitedObjects)
-        : m_visitedObjects(visitedObjects)
-    {
-        for (int i = 0; i < LastTypeEntry; ++i)
-            m_totalSizes[i] = 0;
-    }
 
-    PassRefPtr<InspectorMemoryBlock> dumpStatistics(InspectorDataCounter* inspectorData)
-    {
-        size_t inspectorSize
-            = calculateContainerSize(m_visitedObjects)
-            + calculateContainerSize(m_deferredInstrumentedPointers);
-        inspectorData->addComponent(MemoryBlockName::inspectorDOMData, inspectorSize);
-
-        size_t totalSize = 0;
-        for (int i = Other; i < LastTypeEntry; ++i)
-            totalSize += m_totalSizes[i];
-
-        RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > domChildren = TypeBuilder::Array<InspectorMemoryBlock>::create();
-        addMemoryBlockFor(domChildren.get(), m_totalSizes[Other], MemoryBlockName::domTreeOther);
-        addMemoryBlockFor(domChildren.get(), m_totalSizes[DOM], MemoryBlockName::domTreeDOM);
-        addMemoryBlockFor(domChildren.get(), m_totalSizes[CSS], MemoryBlockName::domTreeCSS);
-        addMemoryBlockFor(domChildren.get(), m_totalSizes[Binding], MemoryBlockName::domTreeBinding);
-        addMemoryBlockFor(domChildren.get(), m_totalSizes[Loader], MemoryBlockName::domTreeLoader);
-
-        RefPtr<InspectorMemoryBlock> dom = InspectorMemoryBlock::create().setName(MemoryBlockName::dom);
-        dom->setSize(totalSize);
-        dom->setChildren(domChildren.release());
-        return dom.release();
-    }
-
-    void processDeferredInstrumentedPointers()
-    {
-        while (!m_deferredInstrumentedPointers.isEmpty()) {
-            OwnPtr<InstrumentedPointerBase> pointer = m_deferredInstrumentedPointers.last().release();
-            m_deferredInstrumentedPointers.removeLast();
-            pointer->process(this);
-        }
-    }
-
-private:
-    virtual void countObjectSize(ObjectType objectType, size_t size) OVERRIDE
-    {
-        ASSERT(objectType >= 0 && objectType < LastTypeEntry);
-        m_totalSizes[objectType] += size;
-    }
-
-    virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase> pointer) OVERRIDE
-    {
-        m_deferredInstrumentedPointers.append(pointer);
-    }
-
-    virtual bool visited(const void* object) OVERRIDE
-    {
-        return !m_visitedObjects.add(object).isNewEntry;
-    }
-
-    size_t m_totalSizes[LastTypeEntry];
-    VisitedObjects& m_visitedObjects;
-    Vector<OwnPtr<InstrumentedPointerBase> > m_deferredInstrumentedPointers;
-};
-
 class DOMTreesIterator : public NodeWrapperVisitor {
 public:
     DOMTreesIterator(Page* page, VisitedObjects& visitedObjects)
@@ -537,7 +472,23 @@
 
     PassRefPtr<InspectorMemoryBlock> dumpStatistics(InspectorDataCounter* inspectorData)
     {
-        return m_domMemoryUsage.dumpStatistics(inspectorData);
+        inspectorData->addComponent(MemoryBlockName::inspectorDOMData, m_domMemoryUsage.selfSize());
+
+        size_t totalSize = 0;
+        for (int i = MemoryInstrumentation::Other; i < MemoryInstrumentation::LastTypeEntry; ++i)
+            totalSize += m_domMemoryUsage.totalSize(static_cast<MemoryInstrumentation::ObjectType>(i));
+
+        RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > domChildren = TypeBuilder::Array<InspectorMemoryBlock>::create();
+        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::Other), MemoryBlockName::domTreeOther);
+        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::DOM), MemoryBlockName::domTreeDOM);
+        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::CSS), MemoryBlockName::domTreeCSS);
+        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::Binding), MemoryBlockName::domTreeBinding);
+        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::Loader), MemoryBlockName::domTreeLoader);
+
+        RefPtr<InspectorMemoryBlock> dom = InspectorMemoryBlock::create().setName(MemoryBlockName::dom);
+        dom->setSize(totalSize);
+        dom->setChildren(domChildren.release());
+        return dom.release();
     }
 
 private:

Added: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp (0 => 124208)


--- trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp	                        (rev 0)
+++ trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp	2012-07-31 15:53:15 UTC (rev 124208)
@@ -0,0 +1,78 @@
+/*
+ * 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"
+
+#if ENABLE(INSPECTOR)
+
+#include "MemoryInstrumentationImpl.h"
+
+namespace WebCore {
+
+MemoryInstrumentationImpl::MemoryInstrumentationImpl(VisitedObjects& visitedObjects)
+    : m_visitedObjects(visitedObjects)
+{
+    for (int i = 0; i < LastTypeEntry; ++i)
+        m_totalSizes[i] = 0;
+}
+
+void MemoryInstrumentationImpl::processDeferredInstrumentedPointers()
+{
+    while (!m_deferredInstrumentedPointers.isEmpty()) {
+        OwnPtr<InstrumentedPointerBase> pointer = m_deferredInstrumentedPointers.last().release();
+        m_deferredInstrumentedPointers.removeLast();
+        pointer->process(this);
+    }
+}
+
+void MemoryInstrumentationImpl::countObjectSize(ObjectType objectType, size_t size)
+{
+    ASSERT(objectType >= 0 && objectType < LastTypeEntry);
+    m_totalSizes[objectType] += size;
+}
+
+void MemoryInstrumentationImpl::deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase> pointer)
+{
+    m_deferredInstrumentedPointers.append(pointer);
+}
+
+bool MemoryInstrumentationImpl::visited(const void* object)
+{
+    return !m_visitedObjects.add(object).isNewEntry;
+}
+
+size_t MemoryInstrumentationImpl::selfSize() const
+{
+    return calculateContainerSize(m_visitedObjects) + calculateContainerSize(m_deferredInstrumentedPointers);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
Property changes on: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h (0 => 124208)


--- trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h	                        (rev 0)
+++ trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h	2012-07-31 15:53:15 UTC (rev 124208)
@@ -0,0 +1,68 @@
+/*
+ * 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 MemoryInstrumentationImpl_h
+#define MemoryInstrumentationImpl_h
+
+#include "MemoryInstrumentation.h"
+
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+typedef HashSet<const void*> VisitedObjects;
+
+class MemoryInstrumentationImpl : public MemoryInstrumentation {
+public:
+    explicit MemoryInstrumentationImpl(VisitedObjects&);
+
+    void processDeferredInstrumentedPointers();
+    size_t selfSize() const;
+    size_t totalSize(ObjectType objectType)
+    {
+        ASSERT(objectType >= 0 && objectType < LastTypeEntry);
+        return m_totalSizes[objectType];
+    }
+
+private:
+    virtual void countObjectSize(ObjectType, size_t) OVERRIDE;
+    virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) OVERRIDE;
+    virtual bool visited(const void*) OVERRIDE;
+
+    size_t m_totalSizes[LastTypeEntry];
+    VisitedObjects& m_visitedObjects;
+    Vector<OwnPtr<InstrumentedPointerBase> > m_deferredInstrumentedPointers;
+};
+
+} // namespace WebCore
+
+#endif // !defined(MemoryInstrumentationImpl_h)
+
Property changes on: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h
___________________________________________________________________

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to