Web Inspector: extract Vector instrumentation from core NMI code into MemoryInstrumen...
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2012 07:54:44 +0000 (07:54 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2012 07:54:44 +0000 (07:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=96650

Reviewed by Vsevolod Vlasov.

Source/WebCore:

addInstrumentedVector and addInstrumentedVectorPtr were replaced with addMember.
The same thing happens with addVector and addVectorPtr.

* css/CSSGradientValue.cpp:
(WebCore::CSSGradientValue::reportBaseClassMemoryUsage):
* css/CSSImageSetValue.cpp:
(WebCore::CSSImageSetValue::reportDescendantMemoryUsage):
* css/CSSMediaRule.cpp:
(WebCore::CSSMediaRule::reportDescendantMemoryUsage):
* css/CSSRuleList.cpp:
(WebCore::StaticCSSRuleList::reportMemoryUsage):
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::reportMemoryUsage):
* css/CSSValueList.cpp:
(WebCore::CSSValueList::reportDescendantMemoryUsage):
* css/MediaList.cpp:
(WebCore::MediaQuerySet::reportMemoryUsage):
* css/MediaQuery.cpp:
(WebCore::MediaQuery::reportMemoryUsage):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):
* css/StyleRule.cpp:
(WebCore::StyleRuleBlock::reportDescendantMemoryUsage):
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::reportMemoryUsage):
* css/WebKitCSSKeyframesRule.cpp:
(WebCore::StyleRuleKeyframes::reportDescendantMemoryUsage):
(WebCore::WebKitCSSKeyframesRule::reportDescendantMemoryUsage):
* css/WebKitCSSRegionRule.cpp:
(WebCore::WebKitCSSRegionRule::reportDescendantMemoryUsage):
* dom/Document.cpp:
(WebCore::Document::reportMemoryUsage):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::reportMemoryUsage):
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::reportMemoryUsage):

Source/WebKit/chromium:

Test for instrumented vector.

* tests/MemoryInstrumentationTest.cpp:
(WebCore::InstrumentedOwner::InstrumentedOwner):
(WebCore::TEST):
(WebCore):

Source/WTF:

Added reportMemoryUsage free template function with default body to core NMI code
and add custom version of reportMemoryUsage function for Vectors.

* GNUmakefile.list.am:
* WTF.gypi:
* WTF.pro:
* WTF.vcproj/WTF.vcproj:
* WTF.xcodeproj/project.pbxproj:
* wtf/MemoryInstrumentation.h:
(WTF):
(MemoryInstrumentation):
(WTF::MemoryInstrumentation::addObjectImpl):
* wtf/MemoryInstrumentationVector.h: Added.
(WTF):
(WTF::instrumentVectorValues):
(WTF::reportMemoryUsage):

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

38 files changed:
Source/WTF/ChangeLog
Source/WTF/GNUmakefile.list.am
Source/WTF/WTF.gypi
Source/WTF/WTF.pro
Source/WTF/WTF.vcproj/WTF.vcproj
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/MemoryInstrumentation.h
Source/WTF/wtf/MemoryInstrumentationVector.h [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/V8PerIsolateData.cpp
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/CSSImageSetValue.cpp
Source/WebCore/css/CSSMediaRule.cpp
Source/WebCore/css/CSSRuleList.cpp
Source/WebCore/css/CSSStyleSheet.cpp
Source/WebCore/css/CSSValueList.cpp
Source/WebCore/css/MediaList.cpp
Source/WebCore/css/MediaQuery.cpp
Source/WebCore/css/StylePropertySet.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleRule.cpp
Source/WebCore/css/StyleSheetContents.cpp
Source/WebCore/css/WebKitCSSKeyframesRule.cpp
Source/WebCore/css/WebKitCSSRegionRule.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/DocumentStyleSheetCollection.cpp
Source/WebCore/dom/ElementAttributeData.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/cache/MemoryCache.cpp
Source/WebCore/platform/SharedBuffer.cpp
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/BitmapImage.h
Source/WebCore/platform/network/FormData.cpp
Source/WebCore/platform/network/ResourceRequestBase.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp

index 08565c2..51f56d1 100644 (file)
@@ -1,3 +1,27 @@
+2012-09-21  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: extract Vector instrumentation from core NMI code into MemoryInstrumentationVector.h header.
+        https://bugs.webkit.org/show_bug.cgi?id=96650
+
+        Reviewed by Vsevolod Vlasov.
+
+        Added reportMemoryUsage free template function with default body to core NMI code
+        and add custom version of reportMemoryUsage function for Vectors.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/MemoryInstrumentation.h:
+        (WTF):
+        (MemoryInstrumentation):
+        (WTF::MemoryInstrumentation::addObjectImpl):
+        * wtf/MemoryInstrumentationVector.h: Added.
+        (WTF):
+        (WTF::instrumentVectorValues):
+        (WTF::reportMemoryUsage):
+
 2012-09-24  Mark Lam  <mark.lam@apple.com>
 
         Deleting the classic interpreter and cleaning up some build options.
index e8e42ed..0ed10dd 100644 (file)
@@ -80,6 +80,7 @@ wtf_sources += \
     Source/WTF/wtf/MediaTime.h \
     Source/WTF/wtf/MediaTime.cpp \
     Source/WTF/wtf/MemoryInstrumentation.h \
+    Source/WTF/wtf/MemoryInstrumentationVector.h \
     Source/WTF/wtf/MessageQueue.h \
     Source/WTF/wtf/MetaAllocator.cpp \
     Source/WTF/wtf/MetaAllocator.h \
index 5dcd01e..fdc28d6 100644 (file)
@@ -50,6 +50,7 @@
             'wtf/MainThread.h',
             'wtf/MathExtras.h',
             'wtf/MemoryInstrumentation.h',
+            'wtf/MemoryInstrumentationVector.h',
             'wtf/MessageQueue.h',
             'wtf/NonCopyingSort.h',
             'wtf/Noncopyable.h',
index bc0a877..e8da4c0 100644 (file)
@@ -87,6 +87,7 @@ HEADERS += \
     MD5.h \
     MediaTime.h \
     MemoryInstrumentation.h \
+    MemoryInstrumentationVector.h \
     MessageQueue.h \
     MetaAllocator.h \
     MetaAllocatorHandle.h \
index 4b2cc62..f9108c8 100644 (file)
                        >
                </File>
                <File
+                       RelativePath="..\wtf\MemoryInstrumentationVector.h"
+                       >
+               </File>
+               <File
                        RelativePath="..\wtf\MessageQueue.h"
                        >
                </File>
index 2d27b74..3a89edf 100644 (file)
@@ -41,6 +41,7 @@
                4330F38F15745B0500AAFA8F /* URLString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4330F38E15745B0500AAFA8F /* URLString.cpp */; };
                4F0321BC156AA8D1006EBAF6 /* BitArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F0321BB156AA8D1006EBAF6 /* BitArray.h */; };
                4F1D115415FF11BE0026E908 /* MemoryInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */; };
