Unreviewed, rolling out r122714.
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2012 12:18:06 +0000 (12:18 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2012 12:18:06 +0000 (12:18 +0000)
http://trac.webkit.org/changeset/122714
https://bugs.webkit.org/show_bug.cgi?id=91380

It broke mac compilation (Requested by loislo on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-07-16

* bindings/js/ScriptWrappable.h:
(WebCore::ScriptWrappable::reportMemoryUsage):
* bindings/v8/DOMDataStore.cpp:
(WebCore::DOMDataStore::reportMemoryUsage):
* bindings/v8/IntrusiveDOMWrapperMap.h:
(WebCore::ChunkedTable::reportMemoryUsage):
* bindings/v8/ScriptProfiler.cpp:
(WebCore::ScriptProfiler::collectBindingMemoryInfo):
* bindings/v8/ScriptWrappable.h:
(WebCore::ScriptWrappable::reportMemoryUsage):
* bindings/v8/V8Binding.cpp:
(WebCore::V8BindingPerIsolateData::reportMemoryUsage):
(WebCore::StringCache::reportMemoryUsage):
* bindings/v8/V8DOMMap.h:
* css/StylePropertySet.h:
(WebCore::StylePropertySet::reportMemoryUsage):
* dom/CharacterData.cpp:
(WebCore::CharacterData::reportMemoryUsage):
* dom/ContainerNode.h:
(WebCore::ContainerNode::reportMemoryUsage):
* dom/Document.cpp:
(WebCore::Document::reportMemoryUsage):
* dom/Element.h:
(WebCore::Element::reportMemoryUsage):
* dom/ElementAttributeData.h:
(WebCore::ElementAttributeData::reportMemoryUsage):
* dom/MemoryInstrumentation.h:
(WebCore::MemoryInstrumentation::reportObject):
(MemoryInstrumentation):
(WebCore::MemoryInstrumentation::reportPointer):
(WebCore::MemoryClassInfo::reportInstrumentedPointer):
(WebCore::MemoryClassInfo::reportInstrumentedObject):
(WebCore::MemoryClassInfo::reportPointer):
(WebCore::MemoryClassInfo::reportObject):
(WebCore::MemoryClassInfo::reportHashMap):
(WebCore::MemoryClassInfo::reportHashSet):
(WebCore::MemoryClassInfo::reportListHashSet):
(WebCore::MemoryClassInfo::reportVector):
(MemoryClassInfo):
(WebCore::MemoryClassInfo::reportString):
(WebCore):
(WebCore::MemoryInstrumentation::reportInstrumentedPointer):
(WebCore::MemoryInstrumentation::reportInstrumentedObject):
(WebCore::MemoryInstrumentation::reportHashMap):
(WebCore::MemoryInstrumentation::reportHashSet):
(WebCore::MemoryInstrumentation::reportListHashSet):
(WebCore::MemoryInstrumentation::reportVector):
* dom/Node.cpp:
(WebCore::Node::reportMemoryUsage):
* dom/QualifiedName.h:
(WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage):
(WebCore::QualifiedName::reportMemoryUsage):
* inspector/InspectorMemoryAgent.cpp:
(WebCore):
* platform/TreeShared.h:
(WebCore::TreeShared::reportMemoryUsage):

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

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/ScriptWrappable.h
Source/WebCore/bindings/v8/DOMDataStore.cpp
Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h
Source/WebCore/bindings/v8/ScriptProfiler.cpp
Source/WebCore/bindings/v8/ScriptWrappable.h
Source/WebCore/bindings/v8/V8Binding.cpp
Source/WebCore/bindings/v8/V8DOMMap.h
Source/WebCore/css/StylePropertySet.h
Source/WebCore/dom/CharacterData.cpp
Source/WebCore/dom/ContainerNode.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/ElementAttributeData.h
Source/WebCore/dom/MemoryInstrumentation.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/QualifiedName.h
Source/WebCore/inspector/InspectorMemoryAgent.cpp
Source/WebCore/platform/TreeShared.h

index ea0cb11..11c9489 100644 (file)
@@ -1,3 +1,68 @@
+2012-07-16  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r122714.
+        http://trac.webkit.org/changeset/122714
+        https://bugs.webkit.org/show_bug.cgi?id=91380
+
+        It broke mac compilation (Requested by loislo on #webkit).
+
+        * bindings/js/ScriptWrappable.h:
+        (WebCore::ScriptWrappable::reportMemoryUsage):
+        * bindings/v8/DOMDataStore.cpp:
+        (WebCore::DOMDataStore::reportMemoryUsage):
+        * bindings/v8/IntrusiveDOMWrapperMap.h:
+        (WebCore::ChunkedTable::reportMemoryUsage):
+        * bindings/v8/ScriptProfiler.cpp:
+        (WebCore::ScriptProfiler::collectBindingMemoryInfo):
+        * bindings/v8/ScriptWrappable.h:
+        (WebCore::ScriptWrappable::reportMemoryUsage):
+        * bindings/v8/V8Binding.cpp:
+        (WebCore::V8BindingPerIsolateData::reportMemoryUsage):
+        (WebCore::StringCache::reportMemoryUsage):
+        * bindings/v8/V8DOMMap.h:
+        * css/StylePropertySet.h:
+        (WebCore::StylePropertySet::reportMemoryUsage):
+        * dom/CharacterData.cpp:
+        (WebCore::CharacterData::reportMemoryUsage):
+        * dom/ContainerNode.h:
+        (WebCore::ContainerNode::reportMemoryUsage):
+        * dom/Document.cpp:
+        (WebCore::Document::reportMemoryUsage):
+        * dom/Element.h:
+        (WebCore::Element::reportMemoryUsage):
+        * dom/ElementAttributeData.h:
+        (WebCore::ElementAttributeData::reportMemoryUsage):
+        * dom/MemoryInstrumentation.h:
+        (WebCore::MemoryInstrumentation::reportObject):
+        (MemoryInstrumentation):
+        (WebCore::MemoryInstrumentation::reportPointer):
+        (WebCore::MemoryClassInfo::reportInstrumentedPointer):
+        (WebCore::MemoryClassInfo::reportInstrumentedObject):
+        (WebCore::MemoryClassInfo::reportPointer):
+        (WebCore::MemoryClassInfo::reportObject):
+        (WebCore::MemoryClassInfo::reportHashMap):
+        (WebCore::MemoryClassInfo::reportHashSet):
+        (WebCore::MemoryClassInfo::reportListHashSet):
+        (WebCore::MemoryClassInfo::reportVector):
+        (MemoryClassInfo):
+        (WebCore::MemoryClassInfo::reportString):
+        (WebCore):
+        (WebCore::MemoryInstrumentation::reportInstrumentedPointer):
+        (WebCore::MemoryInstrumentation::reportInstrumentedObject):
+        (WebCore::MemoryInstrumentation::reportHashMap):
+        (WebCore::MemoryInstrumentation::reportHashSet):
+        (WebCore::MemoryInstrumentation::reportListHashSet):
+        (WebCore::MemoryInstrumentation::reportVector):
+        * dom/Node.cpp:
+        (WebCore::Node::reportMemoryUsage):
+        * dom/QualifiedName.h:
+        (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage):
+        (WebCore::QualifiedName::reportMemoryUsage):
+        * inspector/InspectorMemoryAgent.cpp:
+        (WebCore):
+        * platform/TreeShared.h:
+        (WebCore::TreeShared::reportMemoryUsage):
+
 2012-07-16  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Web Inspector: moving forward to the better memory instrumentation API
index 3cb5d81..947794d 100644 (file)
@@ -57,7 +57,7 @@ public:
     void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     {
         MemoryClassInfo<ScriptWrappable> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
-        info.addMember(m_wrapper);
+        info.reportObject(m_wrapper);
     }
 
 private:
index 7fb8b04..021a7c8 100644 (file)
@@ -122,10 +122,10 @@ void* DOMDataStore::getDOMWrapperMap(DOMWrapperMapType type)
 void DOMDataStore::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo<DOMDataStore> info(memoryObjectInfo, this, MemoryInstrumentation::Binding);
-    info.addInstrumentedMember(m_domNodeMap);
-    info.addInstrumentedMember(m_activeDomNodeMap);
-    info.addInstrumentedMember(m_domObjectMap);
-    info.addInstrumentedMember(m_activeDomObjectMap);
+    info.reportInstrumentedPointer(m_domNodeMap);
+    info.reportInstrumentedPointer(m_activeDomNodeMap);
+    info.reportInstrumentedPointer(m_domObjectMap);
+    info.reportInstrumentedPointer(m_activeDomObjectMap);
 }
 
 // Called when the object is near death (not reachable from JS roots).
index 1200d12..e0728c2 100644 (file)
@@ -106,7 +106,7 @@ class ChunkedTable {
     {
         MemoryClassInfo<ChunkedTable> info(memoryObjectInfo, this, MemoryInstrumentation::Binding);
         for (Chunk* chunk = m_chunks; chunk; chunk = chunk->m_previous)
-            info.addMember(chunk);
+            info.reportPointer(chunk);
     }
 
   private:
@@ -187,7 +187,7 @@ public:
     virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE
     {
         MemoryClassInfo<IntrusiveDOMWrapperMap> info(memoryObjectInfo, this, MemoryInstrumentation::Binding);
-        info.addInstrumentedMember(m_table);
+        info.reportInstrumentedObject(m_table);
     }
 
 private:
index a268f39..07f039e 100644 (file)
@@ -223,7 +223,7 @@ void ScriptProfiler::visitExternalArrays(ExternalArrayVisitor* visitor)
 void ScriptProfiler::collectBindingMemoryInfo(MemoryInstrumentation* instrumentation)
 {
     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
-    instrumentation->addInstrumentedMember(data);
+    instrumentation->reportInstrumentedPointer(data);
 }
 
 size_t ScriptProfiler::profilerSnapshotsSize()
index ef2f761..8f0bcdb 100644 (file)
@@ -55,7 +55,7 @@ public:
     void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     {
         MemoryClassInfo<ScriptWrappable> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
-        info.addMember(m_wrapper);
+        info.reportPointer(m_wrapper);
     }
 
 private:
index d282b0d..4c76621 100644 (file)
@@ -93,13 +93,13 @@ void V8BindingPerIsolateData::dispose(v8::Isolate* isolate)
 void V8BindingPerIsolateData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo<V8BindingPerIsolateData> info(memoryObjectInfo, this, MemoryInstrumentation::Binding);
-    info.addHashMap(m_rawTemplates);
-    info.addHashMap(m_templates);
-    info.addInstrumentedMember(m_stringCache);
-    info.addVector(m_domDataList);
+    info.reportHashMap(m_rawTemplates);
+    info.reportHashMap(m_templates);
+    info.reportInstrumentedObject(m_stringCache);
+    info.reportVector(m_domDataList);
 
     for (size_t i = 0; i < m_domDataList.size(); i++)
-        info.addInstrumentedMember(m_domDataList[i]);
+        info.reportInstrumentedPointer(m_domDataList[i]);
 }
 
 // WebCoreStringResource is a helper class for v8ExternalString. It is used
@@ -591,7 +591,7 @@ v8::Persistent<v8::FunctionTemplate> getToStringTemplate()
 void StringCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo<StringCache> info(memoryObjectInfo, this, MemoryInstrumentation::Binding);
-    info.addHashMap(m_stringCache);
+    info.reportHashMap(m_stringCache);
 }
     
 PassRefPtr<DOMStringList> v8ValueToWebCoreDOMStringList(v8::Handle<v8::Value> value)
index 4de3558..aa19017 100644 (file)
@@ -137,7 +137,7 @@ namespace WebCore {
         virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE
         {
             MemoryClassInfo<WeakReferenceMap<KeyType, ValueType> > info(memoryObjectInfo, this, MemoryInstrumentation::Binding);
-            info.addHashMap(m_map);
+            info.reportHashMap(m_map);
         }
 
     protected:
index 7098f72..4430742 100644 (file)
@@ -120,7 +120,7 @@ public:
     {
         MemoryClassInfo<StylePropertySet> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
         if (m_isMutable)
-            info.addMember(m_mutablePropertyVector);
+            info.reportPointer(m_mutablePropertyVector);
     }
 
 private:
index af1d8fe..395effa 100644 (file)
@@ -96,7 +96,7 @@ void CharacterData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo<CharacterData> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
     info.visitBaseClass<Node>(this);
-    info.addString(m_data);
+    info.reportString(m_data);
 }
 
 void CharacterData::appendData(const String& data, ExceptionCode&)
index 9abaf23..fc2751e 100644 (file)
@@ -103,8 +103,8 @@ public:
     {
         MemoryClassInfo<ContainerNode> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
         info.visitBaseClass<Node>(this);
-        info.addInstrumentedMember(m_firstChild);
-        info.addInstrumentedMember(m_lastChild);
+        info.reportInstrumentedPointer(m_firstChild);
+        info.reportInstrumentedPointer(m_lastChild);
     }
 
 protected:
index 630b1d7..06a08fb 100644 (file)
@@ -6064,36 +6064,36 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo<Document> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
     info.visitBaseClass<ContainerNode>(this);
-    info.addVector(m_customFonts);
-    info.addString(m_documentURI);
-    info.addString(m_baseTarget);
+    info.reportVector(m_customFonts);
+    info.reportString(m_documentURI);
+    info.reportString(m_baseTarget);
     if (m_pageGroupUserSheets)
-        info.addVector(*m_pageGroupUserSheets.get());
+        info.reportVector(*m_pageGroupUserSheets.get());
     if (m_userSheets)
-        info.addVector(*m_userSheets.get());
-    info.addHashSet(m_nodeIterators);
-    info.addHashSet(m_ranges);
-    info.addListHashSet(m_styleSheetCandidateNodes);
-    info.addString(m_preferredStylesheetSet);
-    info.addString(m_selectedStylesheetSet);
-    info.addString(m_title.string());
-    info.addString(m_rawTitle.string());
-    info.addString(m_xmlEncoding);
-    info.addString(m_xmlVersion);
-    info.addString(m_contentLanguage);
-    info.addHashMap(m_documentNamedItemCollections);
-    info.addHashMap(m_windowNamedItemCollections);
+        info.reportVector(*m_userSheets.get());
+    info.reportHashSet(m_nodeIterators);
+    info.reportHashSet(m_ranges);
+    info.reportListHashSet(m_styleSheetCandidateNodes);
+    info.reportString(m_preferredStylesheetSet);
+    info.reportString(m_selectedStylesheetSet);
+    info.reportString(m_title.string());
+    info.reportString(m_rawTitle.string());
+    info.reportString(m_xmlEncoding);
+    info.reportString(m_xmlVersion);
+    info.reportString(m_contentLanguage);
+    info.reportHashMap(m_documentNamedItemCollections);
+    info.reportHashMap(m_windowNamedItemCollections);
 #if ENABLE(DASHBOARD_SUPPORT)
-    info.addVector(m_dashboardRegions);
+    info.reportVector(m_dashboardRegions);
 #endif
-    info.addHashMap(m_cssCanvasElements);
-    info.addVector(m_iconURLs);
-    info.addHashSet(m_documentSuspensionCallbackElements);
-    info.addHashSet(m_mediaVolumeCallbackElements);
-    info.addHashSet(m_privateBrowsingStateChangedElements);
-    info.addHashMap(m_elementsByAccessKey);
-    info.addHashSet(m_mediaCanStartListeners);
-    info.addVector(m_pendingTasks);
+    info.reportHashMap(m_cssCanvasElements);
+    info.reportVector(m_iconURLs);
+    info.reportHashSet(m_documentSuspensionCallbackElements);
+    info.reportHashSet(m_mediaVolumeCallbackElements);
+    info.reportHashSet(m_privateBrowsingStateChangedElements);
+    info.reportHashMap(m_elementsByAccessKey);
+    info.reportHashSet(m_mediaCanStartListeners);
+    info.reportVector(m_pendingTasks);
 }
 
 #if ENABLE(UNDO_MANAGER)
