Title: [137468] trunk
Revision
137468
Author
loi...@chromium.org
Date
2012-12-12 08:06:34 -0800 (Wed, 12 Dec 2012)

Log Message

Web Inspector: Native Memory Instrumentation: remove fake root MemoryObjectInfo.
https://bugs.webkit.org/show_bug.cgi?id=104796

Reviewed by Yury Semikhatsky.

It was not a good idea to introduce a fake root MemoryObjectInfo.
It makes a problem when we visit an object without its own MemoryObjectType.

Example: RenderBox has a global pointer to a hash map.
HashMap doesn't have its own object type because it is a generic container.
It will inherit object type from the fake root memory object info.
The same could happen for another container in another class with other MemoryObjectType.

This fact forces me to create custom process method for root objects
because they need to have their own MemoryObjectInfo with customisable memory object type.

Source/_javascript_Core:

Drive by fix: InstrumentedPointer* was replaced with Wrapper* because actually it is using
for instrumented and not instrumented object classes.

* _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:

Source/WebCore:

Drive by fix: InstrumentedPointer* was replaced with Wrapper* because actually it is using
for instrumented and not instrumented object classes.

* inspector/MemoryInstrumentationImpl.cpp:
(WebCore::MemoryInstrumentationImpl::processDeferredObjects):
(WebCore::MemoryInstrumentationImpl::deferObject):
(WebCore::MemoryInstrumentationImpl::reportMemoryUsage):
* inspector/MemoryInstrumentationImpl.h:
(MemoryInstrumentationImpl):

Source/WTF:

Drive by fix: InstrumentedPointer* was replaced with Wrapper* because actually it is using
for instrumented and not instrumented object classes.

* wtf/MemoryInstrumentation.cpp:
(WTF::MemoryInstrumentation::MemoryInstrumentation):
(WTF::MemoryInstrumentation::WrapperBase::WrapperBase):
(WTF::MemoryInstrumentation::WrapperBase::process):
(WTF::MemoryInstrumentation::WrapperBase::processRootObjectRef):
(WTF):
* wtf/MemoryInstrumentation.h:
(WTF::MemoryInstrumentation::addRootObject):
(MemoryInstrumentation):
(WrapperBase):
(WTF::MemoryInstrumentation::WrapperBase::~WrapperBase):
(Wrapper):
(OwningTraits):
(WTF::MemoryInstrumentation::OwningTraits::addRootObject):
(WTF::MemoryInstrumentation::addObjectImpl):
(WTF::::Wrapper):
(WTF::::callReportMemoryUsage):

Tools:

* TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp:

Drive by fix: InstrumentedPointer* was replaced with Wrapper* because actually it is using
for instrumented and not instrumented object classes.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (137467 => 137468)


--- trunk/Source/_javascript_Core/ChangeLog	2012-12-12 15:55:45 UTC (rev 137467)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-12-12 16:06:34 UTC (rev 137468)
@@ -1,3 +1,26 @@
+2012-12-12  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: Native Memory Instrumentation: remove fake root MemoryObjectInfo.
+        https://bugs.webkit.org/show_bug.cgi?id=104796
+
+        Reviewed by Yury Semikhatsky.
+
+        It was not a good idea to introduce a fake root MemoryObjectInfo.
+        It makes a problem when we visit an object without its own MemoryObjectType.
+
+        Example: RenderBox has a global pointer to a hash map.
+        HashMap doesn't have its own object type because it is a generic container.
+        It will inherit object type from the fake root memory object info.
+        The same could happen for another container in another class with other MemoryObjectType.
+
+        This fact forces me to create custom process method for root objects
+        because they need to have their own MemoryObjectInfo with customisable memory object type.
+
+        Drive by fix: InstrumentedPointer* was replaced with Wrapper* because actually it is using
+        for instrumented and not instrumented object classes.
+
+        * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
+
 2012-12-11  Gabor Ballabas  <gab...@inf.u-szeged.hu>
 
         Implement add64 for ARM traditional assembler after r136601

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (137467 => 137468)


