Web Inspector: Native Memory Instrumentation: remove fake root MemoryObjectInfo.
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 16:06:34 +0000 (16:06 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 16:06:34 +0000 (16:06 +0000)
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/JavaScriptCore:

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

* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.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.

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/WTF/ChangeLog
Source/WTF/wtf/MemoryInstrumentation.cpp
Source/WTF/wtf/MemoryInstrumentation.h
Source/WebCore/ChangeLog
Source/WebCore/inspector/MemoryInstrumentationImpl.cpp
Source/WebCore/inspector/MemoryInstrumentationImpl.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp

index adb38ab..2c0bca5 100644 (file)
@@ -1,3 +1,26 @@
+2012-12-12  Ilya Tikhonovsky  <loislo@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.
+
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
 2012-12-11  Gabor Ballabas  <gaborb@inf.u-szeged.hu>
 
         Implement add64 for ARM traditional assembler after r136601
index 306aa1c..99a61f4 100755 (executable)
@@ -12,7 +12,6 @@ EXPORTS
     ??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 @@ EXPORTS
     ??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 @@ EXPORTS
     ?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
index 56e84ac..ad8a9a3 100644 (file)
@@ -1,3 +1,42 @@
+2012-12-12  Ilya Tikhonovsky  <loislo@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.martins@kdab.com>
 
         Fix QNX Qt build by enabling JIT.
index 1b566bb..af8b924 100644 (file)
@@ -42,7 +42,6 @@ namespace WTF {
 
 MemoryInstrumentation::MemoryInstrumentation(MemoryInstrumentationClient* client)
     : m_client(client)
-    , m_rootObjectInfo(adoptPtr(new MemoryObjectInfo(this, 0, 0)))
 {
 }
 
@@ -73,9 +72,9 @@ void MemoryInstrumentation::reportLinkToBuffer(const void* owner, const void* bu
     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 @@ MemoryInstrumentation::InstrumentedPointerBase::InstrumentedPointerBase(MemoryOb
 #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::InstrumentedPointerBase::process(MemoryInstrumentati
     }
 }
 
+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);
index b944121..1a6c5ea 100644 (file)
@@ -70,25 +70,29 @@ public:
     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 @@ private:
 
     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 @@ private:
     }
     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 @@ private:
         {
             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 @@ private:
         {
             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 @@ private:
     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 @@ void MemoryInstrumentation::addObjectImpl(const T* object, MemoryObjectInfo* own
         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 @@ void MemoryInstrumentation::addObjectImpl(const RefPtr<T>* object, MemoryObjectI
 }
 
 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);
 }
index a0c0854..f9d053e 100644 (file)
@@ -1,3 +1,31 @@
+2012-12-12  Ilya Tikhonovsky  <loislo@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.kondapally@intel.com>
 
         [EFL [WebGL] [Wk2] Resizing the canvas breaks WebGL.
index a3d6213..5338288 100644 (file)
@@ -103,24 +103,24 @@ void MemoryInstrumentationClientImpl::reportMemoryUsage(MemoryObjectInfo* memory
     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);
 }
 
 
index e9cd445..55d9cd9 100644 (file)
@@ -110,10 +110,10 @@ public:
     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
index dfcdd72..5c1f00f 100644 (file)
@@ -1,3 +1,26 @@
+2012-12-12  Ilya Tikhonovsky  <loislo@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  <zandobersek@gmail.com>
 
         [GTK] Remove the last of unnecessary configuration options in configure.ac
index fc55be0..0e0c9ac 100644 (file)
@@ -124,8 +124,8 @@ public:
         : 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 @@ public:
 
 private:
     MemoryInstrumentationTestClient* m_client;
-    Vector<OwnPtr<InstrumentedPointerBase> > m_deferredInstrumentedPointers;
+    Vector<OwnPtr<WrapperBase> > m_deferredObjects;
 };
 
 class InstrumentationTestHelper : public InstrumentationTestImpl {
@@ -144,18 +144,18 @@ private:
     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, ptrVsRef)
     }
 }
 
-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 @@ TEST(MemoryInstrumentationTest, ownerTypePropagation)
 {
     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 @@ TEST(MemoryInstrumentationTest, doNotReportEdgeTwice)
 
     CountLinksFromInstrumentedObject client;
     InstrumentationTestImpl instrumentation(&client);
-    instrumentation.addRootObject(instance);
+    instrumentation.addRootObject(instance.get());
     EXPECT_EQ(1, client.linkCount());
 }
 } // namespace