index 80a1b3c..0ffc787 100644 (file)
@@ -431,8 +431,8 @@ public:
     {
         MemoryClassInfo<Element> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
         info.visitBaseClass<ContainerNode>(this);
-        info.addInstrumentedMember(m_tagName);
-        info.addInstrumentedMember(m_attributeData.get());
+        info.reportInstrumentedObject(m_tagName);
+        info.reportInstrumentedPointer(m_attributeData.get());
     }
 
 protected:
index 8c98dfe..2dff424 100644 (file)
@@ -103,11 +103,11 @@ public:
     void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     {
         MemoryClassInfo<ElementAttributeData> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
-        info.addInstrumentedMember(m_inlineStyleDecl.get());
-        info.addInstrumentedMember(m_attributeStyle.get());
-        info.addMember(m_classNames);
-        info.addMember(m_idForStyleResolution);
-        info.addVector(m_attributes);
+        info.reportInstrumentedPointer(m_inlineStyleDecl.get());
+        info.reportInstrumentedPointer(m_attributeStyle.get());
+        info.reportObject(m_classNames);
+        info.reportObject(m_idForStyleResolution);
+        info.reportVector(m_attributes);
     }
 
 private:
index 02fa6f3..d6f113b 100644 (file)
@@ -52,61 +52,21 @@ public:
         LastTypeEntry
     };
 