--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2012-12-12 15:55:45 UTC (rev 137467)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2012-12-12 16:06:34 UTC (rev 137468)
@@ -12,7 +12,6 @@
     ??0DropAllLocks@JSLock@JSC@@QAE@PAVJSGlobalData@2@@Z
     ??0DynamicGlobalObjectScope@JSC@@QAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@@Z 
     ??0ErrorHandlingMode@Interpreter@JSC@@QAE@PAVExecState@2@@Z
-    ??0InstrumentedPointerBase@MemoryInstrumentation@WTF@@QAE@PAVMemoryObjectInfo@2@PBX@Z
     ??0InternalFunction@JSC@@IAE@PAVJSGlobalObject@1@PAVStructure@1@@Z
     ??0JSGlobalObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@PBUGlobalObjectMethodTable@1@@Z
     ??0JSLockHolder@JSC@@QAE@AAVJSGlobalData@1@@Z
@@ -31,6 +30,7 @@
     ??0Structure@JSC@@AAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@VJSValue@1@ABVTypeInfo@1@PBUClassInfo@1@EH@Z
     ??0ThreadCondition@WTF@@QAE@XZ
     ??0WTFThreadData@WTF@@QAE@XZ
+    ??0WrapperBase@MemoryInstrumentation@WTF@@QAE@PBDPBX@Z
     ??0YarrPattern@Yarr@JSC@@QAE@ABVString@WTF@@_N1PAPBD@Z
     ??1ArrayBufferView@WTF@@UAE@XZ
     ??1ClientData@JSGlobalData@JSC@@UAE@XZ
@@ -305,7 +305,8 @@
     ?parseDateFromNullTerminatedCharacters@WTF@@YANPBD@Z
     ?parseDoubleFromLongString@Internal@WTF@@YANPB_WIAAI@Z
     ?positiveInfiniteTime@MediaTime@WTF@@SAABV12@XZ 
-    ?process@InstrumentedPointerBase@MemoryInstrumentation@WTF@@QAEXPAV23@@Z
+    ?process@WrapperBase@MemoryInstrumentation@WTF@@QAEXPAV23@@Z
+    ?processRootObjectRef@WrapperBase@MemoryInstrumentation@WTF@@QAEXPAV23@@Z
     ?profiler@LegacyProfiler@JSC@@SAPAV12@XZ
     ?protect@Heap@JSC@@QAEXVJSValue@2@@Z
     ?protectedGlobalObjectCount@Heap@JSC@@QAEIXZ

Modified: trunk/Source/WTF/ChangeLog (137467 => 137468)


--- trunk/Source/WTF/ChangeLog	2012-12-12 15:55:45 UTC (rev 137467)
+++ trunk/Source/WTF/ChangeLog	2012-12-12 16:06:34 UTC (rev 137468)
@@ -1,3 +1,42 @@
+2012-12-12  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: Native Memory Instrumentation: remove fake root MemoryObjectInfo.
+        https://bugs.webkit.org/show_bug.cgi?id=104796
+
+        Reviewed by Yury Semikhatsky.
+
+        It was not a good idea to introduce a fake root MemoryObjectInfo.
+        It makes a problem when we visit an object without its own MemoryObjectType.
+
+        Example: RenderBox has a global pointer to a hash map.
+        HashMap doesn't have its own object type because it is a generic container.
+        It will inherit object type from the fake root memory object info.
+        The same could happen for another container in another class with other MemoryObjectType.
+
+        This fact forces me to create custom process method for root objects
+        because they need to have their own MemoryObjectInfo with customisable memory object type.
+
+        Drive by fix: InstrumentedPointer* was replaced with Wrapper* because actually it is using
+        for instrumented and not instrumented object classes.
+
+        * wtf/MemoryInstrumentation.cpp:
+        (WTF::MemoryInstrumentation::MemoryInstrumentation):
+        (WTF::MemoryInstrumentation::WrapperBase::WrapperBase):
+        (WTF::MemoryInstrumentation::WrapperBase::process):
+        (WTF::MemoryInstrumentation::WrapperBase::processRootObjectRef):
+        (WTF):
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryInstrumentation::addRootObject):
+        (MemoryInstrumentation):
+        (WrapperBase):
+        (WTF::MemoryInstrumentation::WrapperBase::~WrapperBase):
+        (Wrapper):
+        (OwningTraits):
+        (WTF::MemoryInstrumentation::OwningTraits::addRootObject):
+        (WTF::MemoryInstrumentation::addObjectImpl):
+        (WTF::::Wrapper):
+        (WTF::::callReportMemoryUsage):
+
 2012-12-12  Sergio Martins  <sergio.mart...@kdab.com>
 
         Fix QNX Qt build by enabling JIT.