+               4FCB710A160A1A07008425EC /* MemoryInstrumentationVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */; };
                7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */; };
                8134013815B092FD001FF0B8 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8134013615B092FD001FF0B8 /* Base64.cpp */; };
                8134013915B092FD001FF0B8 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8134013715B092FD001FF0B8 /* Base64.h */; };
                4330F38E15745B0500AAFA8F /* URLString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLString.cpp; sourceTree = "<group>"; };
                4F0321BB156AA8D1006EBAF6 /* BitArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitArray.h; sourceTree = "<group>"; };
                4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentation.h; sourceTree = "<group>"; };
+               4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationVector.h; sourceTree = "<group>"; };
                5D247B6214689B8600E78B76 /* libWTF.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; };
                5D247B6E14689C4700E78B76 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
                5D247B6F14689C4700E78B76 /* CompilerVersion.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = CompilerVersion.xcconfig; sourceTree = "<group>"; };
                                CD5497AA15857D0300B5BC30 /* MediaTime.cpp */,
                                CD5497AB15857D0300B5BC30 /* MediaTime.h */,
                                4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */,
+                               4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */,
                                A8A472CC151A825B004123FF /* MessageQueue.h */,
                                A8A472CD151A825B004123FF /* MetaAllocator.cpp */,
                                A8A472CE151A825B004123FF /* MetaAllocator.h */,
                                2661122E160FEAD40013F5C3 /* URLQueryCharsetConverter.h in Headers */,
                                26E6C20A1609037300CA6AF4 /* URLUtilInternal.h in Headers */,
                                26E6C20D1609037300CA6AF4 /* URLUtil.h in Headers */,