-    template <typename T> void addInstrumentedMember(const T& t)
-    {
-        OwningTraits<T>::addInstrumentedMember(this, t);
-    }
-
-    template <typename T> void addMember(const T& t, ObjectType objectType)
-    {
-        OwningTraits<T>::addMember(this, t, objectType);
-    }
-
-    template <typename HashMapType> void addHashMap(const HashMapType&, ObjectType, bool contentOnly = false);
-    template <typename HashSetType> void addHashSet(const HashSetType&, ObjectType, bool contentOnly = false);
-    template <typename ListHashSetType> void addListHashSet(const ListHashSetType&, ObjectType, bool contentOnly = false);
-    template <typename VectorType> void addVector(const VectorType&, ObjectType, bool contentOnly = false);
-
-protected:
-    enum OwningType {
-        byPointer,
-        byReference
-    };
-
-    template <typename T>
-    struct OwningTraits { // Default byReference implementation.
-        static void addInstrumentedMember(MemoryInstrumentation* instrumentation, const T& t) { instrumentation->addInstrumentedMemberImpl(&t, byReference); }
-        static void addMember(MemoryInstrumentation* instrumentation, const T& t, MemoryInstrumentation::ObjectType objectType) { instrumentation->addMemberImpl(&t, objectType, byReference); }
-    };
-
-    template <typename T>
-    struct OwningTraits<T*> { // Custom byPointer implementation.
-        static void addInstrumentedMember(MemoryInstrumentation* instrumentation, const T* const& t) { instrumentation->addInstrumentedMemberImpl(t, byPointer); }
-        static void addMember(MemoryInstrumentation* instrumentation, const T* const& t, MemoryInstrumentation::ObjectType objectType) { instrumentation->addMemberImpl(t, objectType, byPointer); }
-    };
-
-    template <typename T>
-    void addInstrumentedMemberImpl(const T* const& object, OwningType owningType)
-    {
-        if (!object || visited(object))
-            return;
-        if (owningType == byReference) {
-            MemoryObjectInfo memoryObjectInfo(this);
-            object->reportMemoryUsage(&memoryObjectInfo);
-        } else
-            deferInstrumentedPointer(adoptPtr(new InstrumentedPointer<T>(object)));
-    }
-
-    template <typename T>
-    void addMemberImpl(const T* const& object, ObjectType objectType, OwningType owningType)
+    template <typename T> void reportInstrumentedObject(const T&);
+    template <typename T> void reportObject(const T&) { }
+    template <typename T> void reportInstrumentedPointer(const T*);
+    template <typename T> void reportPointer(const T* object, ObjectType objectType)
     {
         if (!object || visited(object))
             return;
-        if (owningType == byReference)
-            return;
         countObjectSize(objectType, sizeof(T));
     }