Modified: trunk/Source/WTF/wtf/MemoryInstrumentation.cpp (137467 => 137468)


--- trunk/Source/WTF/wtf/MemoryInstrumentation.cpp	2012-12-12 15:55:45 UTC (rev 137467)
+++ trunk/Source/WTF/wtf/MemoryInstrumentation.cpp	2012-12-12 16:06:34 UTC (rev 137468)
@@ -42,7 +42,6 @@
 
 MemoryInstrumentation::MemoryInstrumentation(MemoryInstrumentationClient* client)
     : m_client(client)
-    , m_rootObjectInfo(adoptPtr(new MemoryObjectInfo(this, 0, 0)))
 {
 }
 
@@ -73,9 +72,9 @@
     m_client->reportLeaf(owner, memoryObjectInfo, edgeName);
 }
 
-MemoryInstrumentation::InstrumentedPointerBase::InstrumentedPointerBase(MemoryObjectInfo* memoryObjectInfo, const void* pointer)
+MemoryInstrumentation::WrapperBase::WrapperBase(MemoryObjectType objectType, const void* pointer)
     : m_pointer(pointer)
-    , m_ownerObjectType(memoryObjectInfo->objectType())
+    , m_ownerObjectType(objectType)
 {
 #if DEBUG_POINTER_INSTRUMENTATION
     m_callStackSize = s_maxCallStackSize;
@@ -83,7 +82,7 @@
 #endif
 }
 
-void MemoryInstrumentation::InstrumentedPointerBase::process(MemoryInstrumentation* memoryInstrumentation)
+void MemoryInstrumentation::WrapperBase::process(MemoryInstrumentation* memoryInstrumentation)
 {
     MemoryObjectInfo memoryObjectInfo(memoryInstrumentation, m_ownerObjectType, m_pointer);
     callReportMemoryUsage(&memoryObjectInfo);
@@ -105,6 +104,15 @@
     }
 }
 