+                               4FCB710A160A1A07008425EC /* MemoryInstrumentationVector.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 131af84..b1f2e29 100644 (file)
@@ -81,6 +81,8 @@ private:
     size_t m_objectSize;
 };
 
+template<typename T> void reportMemoryUsage(const T* const&, MemoryObjectInfo*);
+
 class MemoryInstrumentation {
 public:
     virtual ~MemoryInstrumentation() { }
@@ -107,6 +109,7 @@ private:
     virtual void processDeferredInstrumentedPointers() = 0;
 
     friend class MemoryClassInfo;
+    template<typename T> friend void reportMemoryUsage(const T* const&, MemoryObjectInfo*);
 
     template<typename T> static void selectInstrumentationMethod(const T* const& object, MemoryObjectInfo* memoryObjectInfo)
     {
@@ -148,7 +151,6 @@ private:
     template<typename MapType> void addInstrumentedMapEntries(const MapType&, MemoryObjectType);
     template<typename MapType> void addInstrumentedMapValues(const MapType&, MemoryObjectType);
     template<typename ListHashSetType> void addListHashSet(const ListHashSetType&, MemoryObjectType, bool contentOnly = false);
-    template<typename VectorType> void addVector(const VectorType&, MemoryObjectType, bool contentOnly = false);
     void addRawBuffer(const void* const& buffer, MemoryObjectType ownerObjectType, size_t size)
     {
         if (!buffer || visited(buffer))
@@ -194,14 +196,9 @@ public:
     template<typename HashSetType> void addHashSet(const HashSetType& set) { m_memoryInstrumentation->addHashSet(set, m_objectType, true); }
     template<typename HashSetType> void addHashCountedSet(const HashSetType& set) { m_memoryInstrumentation->addHashSet(set, m_objectType, true); }
     template<typename HashSetType> void addInstrumentedHashSet(const HashSetType& set) { m_memoryInstrumentation->addInstrumentedCollection(set, m_objectType, true); }
-    template<typename VectorType> void addInstrumentedVector(const VectorType& vector) { m_memoryInstrumentation->addInstrumentedCollection(vector, m_objectType, true); }
-    template<typename VectorType> void addInstrumentedVectorPtr(const OwnPtr<VectorType>& vector) { m_memoryInstrumentation->addInstrumentedCollection(*vector, m_objectType, false); }
-    template<typename VectorType> void addInstrumentedVectorPtr(const VectorType* const& vector) { m_memoryInstrumentation->addInstrumentedCollection(*vector, m_objectType, false); }
     template<typename MapType> void addInstrumentedMapEntries(const MapType& map) { m_memoryInstrumentation->addInstrumentedMapEntries(map, m_objectType); }
     template<typename MapType> void addInstrumentedMapValues(const MapType& map) { m_memoryInstrumentation->addInstrumentedMapValues(map, m_objectType); }
     template<typename ListHashSetType> void addListHashSet(const ListHashSetType& set) { m_memoryInstrumentation->addListHashSet(set, m_objectType, true); }
-    template<typename VectorType> void addVector(const VectorType& vector) { m_memoryInstrumentation->addVector(vector, m_objectType, true); }
-    template<typename VectorType> void addVectorPtr(const VectorType* const vector) { m_memoryInstrumentation->addVector(*vector, m_objectType, false); }
     void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); }
 
     void addWeakPointer(void*) { }
@@ -213,11 +210,17 @@ private:
 };
 
 template<typename T>
+void reportMemoryUsage(const T* const& object, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryInstrumentation::selectInstrumentationMethod<T>(object, memoryObjectInfo);
+}
+
+template<typename T>
 void MemoryInstrumentation::addObjectImpl(const T* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
 {
     if (owningType == byReference) {
         MemoryObjectInfo memoryObjectInfo(this, ownerObjectType);
-        selectInstrumentationMethod<T>(object, &memoryObjectInfo);
+        reportMemoryUsage(object, &memoryObjectInfo);
     } else {
         if (!object || visited(object))
             return;
@@ -295,14 +298,6 @@ void MemoryInstrumentation::addListHashSet(const ListHashSetType& hashSet, Memor
     countObjectSize(ownerObjectType, size);
 }
 
-template<typename VectorType>
-void MemoryInstrumentation::addVector(const VectorType& vector, MemoryObjectType ownerObjectType, bool contentOnly)
-{
-    if (!vector.data() || visited(vector.data()))
-        return;
-    countObjectSize(ownerObjectType, calculateContainerSize(vector, contentOnly));
-}
-
 template<typename Container>
 size_t MemoryInstrumentation::calculateContainerSize(const Container& container, bool contentOnly)
 {
@@ -313,10 +308,14 @@ template<typename T>
 void MemoryInstrumentation::InstrumentedPointer<T>::process(MemoryInstrumentation* memoryInstrumentation)
 {
     MemoryObjectInfo memoryObjectInfo(memoryInstrumentation, m_ownerObjectType);
-    selectInstrumentationMethod<T>(m_pointer, &memoryObjectInfo);
+    reportMemoryUsage(m_pointer, &memoryObjectInfo);
     memoryInstrumentation->countObjectSize(memoryObjectInfo.objectType(), memoryObjectInfo.objectSize());
 }
 
+// Link time guard for vector memory instrumentation.
+template<typename T, size_t inlineCapacity> class Vector;
+template<typename T, size_t inlineCapacity> void reportMemoryUsage(const Vector<T, inlineCapacity>* const&, MemoryObjectInfo*);
+
 } // namespace WTF
 
 #endif // !defined(MemoryInstrumentation_h)
diff --git a/Source/WTF/wtf/MemoryInstrumentationVector.h b/Source/WTF/wtf/MemoryInstrumentationVector.h
new file mode 100644 (file)
index 0000000..fea5cb7
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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 MemoryInstrumentationVector_h
+#define MemoryInstrumentationVector_h
+
+#include <wtf/MemoryInstrumentation.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+template<typename T, size_t inlineCapacity>
+void instrumentVectorValues(MemoryClassInfo& info, const Vector<T, inlineCapacity>* const& vector)
+{
+    for (size_t i = 0; i < vector->size(); ++i)
+        info.addMember(vector->at(i));
+}
+
+template<size_t inlineCapacity> void instrumentVectorValues(MemoryClassInfo&, const Vector<int, inlineCapacity>* const&) { }
+template<size_t inlineCapacity> void instrumentVectorValues(MemoryClassInfo&, const Vector<char, inlineCapacity>* const&) { }
+template<size_t inlineCapacity> void instrumentVectorValues(MemoryClassInfo&, const Vector<char*, inlineCapacity>* const&) { }
+
+template<typename T, size_t inlineCapacity>
+void reportMemoryUsage(const Vector<T, inlineCapacity>* const& vector, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, vector);
+    if (inlineCapacity < vector->capacity())
+        info.addRawBuffer(vector->data(), vector->capacity() * sizeof(T));
+    instrumentVectorValues(info, vector);
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationVector_h)
index 452df07..6c6a419 100644 (file)
@@ -1,3 +1,47 @@
+2012-09-21  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: extract Vector instrumentation from core NMI code into MemoryInstrumentationVector.h header.
+        https://bugs.webkit.org/show_bug.cgi?id=96650
+
+        Reviewed by Vsevolod Vlasov.
+
+        addInstrumentedVector and addInstrumentedVectorPtr were replaced with addMember.
+        The same thing happens with addVector and addVectorPtr.
+
+        * css/CSSGradientValue.cpp:
+        (WebCore::CSSGradientValue::reportBaseClassMemoryUsage):
+        * css/CSSImageSetValue.cpp:
+        (WebCore::CSSImageSetValue::reportDescendantMemoryUsage):
+        * css/CSSMediaRule.cpp:
+        (WebCore::CSSMediaRule::reportDescendantMemoryUsage):
+        * css/CSSRuleList.cpp:
+        (WebCore::StaticCSSRuleList::reportMemoryUsage):
+        * css/CSSStyleSheet.cpp:
+        (WebCore::CSSStyleSheet::reportMemoryUsage):
+        * css/CSSValueList.cpp:
+        (WebCore::CSSValueList::reportDescendantMemoryUsage):
+        * css/MediaList.cpp:
+        (WebCore::MediaQuerySet::reportMemoryUsage):
+        * css/MediaQuery.cpp:
+        (WebCore::MediaQuery::reportMemoryUsage):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::collectMatchingRulesForList):
+        * css/StyleRule.cpp:
+        (WebCore::StyleRuleBlock::reportDescendantMemoryUsage):
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::reportMemoryUsage):
+        * css/WebKitCSSKeyframesRule.cpp:
+        (WebCore::StyleRuleKeyframes::reportDescendantMemoryUsage):
+        (WebCore::WebKitCSSKeyframesRule::reportDescendantMemoryUsage):
+        * css/WebKitCSSRegionRule.cpp:
+        (WebCore::WebKitCSSRegionRule::reportDescendantMemoryUsage):
+        * dom/Document.cpp:
+        (WebCore::Document::reportMemoryUsage):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::reportMemoryUsage):
+        * platform/network/ResourceRequestBase.cpp:
+        (WebCore::ResourceRequestBase::reportMemoryUsage):
+
 2012-09-25  Vivek Galatage  <vivekgalatage@gmail.com>
 
         REGRESSION(r129346): It broke !ENABLE(INSPECTOR) build
index e1bc31e..4e1e0a1 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "ScriptGCEvent.h"
 #include "V8Binding.h"
+#include <wtf/MemoryInstrumentationVector.h>
 
 namespace WebCore {
 
@@ -87,7 +88,7 @@ void V8PerIsolateData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
     info.addHashMap(m_rawTemplates);
     info.addHashMap(m_templates);
     info.addMember(m_stringCache);
-    info.addVector(m_domDataList);
+    info.addMember(m_domDataList);
 
     for (size_t i = 0; i < m_domDataList.size(); i++)
         info.addMember(m_domDataList[i]);
index f9715f2..d00c130 100644 (file)
@@ -37,6 +37,7 @@
 #include "RenderObject.h"
 #include "StyleResolver.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/WTFString.h>
 
@@ -469,7 +470,7 @@ void CSSGradientValue::reportBaseClassMemoryUsage(MemoryObjectInfo* memoryObject
     info.addMember(m_firstY);
     info.addMember(m_secondX);
     info.addMember(m_secondY);
-    info.addInstrumentedVector(m_stops);
+    info.addMember(m_stops);
 }
 
 String CSSLinearGradientValue::customCssText() const
index 5e6bee5..6e02a20 100644 (file)
@@ -37,6 +37,7 @@
 #include "StyleCachedImageSet.h"
 #include "StylePendingImage.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 
 namespace WebCore {
 
@@ -168,7 +169,7 @@ void CSSImageSetValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjec
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     CSSValueList::reportDescendantMemoryUsage(memoryObjectInfo);
-    info.addInstrumentedVector(m_imagesInSet);
+    info.addMember(m_imagesInSet);
 }
 
 void CSSImageSetValue::ImageWithScale::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
index f0e9c79..8c2c973 100644 (file)
@@ -29,6 +29,7 @@
 #include "ExceptionCode.h"
 #include "StyleRule.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -180,7 +181,7 @@ void CSSMediaRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInf
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
     info.addMember(m_mediaCSSOMWrapper);
-    info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+    info.addMember(m_childRuleCSSOMWrappers);
     info.addMember(m_ruleListCSSOMWrapper);
 }
 
index 472b3dd..dadc93b 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "CSSRule.h"
 #include "CSSStyleSheet.h"
+#include <wtf/MemoryInstrumentationVector.h>
 
 namespace WebCore {
 
@@ -54,7 +55,7 @@ void StaticCSSRuleList::deref()
 void StaticCSSRuleList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
-    info.addInstrumentedVector(m_rules);
+    info.addMember(m_rules);
 }
 
 } // namespace WebCore
index 0e10202..dcfc220 100644 (file)
@@ -38,6 +38,7 @@
 #include "StyleRule.h"
 #include "StyleSheetContents.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -187,7 +188,7 @@ void CSSStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addMember(m_ownerNode);
     info.addMember(m_ownerRule);
     info.addMember(m_mediaCSSOMWrapper);
-    info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+    info.addMember(m_childRuleCSSOMWrappers);
 }
 
 void CSSStyleSheet::setDisabled(bool disabled)
index 21e4fa7..9ec2d50 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "CSSParserValues.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/text/StringBuilder.h>
 
@@ -189,7 +190,7 @@ PassRefPtr<CSSValueList> CSSValueList::cloneForCSSOM() const
 void CSSValueList::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
-    info.addInstrumentedVector(m_values);
+    info.addMember(m_values);
 }
 
 } // namespace WebCore
index 62903d6..bdbc571 100644 (file)
@@ -27,6 +27,7 @@
 #include "MediaQuery.h"
 #include "MediaQueryExp.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -215,7 +216,7 @@ String MediaQuerySet::mediaText() const
 void MediaQuerySet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
-    info.addInstrumentedVector(m_queries);
+    info.addMember(m_queries);
 }
     
 MediaList::MediaList(MediaQuerySet* mediaQueries, CSSStyleSheet* parentSheet)
index a3f25d7..fc4551f 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "MediaQueryExp.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/NonCopyingSort.h>
 #include <wtf/text/StringBuilder.h>
 
@@ -138,7 +139,7 @@ void MediaQuery::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     info.addMember(m_mediaType);
-    info.addInstrumentedVectorPtr(m_expressions);
+    info.addMember(m_expressions);
     info.addMember(m_serializationCache);
 }
 
index 0abb5fe..52e4a24 100644 (file)
@@ -31,6 +31,7 @@
 #include "StylePropertyShorthand.h"
 #include "StyleSheetContents.h"
 #include <wtf/BitArray.h>
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/text/StringBuilder.h>
 
 #ifndef NDEBUG
@@ -1121,7 +1122,7 @@ void StylePropertySet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
     size_t actualSize = m_isMutable ? sizeof(StylePropertySet) : immutableStylePropertySetSize(m_arraySize);
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS, actualSize);
     if (m_isMutable)
-        info.addVectorPtr(m_mutablePropertyVector);
+        info.addMember(m_mutablePropertyVector);
 
     unsigned count = propertyCount();
     for (unsigned i = 0; i < count; ++i)
index c164606..6ae35ac 100644 (file)
 #include "WebKitCSSTransformValue.h"
 #include "WebKitFontFamilyNames.h"
 #include "XMLNames.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/Vector.h>
 
@@ -746,8 +747,8 @@ void StyleResolver::Features::reportMemoryUsage(MemoryObjectInfo* memoryObjectIn
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     info.addHashSet(idsInRules);
     info.addHashSet(attrsInRules);
-    info.addVector(siblingRules);
-    info.addVector(uncommonAttributeRules);
+    info.addMember(siblingRules);
+    info.addMember(uncommonAttributeRules);
 }
 
 static StyleSheetContents* parseUASheet(const String& str)
@@ -2567,7 +2568,7 @@ static void reportAtomRuleMap(MemoryClassInfo* info, const RuleSet::AtomRuleMap&
 {
     info->addHashMap(atomicRuleMap);
     for (RuleSet::AtomRuleMap::const_iterator it = atomicRuleMap.begin(); it != atomicRuleMap.end(); ++it)
-        info->addInstrumentedVector(*it->second);
+        info->addMember(*it->second);
 }
 
 void RuleSet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
@@ -2577,11 +2578,11 @@ void RuleSet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     reportAtomRuleMap(&info, m_classRules);
     reportAtomRuleMap(&info, m_tagRules);
     reportAtomRuleMap(&info, m_shadowPseudoElementRules);
-    info.addInstrumentedVector(m_linkPseudoClassRules);
-    info.addInstrumentedVector(m_focusPseudoClassRules);
-    info.addInstrumentedVector(m_universalRules);
-    info.addVector(m_pageRules);
-    info.addInstrumentedVector(m_regionSelectorsAndRuleSets);
+    info.addMember(m_linkPseudoClassRules);
+    info.addMember(m_focusPseudoClassRules);
+    info.addMember(m_universalRules);
+    info.addMember(m_pageRules);
+    info.addMember(m_regionSelectorsAndRuleSets);
 }
 
 void RuleSet::RuleSetSelectorPair::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
@@ -5762,7 +5763,7 @@ void StyleResolver::MatchedProperties::reportMemoryUsage(MemoryObjectInfo* memor
 void StyleResolver::MatchedPropertiesCacheItem::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
-    info.addInstrumentedVector(matchedProperties);
+    info.addMember(matchedProperties);
 }
 
 void MediaQueryResult::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
@@ -5782,13 +5783,13 @@ void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addHashMap(m_keyframesRuleMap);
     info.addHashMap(m_matchedPropertiesCache);
     info.addInstrumentedMapValues(m_matchedPropertiesCache);
-    info.addVector(m_matchedRules);
+    info.addMember(m_matchedRules);
 
     info.addMember(m_ruleList);
     info.addHashMap(m_pendingImageProperties);
     info.addInstrumentedMapValues(m_pendingImageProperties);
     info.addMember(m_lineHeightValue);
-    info.addInstrumentedVector(m_viewportDependentMediaQueryResults);
+    info.addMember(m_viewportDependentMediaQueryResults);
     info.addHashMap(m_styleRuleToCSSOMWrapperMap);
     info.addInstrumentedMapEntries(m_styleRuleToCSSOMWrapperMap);
     info.addInstrumentedHashSet(m_styleSheetCSSOMWrapperSet);
@@ -5798,7 +5799,7 @@ void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 #if ENABLE(STYLE_SCOPED)
     info.addHashMap(m_scopedAuthorStyles);
     info.addInstrumentedMapEntries(m_scopedAuthorStyles);
-    info.addVector(m_scopeStack);
+    info.addMember(m_scopeStack);
 #endif
 
     // FIXME: move this to a place where it would be called only once?
index 5ece1b4..73b0af2 100644 (file)
@@ -33,6 +33,7 @@
 #include "WebKitCSSKeyframeRule.h"
 #include "WebKitCSSKeyframesRule.h"
 #include "WebKitCSSRegionRule.h"
+#include <wtf/MemoryInstrumentationVector.h>
 
 namespace WebCore {
 
@@ -340,7 +341,7 @@ void StyleRuleBlock::wrapperRemoveRule(unsigned index)
 void StyleRuleBlock::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
-    info.addInstrumentedVector(m_childRules);
+    info.addMember(m_childRules);
 }
 
 StyleRuleMedia::StyleRuleMedia(PassRefPtr<MediaQuerySet> media, Vector<RefPtr<StyleRuleBase> >& adoptRules)
index 048273b..945f355 100644 (file)
@@ -33,6 +33,7 @@
 #include "StyleRuleImport.h"
 #include "WebCoreMemoryInstrumentation.h"
 #include <wtf/Deque.h>
+#include <wtf/MemoryInstrumentationVector.h>
 
 namespace WebCore {
 
@@ -489,10 +490,10 @@ void StyleSheetContents::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) c
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     info.addMember(m_originalURL);
     info.addMember(m_encodingFromCharsetRule);
-    info.addVector(m_importRules);
-    info.addInstrumentedVector(m_childRules);
+    info.addMember(m_importRules);
+    info.addMember(m_childRules);
     info.addHashMap(m_namespaces);
-    info.addVector(m_clients);
+    info.addMember(m_clients);
 }
 
 }
index a2991a8..08fbb0a 100644 (file)
@@ -33,6 +33,7 @@
 #include "StyleSheet.h"
 #include "WebCoreMemoryInstrumentation.h"
 #include "WebKitCSSKeyframeRule.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -90,7 +91,7 @@ int StyleRuleKeyframes::findKeyframeIndex(const String& key) const
 void StyleRuleKeyframes::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
-    info.addInstrumentedVector(m_keyframes);
+    info.addMember(m_keyframes);
     info.addMember(m_name);
 }
 
@@ -211,7 +212,7 @@ void WebKitCSSKeyframesRule::reportDescendantMemoryUsage(MemoryObjectInfo* memor
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
     info.addMember(m_keyframesRule);
-    info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+    info.addMember(m_childRuleCSSOMWrappers);
     info.addMember(m_ruleListCSSOMWrapper);
 }
 
index 5c2c721..ce1207c 100644 (file)
@@ -34,6 +34,7 @@
 #include "CSSParser.h"
 #include "CSSRuleList.h"
 #include "StyleRule.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/text/StringBuilder.h>
 
 #if ENABLE(CSS_REGIONS)
@@ -113,7 +114,7 @@ void WebKitCSSRegionRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryOb
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
     CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
     info.addMember(m_regionRule);
-    info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+    info.addMember(m_childRuleCSSOMWrappers);
     info.addMember(m_ruleListCSSOMWrapper);
 }
 
index 2d35776..72810ee 100644 (file)
 #include <wtf/CurrentTime.h>
 #include <wtf/HashFunctions.h>
 #include <wtf/MainThread.h>
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/StringBuffer.h>
@@ -5865,7 +5866,7 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
     info.addMember(m_styleResolver);
     ContainerNode::reportMemoryUsage(memoryObjectInfo);
-    info.addVector(m_customFonts);
+    info.addMember(m_customFonts);
     info.addMember(m_url);
     info.addMember(m_baseURL);
     info.addMember(m_baseURLOverride);
@@ -5888,17 +5889,17 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addHashMap(m_documentNamedItemCollections);
     info.addHashMap(m_windowNamedItemCollections);
 #if ENABLE(DASHBOARD_SUPPORT)
-    info.addVector(m_dashboardRegions);
+    info.addMember(m_dashboardRegions);
 #endif
     info.addHashMap(m_cssCanvasElements);
-    info.addVector(m_iconURLs);
+    info.addMember(m_iconURLs);
     info.addHashSet(m_documentSuspensionCallbackElements);
     info.addHashSet(m_mediaVolumeCallbackElements);
     info.addHashSet(m_privateBrowsingStateChangedElements);
     info.addHashMap(m_elementsByAccessKey);
     info.addMember(m_eventQueue);
     info.addHashSet(m_mediaCanStartListeners);
-    info.addVector(m_pendingTasks);
+    info.addMember(m_pendingTasks);
 }
 
 #if ENABLE(UNDO_MANAGER)
index 4be9613..70f5427 100644 (file)
@@ -46,6 +46,7 @@
 #include "StyleSheetList.h"
 #include "UserContentURLPattern.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 
 namespace WebCore {
 
@@ -472,10 +473,9 @@ void DocumentStyleSheetCollection::reportMemoryUsage(MemoryObjectInfo* memoryObj
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
     info.addMember(m_pageUserSheet);
-    if (m_pageGroupUserSheets)
-        info.addInstrumentedVectorPtr(m_pageGroupUserSheets);
-    if (m_userSheets)
-        info.addInstrumentedVectorPtr(m_userSheets);
+    info.addMember(m_pageGroupUserSheets);
+    info.addMember(m_userSheets);
+    info.addMember(m_authorStyleSheets);
     info.addListHashSet(m_styleSheetCandidateNodes);
     info.addMember(m_preferredStylesheetSetName);
     info.addMember(m_selectedStylesheetSetName);
index 03f7b81..5a7f341 100644 (file)
@@ -31,6 +31,7 @@
 #include "CSSStyleSheet.h"
 #include "StyledElement.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 
 namespace WebCore {
 
@@ -300,7 +301,7 @@ void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
     info.addMember(m_classNames);
     info.addMember(m_idForStyleResolution);
     if (m_isMutable)
-        info.addVector(mutableAttributeVector());
+        info.addMember(mutableAttributeVector());
     for (unsigned i = 0, len = length(); i < len; i++)
         info.addMember(*attributeItem(i));
 }
index 8368041..900af97 100644 (file)
@@ -53,6 +53,7 @@
 #include "TextResourceDecoder.h"
 #include "WebCoreMemoryInstrumentation.h"
 #include <wtf/Assertions.h>
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 #include <wtf/unicode/Unicode.h>
@@ -368,16 +369,16 @@ void DocumentLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addMember(m_substituteData);
     info.addMember(m_pageTitle.string());
     info.addMember(m_overrideEncoding);
-    info.addVector(m_responses);
+    info.addMember(m_responses);
     info.addMember(m_originalRequest);
     info.addMember(m_originalRequestCopy);
     info.addMember(m_request);
     info.addMember(m_response);
     info.addMember(m_lastCheckedRequest);
-    info.addInstrumentedVector(m_responses);
+    info.addMember(m_responses);
     info.addHashMap(m_pendingSubstituteResources);
     info.addInstrumentedHashSet(m_resourcesClientKnowsAbout);
-    info.addVector(m_resourcesLoadedFromMemoryCacheForClientNotification);
+    info.addMember(m_resourcesLoadedFromMemoryCacheForClientNotification);
     info.addMember(m_clientRedirectSourceForHistory);
     info.addMember(m_mainResourceData);
 }
index 66d3201..c1af09d 100644 (file)
@@ -45,6 +45,7 @@
 #include "WorkerThread.h"
 #include <stdio.h>
 #include <wtf/CurrentTime.h>
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/TemporaryChange.h>
 #include <wtf/text/CString.h>
 
@@ -724,7 +725,7 @@ void MemoryCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
         info.addMember(i->first);
         info.addMember(i->second);
     }
-    info.addVector(m_allResources);
+    info.addMember(m_allResources);
     info.addMember(m_liveDecodedResources);
 }
 
index 68c3196..de5f71d 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "PlatformMemoryInstrumentation.h"
 #include "PurgeableBuffer.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/unicode/UTF8.h>
 #include <wtf/unicode/Unicode.h>
@@ -251,8 +252,8 @@ const Vector<char>& SharedBuffer::buffer() const
 void SharedBuffer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this);
-    info.addVector(m_buffer);
-    info.addVector(m_segments);
+    info.addMember(m_buffer);
+    info.addMember(m_segments);
     for (unsigned i = 0; i < m_segments.size(); ++i)
         info.addRawBuffer(m_segments[i], segmentSize);
     info.addMember(m_purgeableBuffer.get());
index 0b11680..d0a2aab 100644 (file)
@@ -34,6 +34,7 @@
 #include "PlatformMemoryInstrumentation.h"
 #include "Timer.h"
 #include <wtf/CurrentTime.h>
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
@@ -578,7 +579,7 @@ void BitmapImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     Image::reportMemoryUsage(memoryObjectInfo);
     info.addMember(m_source);
     info.addMember(m_frameTimer);
-    info.addVector(m_frames);
+    info.addMember(m_frames);
     for (unsigned i = 0; i < m_frameCount; ++i) {
 #if OS(WINCE) && !PLATFORM(QT)
         info.addRawBuffer(m_frames[i].m_frame.get(), m_frames[i].m_frameBytes);
index 10b3729..3f23dce 100644 (file)
@@ -87,7 +87,6 @@ public:
     // Clear the cached image data on the frame, and (optionally) the metadata.
     // Returns whether there was cached image data to clear.
     bool clear(bool clearMetadata);
-    void reportMemoryUsage(MemoryObjectInfo*) const;
 
     NativeImagePtr m_frame;
     ImageOrientation m_orientation;
index 45f7302..43a71af 100644 (file)
@@ -37,6 +37,7 @@
 #include "TextEncoding.h"
 #include <wtf/Decoder.h>
 #include <wtf/Encoder.h>
+#include <wtf/MemoryInstrumentationVector.h>
 
 namespace WebCore {
 
@@ -360,7 +361,7 @@ void FormData::removeGeneratedFilesIfNeeded()
 void FormData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Loader);
-    info.addVector(m_boundary);
+    info.addMember(m_boundary);
 }
 
 static void encode(Encoder& encoder, const FormDataElement& element)
index 00f5839..303deaa 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "PlatformMemoryInstrumentation.h"
 #include "ResourceRequest.h"
+#include <wtf/MemoryInstrumentationVector.h>
 
 using namespace std;
 
@@ -452,7 +453,7 @@ void ResourceRequestBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
     info.addMember(m_httpMethod);
     info.addHashMap(m_httpHeaderFields);
     info.addInstrumentedMapEntries(m_httpHeaderFields);
-    info.addInstrumentedVector(m_responseContentDispositionEncodingFallbackArray);
+    info.addMember(m_responseContentDispositionEncodingFallbackArray);
     info.addMember(m_httpBody);
 }
 
index 0602cfa..63d5e05 100644 (file)
@@ -40,6 +40,7 @@
 #include "RenderTheme.h"
 #endif
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/StdLibExtras.h>
 #include <algorithm>
 
@@ -1615,8 +1616,7 @@ void RenderStyle::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     info.addMember(rareInheritedData);
     // FIXME: inherited contains StyleImage and Font fields that might need to be instrumented.
     info.addMember(inherited);
-    if (m_cachedPseudoStyles)
-        info.addVectorPtr(m_cachedPseudoStyles.get());
+    info.addMember(m_cachedPseudoStyles);
 #if ENABLE(SVG)
     info.addMember(m_svgStyle);
 #endif
index bbe07bf..ff5c28d 100644 (file)
@@ -31,6 +31,7 @@
 #include "StyleImage.h"
 #include "StyleResolver.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
 
 namespace WebCore {
 
@@ -306,7 +307,7 @@ void StyleRareNonInheritedData::reportMemoryUsage(MemoryObjectInfo* memoryObject
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
 #if ENABLE(DASHBOARD_SUPPORT)
-    info.addVector(m_dashboardRegions);
+    info.addMember(m_dashboardRegions);
 #endif
     info.addMember(m_deprecatedFlexibleBox);
     info.addMember(m_flexibleBox);
index a040866..b216df9 100644 (file)
@@ -1,3 +1,17 @@
+2012-09-21  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: extract Vector instrumentation from core NMI code into MemoryInstrumentationVector.h header.
+        https://bugs.webkit.org/show_bug.cgi?id=96650
+
+        Reviewed by Vsevolod Vlasov.
+
+        Test for instrumented vector.
+
+        * tests/MemoryInstrumentationTest.cpp:
+        (WebCore::InstrumentedOwner::InstrumentedOwner):
+        (WebCore::TEST):
+        (WebCore):
+
 2012-09-24  Benjamin Poulain  <bpoulain@apple.com>
 
         Fix Geolocation error reporting in the test support
index 4acf496..21ce963 100644 (file)
@@ -37,6 +37,7 @@
 #include <gtest/gtest.h>
 
 #include <wtf/HashSet.h>
+#include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/AtomicString.h>
@@ -235,6 +236,7 @@ class InstrumentedOwner {
 public:
     template<typename V>
     InstrumentedOwner(const V& value) : m_value(value) { }
+    InstrumentedOwner() { }
     void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     {
         MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
@@ -367,5 +369,75 @@ TEST(MemoryInstrumentationTest, detectReportMemoryUsageMethod)
     }
 }
 
+TEST(MemoryInstrumentationTest, vectorZeroInlineCapacity)
+{
+    VisitedObjects visitedObjects;
+    MemoryInstrumentationImpl impl(visitedObjects);
+    InstrumentedOwner<Vector<int> > vectorOwner(16);
+    impl.addRootObject(vectorOwner);
+    EXPECT_EQ(16 * sizeof(int), impl.reportedSizeForAllTypes());
+    EXPECT_EQ(1, visitedObjects.size());
+}
+
+TEST(MemoryInstrumentationTest, vectorFieldWithInlineCapacity)
+{
+    VisitedObjects visitedObjects;
+    MemoryInstrumentationImpl impl(visitedObjects);
+    InstrumentedOwner<Vector<int, 4> > vectorOwner;
+    impl.addRootObject(vectorOwner);
+    EXPECT_EQ(static_cast<size_t>(0), impl.reportedSizeForAllTypes());
+    EXPECT_EQ(0, visitedObjects.size());
+}
+
+TEST(MemoryInstrumentationTest, vectorFieldWithInlineCapacityResized)
+{
+    VisitedObjects visitedObjects;
+    MemoryInstrumentationImpl impl(visitedObjects);
+    InstrumentedOwner<Vector<int, 4> > vectorOwner;
+    vectorOwner.m_value.reserveCapacity(8);
+    impl.addRootObject(vectorOwner);
+    EXPECT_EQ(8 * sizeof(int), impl.reportedSizeForAllTypes());
+    EXPECT_EQ(1, visitedObjects.size());
+}
+
+TEST(MemoryInstrumentationTest, heapAllocatedVectorWithInlineCapacity)
+{
+    VisitedObjects visitedObjects;
+    MemoryInstrumentationImpl impl(visitedObjects);
+    InstrumentedOwner<OwnPtr<Vector<int, 4> > > vectorOwner;
+    vectorOwner.m_value = adoptPtr(new Vector<int, 4>());
+    impl.addRootObject(vectorOwner);
+    EXPECT_EQ(sizeof(Vector<int, 4>), impl.reportedSizeForAllTypes());
+    EXPECT_EQ(1, visitedObjects.size());
+}
+
+TEST(MemoryInstrumentationTest, heapAllocatedVectorWithInlineCapacityResized)
+{
+    VisitedObjects visitedObjects;
+    MemoryInstrumentationImpl impl(visitedObjects);
+    InstrumentedOwner<OwnPtr<Vector<int, 4> > > vectorOwner;
+    vectorOwner.m_value = adoptPtr(new Vector<int, 4>());
+    vectorOwner.m_value->reserveCapacity(8);
+    impl.addRootObject(vectorOwner);
+    EXPECT_EQ(8 * sizeof(int) + sizeof(Vector<int, 4>), impl.reportedSizeForAllTypes());
+    EXPECT_EQ(2, visitedObjects.size());
+}
+
+TEST(MemoryInstrumentationTest, vectorWithInstrumentedType)
+{
+    VisitedObjects visitedObjects;
+    MemoryInstrumentationImpl impl(visitedObjects);
+
+    typedef Vector<String> StringVector;
+    OwnPtr<StringVector> value = adoptPtr(new StringVector());
+    size_t count = 10;
+    for (size_t i = 0; i < count; ++i)
+        value->append("string");
+    InstrumentedOwner<StringVector* > root(value.get());
+    impl.addRootObject(root);
+    EXPECT_EQ(sizeof(StringVector) + sizeof(String) * value->capacity() + sizeof(StringImpl) * value->size(), impl.reportedSizeForAllTypes());
+    EXPECT_EQ(count + 2, (size_t)visitedObjects.size());
+}
+
 } // namespace