+    template <typename HashMapType> void reportHashMap(const HashMapType&, ObjectType, bool contentOnly = false);
+    template <typename HashSetType> void reportHashSet(const HashSetType&, ObjectType, bool contentOnly = false);
+    template <typename ListHashSetType> void reportListHashSet(const ListHashSetType&, ObjectType, bool contentOnly = false);
+    template <typename VectorType> void reportVector(const VectorType&, ObjectType, bool contentOnly = false);
 
+protected:
     class InstrumentedPointerBase {
     public:
         virtual ~InstrumentedPointerBase() { }
@@ -133,7 +93,7 @@ private:
         const T* m_pointer;
     };
 
-    virtual void addString(const String&, ObjectType) = 0;
+    virtual void reportString(ObjectType, const String&) = 0;
     virtual void countObjectSize(ObjectType, size_t) = 0;
     virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) = 0;
     virtual bool visited(const void*) = 0;
@@ -181,15 +141,18 @@ public:
 
     template <typename P> void visitBaseClass(const P* ptr) { ptr->P::reportMemoryUsage(m_memoryObjectInfo); }
 
-    template <typename M> void addInstrumentedMember(const M& member) { m_memoryInstrumentation->addInstrumentedMember(member); }
-    template <typename M> void addMember(const M& member) { m_memoryInstrumentation->addMember(member, m_objectType); }
+    template <typename P> void reportInstrumentedPointer(const P* memberPointer) { m_memoryInstrumentation->reportInstrumentedPointer(memberPointer); }
+    template <typename O> void reportInstrumentedObject(const O& memberObject) { m_memoryInstrumentation->reportInstrumentedObject(memberObject); }
 