+void MemoryInstrumentation::WrapperBase::processRootObjectRef(MemoryInstrumentation* memoryInstrumentation)
+{
+    MemoryObjectInfo memoryObjectInfo(memoryInstrumentation, m_ownerObjectType, m_pointer);
+    callReportMemoryUsage(&memoryObjectInfo);
+
+    ASSERT(m_pointer == memoryObjectInfo.reportedPointer());
+    memoryInstrumentation->m_client->reportNode(memoryObjectInfo);
+}
+
 void MemoryClassInfo::init(const void* objectAddress, MemoryObjectType objectType, size_t actualSize)
 {
     m_memoryObjectInfo->reportObjectInfo(objectAddress, objectType, actualSize);

Modified: trunk/Source/WTF/wtf/MemoryInstrumentation.h (137467 => 137468)


--- trunk/Source/WTF/wtf/MemoryInstrumentation.h	2012-12-12 15:55:45 UTC (rev 137467)
+++ trunk/Source/WTF/wtf/MemoryInstrumentation.h	2012-12-12 16:06:34 UTC (rev 137468)
@@ -70,25 +70,29 @@
     WTF_EXPORT_PRIVATE explicit MemoryInstrumentation(MemoryInstrumentationClient*);
     WTF_EXPORT_PRIVATE virtual ~MemoryInstrumentation();
 
-    template <typename T> void addRootObject(const T& t)
+    template <typename T> void addRootObject(const T& t, MemoryObjectType objectType = 0)
     {
-        addObject(t, m_rootObjectInfo.get(), 0);
-        processDeferredInstrumentedPointers();
+        OwningTraits<T>::addRootObject(this, t, objectType);
+        processDeferredObjects();
     }
 
+    template <typename T> void addRootObject(const OwnPtr<T>&, MemoryObjectType = 0); // Link time guard.
+    template <typename T> void addRootObject(const RefPtr<T>&, MemoryObjectType = 0); // Link time guard.
+
 protected:
-    class InstrumentedPointerBase {
+    class WrapperBase {
     public:
-        WTF_EXPORT_PRIVATE InstrumentedPointerBase(MemoryObjectInfo*, const void* pointer);
-        virtual ~InstrumentedPointerBase() { }
+        WTF_EXPORT_PRIVATE WrapperBase(MemoryObjectType, const void* pointer);
+        virtual ~WrapperBase() { }
         WTF_EXPORT_PRIVATE void process(MemoryInstrumentation*);
+        WTF_EXPORT_PRIVATE void processRootObjectRef(MemoryInstrumentation*);
 
     protected:
         virtual void callReportMemoryUsage(MemoryObjectInfo*) = 0;
         const void* m_pointer;
+        const MemoryObjectType m_ownerObjectType;
 
     private:
-        const MemoryObjectType m_ownerObjectType;
 #if DEBUG_POINTER_INSTRUMENTATION
         static const int s_maxCallStackSize = 32;
         void* m_callStack[s_maxCallStackSize];
@@ -103,8 +107,8 @@
 
     WTF_EXPORT_PRIVATE void reportEdge(MemoryObjectInfo* ownerObjectInfo, const void* target, const char* edgeName);
 
-    virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) = 0;
-    virtual void processDeferredInstrumentedPointers() = 0;
+    virtual void deferObject(PassOwnPtr<WrapperBase>) = 0;
+    virtual void processDeferredObjects() = 0;
 
     WTF_EXPORT_PRIVATE static MemoryObjectType getObjectType(MemoryObjectInfo*);
 
@@ -133,9 +137,9 @@
     }
     WTF_EXPORT_PRIVATE static void callReportObjectInfo(MemoryObjectInfo*, const void* pointer, MemoryObjectType, size_t objectSize);
 
-    template<typename T> class InstrumentedPointer : public InstrumentedPointerBase {
+    template<typename T> class Wrapper : public WrapperBase {
     public:
-        InstrumentedPointer(const T* pointer, MemoryObjectInfo* ownerObjectInfo);
+        Wrapper(const T* pointer, MemoryObjectType);
 
     protected:
         virtual void callReportMemoryUsage(MemoryObjectInfo*) OVERRIDE;
@@ -157,6 +161,11 @@
         {
             instrumentation->addObjectImpl(&t, ownerObjectInfo, byReference, edgeName);
         }
+
+        static void addRootObject(MemoryInstrumentation* instrumentation, const T& t, MemoryObjectType objectType)
+        {
+            Wrapper<T>(&t, objectType).processRootObjectRef(instrumentation);
+        }
     };
 
     template<typename T>
@@ -165,6 +174,12 @@
         {
             instrumentation->addObjectImpl(t, ownerObjectInfo, byPointer, edgeName);
         }
+
+        static void addRootObject(MemoryInstrumentation* instrumentation, const T* const& t, MemoryObjectType objectType)
+        {
+            if (t && !instrumentation->visited(t))
+                Wrapper<T>(t, objectType).process(instrumentation);
+        }
     };
 
     template<typename T> void addObjectImpl(const T*, MemoryObjectInfo*, MemoryOwningType, const char* edgeName);
@@ -172,7 +187,6 @@
     template<typename T> void addObjectImpl(const RefPtr<T>*, MemoryObjectInfo*, MemoryOwningType, const char* edgeName);
 
     MemoryInstrumentationClient* m_client;
-    OwnPtr<MemoryObjectInfo> m_rootObjectInfo;
 };
 
 class MemoryClassInfo {
@@ -221,7 +235,7 @@
         reportEdge(ownerObjectInfo, object, edgeName);
         if (!object || visited(object))
             return;
-        deferInstrumentedPointer(adoptPtr(new InstrumentedPointer<T>(object, ownerObjectInfo)));
+        deferObject(adoptPtr(new Wrapper<T>(object, getObjectType(ownerObjectInfo))));
     }
 }
 
@@ -242,13 +256,13 @@
 }
 
 template<typename T>
-MemoryInstrumentation::InstrumentedPointer<T>::InstrumentedPointer(const T* pointer, MemoryObjectInfo* ownerObjectInfo)
-    : InstrumentedPointerBase(ownerObjectInfo, pointer)
+MemoryInstrumentation::Wrapper<T>::Wrapper(const T* pointer, MemoryObjectType ownerObjectType)
+    : WrapperBase(ownerObjectType, pointer)
 {
 }
 
 template<typename T>
-void MemoryInstrumentation::InstrumentedPointer<T>::callReportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
+void MemoryInstrumentation::Wrapper<T>::callReportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
 {
     reportMemoryUsage(static_cast<const T*>(m_pointer), memoryObjectInfo);
 }

Modified: trunk/Source/WebCore/ChangeLog (137467 => 137468)


--- trunk/Source/WebCore/ChangeLog	2012-12-12 15:55:45 UTC (rev 137467)
+++ trunk/Source/WebCore/ChangeLog	2012-12-12 16:06:34 UTC (rev 137468)
@@ -1,3 +1,31 @@
+2012-12-12  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: Native Memory Instrumentation: remove fake root MemoryObjectInfo.
+        https://bugs.webkit.org/show_bug.cgi?id=104796
+
+        Reviewed by Yury Semikhatsky.
+
+        It was not a good idea to introduce a fake root MemoryObjectInfo.
+        It makes a problem when we visit an object without its own MemoryObjectType.
+
+        Example: RenderBox has a global pointer to a hash map.
+        HashMap doesn't have its own object type because it is a generic container.
+        It will inherit object type from the fake root memory object info.
+        The same could happen for another container in another class with other MemoryObjectType.
+
+        This fact forces me to create custom process method for root objects
+        because they need to have their own MemoryObjectInfo with customisable memory object type.
+
+        Drive by fix: InstrumentedPointer* was replaced with Wrapper* because actually it is using
+        for instrumented and not instrumented object classes.
+
+        * inspector/MemoryInstrumentationImpl.cpp:
+        (WebCore::MemoryInstrumentationImpl::processDeferredObjects):
+        (WebCore::MemoryInstrumentationImpl::deferObject):
+        (WebCore::MemoryInstrumentationImpl::reportMemoryUsage):
+        * inspector/MemoryInstrumentationImpl.h:
+        (MemoryInstrumentationImpl):
+
 2012-12-12  Kondapally Kalyan  <kalyan.kondapa...@intel.com>
 
         [EFL [WebGL] [Wk2] Resizing the canvas breaks WebGL.

Modified: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp (137467 => 137468)


--- trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp	2012-12-12 15:55:45 UTC (rev 137467)
+++ trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp	2012-12-12 16:06:34 UTC (rev 137468)
@@ -103,24 +103,24 @@
     info.addMember(m_countedObjects);
 }
 
-void MemoryInstrumentationImpl::processDeferredInstrumentedPointers()
+void MemoryInstrumentationImpl::processDeferredObjects()
 {
-    while (!m_deferredInstrumentedPointers.isEmpty()) {
-        OwnPtr<InstrumentedPointerBase> pointer = m_deferredInstrumentedPointers.last().release();
-        m_deferredInstrumentedPointers.removeLast();
+    while (!m_deferredObjects.isEmpty()) {
+        OwnPtr<WrapperBase> pointer = m_deferredObjects.last().release();
+        m_deferredObjects.removeLast();
         pointer->process(this);
     }
 }
 
-void MemoryInstrumentationImpl::deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase> pointer)
+void MemoryInstrumentationImpl::deferObject(PassOwnPtr<WrapperBase> pointer)
 {
-    m_deferredInstrumentedPointers.append(pointer);
+    m_deferredObjects.append(pointer);
 }
 
 void MemoryInstrumentationImpl::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorMemoryAgent);
-    info.addMember(m_deferredInstrumentedPointers);
+    info.addMember(m_deferredObjects);
 }
 
 

Modified: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h (137467 => 137468)


--- trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h	2012-12-12 15:55:45 UTC (rev 137467)
+++ trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h	2012-12-12 16:06:34 UTC (rev 137468)
@@ -110,10 +110,10 @@
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
 private:
-    virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) OVERRIDE;
-    virtual void processDeferredInstrumentedPointers() OVERRIDE;
+    virtual void deferObject(PassOwnPtr<WrapperBase>) OVERRIDE;
+    virtual void processDeferredObjects() OVERRIDE;
 
-    Vector<OwnPtr<InstrumentedPointerBase> > m_deferredInstrumentedPointers;
+    Vector<OwnPtr<WrapperBase> > m_deferredObjects;
 };
 
 } // namespace WebCore

Modified: trunk/Tools/ChangeLog (137467 => 137468)


--- trunk/Tools/ChangeLog	2012-12-12 15:55:45 UTC (rev 137467)
+++ trunk/Tools/ChangeLog	2012-12-12 16:06:34 UTC (rev 137468)
@@ -1,3 +1,26 @@
+2012-12-12  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: Native Memory Instrumentation: remove fake root MemoryObjectInfo.
+        https://bugs.webkit.org/show_bug.cgi?id=104796
+
+        Reviewed by Yury Semikhatsky.
+
+        It was not a good idea to introduce a fake root MemoryObjectInfo.
+        It makes a problem when we visit an object without its own MemoryObjectType.
+
+        Example: RenderBox has a global pointer to a hash map.
+        HashMap doesn't have its own object type because it is a generic container.
+        It will inherit object type from the fake root memory object info.
+        The same could happen for another container in another class with other MemoryObjectType.
+
+        This fact forces me to create custom process method for root objects
+        because they need to have their own MemoryObjectInfo with customisable memory object type.
+
+        * TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp:
+
+        Drive by fix: InstrumentedPointer* was replaced with Wrapper* because actually it is using
+        for instrumented and not instrumented object classes.
+
 2012-12-12  Zan Dobersek  <zandober...@gmail.com>
 
         [GTK] Remove the last of unnecessary configuration options in configure.ac

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp (137467 => 137468)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp	2012-12-12 15:55:45 UTC (rev 137467)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp	2012-12-12 16:06:34 UTC (rev 137468)
@@ -124,8 +124,8 @@
         : MemoryInstrumentation(client)
         , m_client(client) { }
 
-    virtual void processDeferredInstrumentedPointers();
-    virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>);
+    virtual void processDeferredObjects();
+    virtual void deferObject(PassOwnPtr<WrapperBase>);
 
     size_t visitedObjects() const { return m_client->visitedObjects(); }
     size_t reportedSizeForAllTypes() const { return m_client->reportedSizeForAllTypes(); }
@@ -133,7 +133,7 @@
 
 private:
     MemoryInstrumentationTestClient* m_client;
-    Vector<OwnPtr<InstrumentedPointerBase> > m_deferredInstrumentedPointers;
+    Vector<OwnPtr<WrapperBase> > m_deferredObjects;
 };
 
 class InstrumentationTestHelper : public InstrumentationTestImpl {
@@ -144,18 +144,18 @@
     MemoryInstrumentationTestClient m_client;
 };
 