-    template <typename HashMapType> void addHashMap(const HashMapType& map) { m_memoryInstrumentation->addHashMap(map, m_objectType, true); }
-    template <typename HashSetType> void addHashSet(const HashSetType& set) { m_memoryInstrumentation->addHashSet(set, m_objectType, true); }
-    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 P> void reportPointer(const P* pointer) { m_memoryInstrumentation->reportPointer(pointer, m_objectType); }
+    template <typename O> void reportObject(const O& object) { m_memoryInstrumentation->reportObject(object); }
 
-    void addString(const String& string) { m_memoryInstrumentation->addString(string, m_objectType); }
+    template <typename HashMapType> void reportHashMap(const HashMapType& map) { m_memoryInstrumentation->reportHashMap(map, m_objectType, true); }
+    template <typename HashSetType> void reportHashSet(const HashSetType& set) { m_memoryInstrumentation->reportHashSet(set, m_objectType, true); }
+    template <typename ListHashSetType> void reportListHashSet(const ListHashSetType& set) { m_memoryInstrumentation->reportListHashSet(set, m_objectType, true); }
+    template <typename VectorType> void reportVector(const VectorType& vector) { m_memoryInstrumentation->reportVector(vector, m_objectType, true); }
+
+    void reportString(const String& string) { m_memoryInstrumentation->reportString(m_objectType, string); }
 
 private:
     MemoryObjectInfo* m_memoryObjectInfo;