-void InstrumentationTestImpl::processDeferredInstrumentedPointers()
+void InstrumentationTestImpl::processDeferredObjects()
 {
-    while (!m_deferredInstrumentedPointers.isEmpty()) {
-        OwnPtr<InstrumentedPointerBase> pointer = m_deferredInstrumentedPointers.last().release();
-        m_deferredInstrumentedPointers.removeLast();
+    while (!m_deferredObjects.isEmpty()) {
+        OwnPtr<WrapperBase> pointer = m_deferredObjects.last().release();
+        m_deferredObjects.removeLast();
         pointer->process(this);
     }
 }
 
-void InstrumentationTestImpl::deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase> pointer)
+void InstrumentationTestImpl::deferObject(PassOwnPtr<WrapperBase> pointer)
 {
-    m_deferredInstrumentedPointers.append(pointer);
+    m_deferredObjects.append(pointer);
 }
 
 class NotInstrumented {
@@ -221,38 +221,6 @@
     }
 }
 
-TEST(MemoryInstrumentationTest, ownPtr)
-{
-    InstrumentationTestHelper helper;
-    OwnPtr<Instrumented> instrumented(adoptPtr(new Instrumented));
-    helper.addRootObject(instrumented);
-    EXPECT_EQ(sizeof(Instrumented) + sizeof(NotInstrumented), helper.reportedSizeForAllTypes());
-    EXPECT_EQ(2u, helper.visitedObjects());
-}
-
-class InstrumentedRefPtr : public RefCounted<InstrumentedRefPtr> {
-public:
-    InstrumentedRefPtr() : m_notInstrumented(new NotInstrumented) { }
-    virtual ~InstrumentedRefPtr() { delete m_notInstrumented; }
-    static PassRefPtr<InstrumentedRefPtr> create() { return adoptRef(new InstrumentedRefPtr()); }
-
-    virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-    {
-        MemoryClassInfo info(memoryObjectInfo, this, TestType);
-        info.addMember(m_notInstrumented);
-    }
-    NotInstrumented* m_notInstrumented;
-};
-
-TEST(MemoryInstrumentationTest, refPtr)
-{
-    InstrumentationTestHelper helper;
-    RefPtr<InstrumentedRefPtr> instrumentedRefPtr(adoptRef(new InstrumentedRefPtr));
-    helper.addRootObject(instrumentedRefPtr);
-    EXPECT_EQ(sizeof(InstrumentedRefPtr) + sizeof(NotInstrumented), helper.reportedSizeForAllTypes());
-    EXPECT_EQ(2u, helper.visitedObjects());
-}
-
 class InstrumentedWithOwnPtr : public Instrumented {
 public:
     InstrumentedWithOwnPtr() : m_notInstrumentedOwnPtr(adoptPtr(new NotInstrumented)) { }
@@ -302,7 +270,7 @@
 {
     InstrumentationTestHelper helper;
     OwnPtr<InstrumentedDOM> instrumentedDOM(adoptPtr(new InstrumentedDOM));
-    helper.addRootObject(instrumentedDOM);
+    helper.addRootObject(instrumentedDOM.get());
     EXPECT_EQ(sizeof(InstrumentedDOM) + sizeof(InstrumentedUndefined), helper.reportedSizeForAllTypes());
     EXPECT_EQ(sizeof(InstrumentedDOM) + sizeof(InstrumentedUndefined), helper.totalSize(TestType));
     EXPECT_EQ(2u, helper.visitedObjects());
@@ -901,7 +869,7 @@
 
     CountLinksFromInstrumentedObject client;
     InstrumentationTestImpl instrumentation(&client);
-    instrumentation.addRootObject(instance);
+    instrumentation.addRootObject(instance.get());
     EXPECT_EQ(1, client.linkCount());
 }
 } // namespace
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to