@@ -197,14 +160,31 @@ private:
     MemoryInstrumentation::ObjectType m_objectType;
 };
 
+template <typename T>
+void MemoryInstrumentation::reportInstrumentedPointer(const T* const object)
+{
+    if (!object || visited(object))
+        return;
+    deferInstrumentedPointer(adoptPtr(new InstrumentedPointer<T>(object)));
+}
+
+template<typename T>
+void MemoryInstrumentation::reportInstrumentedObject(const T& object)
+{
+    if (visited(&object))
+        return;
+    MemoryObjectInfo memoryObjectInfo(this);
+    object.reportMemoryUsage(&memoryObjectInfo);
+}
+
 template<typename HashMapType>
-void MemoryInstrumentation::addHashMap(const HashMapType& hashMap, ObjectType objectType, bool contentOnly)
+void MemoryInstrumentation::reportHashMap(const HashMapType& hashMap, ObjectType objectType, bool contentOnly)
 {
     countObjectSize(objectType, calculateContainerSize(hashMap, contentOnly));
 }
 
 template<typename HashSetType>
-void MemoryInstrumentation::addHashSet(const HashSetType& hashSet, ObjectType objectType, bool contentOnly)
+void MemoryInstrumentation::reportHashSet(const HashSetType& hashSet, ObjectType objectType, bool contentOnly)
 {
     if (visited(&hashSet))
         return;
@@ -212,7 +192,7 @@ void MemoryInstrumentation::addHashSet(const HashSetType& hashSet, ObjectType ob
 }
 
 template<typename ListHashSetType>
-void MemoryInstrumentation::addListHashSet(const ListHashSetType& hashSet, ObjectType objectType, bool contentOnly)
+void MemoryInstrumentation::reportListHashSet(const ListHashSetType& hashSet, ObjectType objectType, bool contentOnly)
 {
     if (visited(&hashSet))
         return;
@@ -221,7 +201,7 @@ void MemoryInstrumentation::addListHashSet(const ListHashSetType& hashSet, Objec
 }
 
 template <typename VectorType>
-void MemoryInstrumentation::addVector(const VectorType& vector, ObjectType objectType, bool contentOnly)
+void MemoryInstrumentation::reportVector(const VectorType& vector, ObjectType objectType, bool contentOnly)
 {
     if (visited(vector.data()))
         return;
index cb52094..03a60e5 100644 (file)
@@ -2771,9 +2771,9 @@ void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     MemoryClassInfo<Node> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
     info.visitBaseClass<TreeShared<Node, ContainerNode> >(this);
     info.visitBaseClass<ScriptWrappable>(this);
-    info.addInstrumentedMember(m_document);
-    info.addInstrumentedMember(m_next);
-    info.addInstrumentedMember(m_previous);
+    info.reportInstrumentedPointer(m_document);
+    info.reportInstrumentedPointer(m_next);
+    info.reportInstrumentedPointer(m_previous);
 }
 
 } // namespace WebCore
index 5b2de39..2845e77 100644 (file)
@@ -53,10 +53,10 @@ public:
         void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
         {
             MemoryClassInfo<QualifiedNameImpl> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
-            info.addMember(m_prefix);
-            info.addMember(m_localName);
-            info.addMember(m_namespace);
-            info.addMember(m_localNameUpper);
+            info.reportObject(m_prefix);
+            info.reportObject(m_localName);
+            info.reportObject(m_namespace);
+            info.reportObject(m_localNameUpper);
         }
     private:
         QualifiedNameImpl(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI)
@@ -105,7 +105,7 @@ public:
     void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     {
         MemoryClassInfo<QualifiedName> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
-        info.addInstrumentedMember(m_impl);
+        info.reportInstrumentedPointer(m_impl);
     }
 private:
     void init(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI);
index 2ad0145..5b3e366 100644 (file)
@@ -500,7 +500,7 @@ public:
     }
 
 private:
-    virtual void addString(const String& string, ObjectType objectType)
+    virtual void reportString(ObjectType objectType, const String& string)
     {
         if (string.isNull() || visited(string.impl()))
             return;
@@ -541,7 +541,7 @@ public:
         if (node->document() && node->document()->frame() && m_page != node->document()->frame()->page())
             return;
 
-        m_domMemoryUsage.addInstrumentedMember(node);
+        m_domMemoryUsage.reportInstrumentedPointer(node);
         m_domMemoryUsage.processDeferredInstrumentedPointers();
     }
 
index d4d53ea..44dc16f 100644 (file)
@@ -114,7 +114,7 @@ public:
     void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     {
         MemoryClassInfo<TreeShared<NodeType, ParentNodeType> > info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
-        info.addInstrumentedMember(m_parent);
+        info.reportInstrumentedPointer(m_parent);
     }
 
 private: