Title: [124342] trunk/Source
Revision
124342
Author
[email protected]
Date
2012-08-01 10:43:13 -0700 (Wed, 01 Aug 2012)

Log Message

Unreviewed, rolling out r124334.
http://trac.webkit.org/changeset/124334
https://bugs.webkit.org/show_bug.cgi?id=92879

Broke MemoryInstrumentationTest.sizeOf from webkit_unit_tests
on Chromium canaries (Requested by apavlov1 on #webkit).

Patch by Sheriff Bot <[email protected]> on 2012-08-01

Source/WebCore:

* bindings/v8/ScriptProfiler.cpp:
(WebCore::ScriptProfiler::collectBindingMemoryInfo):
* dom/MemoryInstrumentation.h:
(WebCore::MemoryInstrumentation::addInstrumentedObject):
(MemoryInstrumentation):
(WebCore::MemoryInstrumentation::addInstrumentedObjectImpl):
* inspector/InspectorMemoryAgent.cpp:
(WebCore):
* inspector/MemoryInstrumentationImpl.h:
(MemoryInstrumentationImpl):
(WebCore::MemoryInstrumentationImpl::totalTypeSize):

Source/WebKit/chromium:

* WebKit.gypi:
* tests/MemoryInstrumentationTest.cpp: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124341 => 124342)


--- trunk/Source/WebCore/ChangeLog	2012-08-01 17:37:16 UTC (rev 124341)
+++ trunk/Source/WebCore/ChangeLog	2012-08-01 17:43:13 UTC (rev 124342)
@@ -1,3 +1,24 @@
+2012-08-01  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r124334.
+        http://trac.webkit.org/changeset/124334
+        https://bugs.webkit.org/show_bug.cgi?id=92879
+
+        Broke MemoryInstrumentationTest.sizeOf from webkit_unit_tests
+        on Chromium canaries (Requested by apavlov1 on #webkit).
+
+        * bindings/v8/ScriptProfiler.cpp:
+        (WebCore::ScriptProfiler::collectBindingMemoryInfo):
+        * dom/MemoryInstrumentation.h:
+        (WebCore::MemoryInstrumentation::addInstrumentedObject):
+        (MemoryInstrumentation):
+        (WebCore::MemoryInstrumentation::addInstrumentedObjectImpl):
+        * inspector/InspectorMemoryAgent.cpp:
+        (WebCore):
+        * inspector/MemoryInstrumentationImpl.h:
+        (MemoryInstrumentationImpl):
+        (WebCore::MemoryInstrumentationImpl::totalTypeSize):
+
 2012-08-01  Han Shen  <[email protected]>
 
         Fix gcc 4.7 compile warnings.

Modified: trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp (124341 => 124342)


--- trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp	2012-08-01 17:37:16 UTC (rev 124341)
+++ trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp	2012-08-01 17:43:13 UTC (rev 124342)
@@ -223,7 +223,7 @@
 void ScriptProfiler::collectBindingMemoryInfo(MemoryInstrumentation* instrumentation)
 {
     V8BindingPerIsolateData* data = ""
-    instrumentation->addRootObject(data);
+    instrumentation->addInstrumentedObject(data);
 }
 
 size_t ScriptProfiler::profilerSnapshotsSize()

Modified: trunk/Source/WebCore/dom/MemoryInstrumentation.h (124341 => 124342)


--- trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-08-01 17:37:16 UTC (rev 124341)
+++ trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-08-01 17:43:13 UTC (rev 124342)
@@ -54,10 +54,9 @@
         LastTypeEntry
     };
 
-    template <typename T> void addRootObject(const T& t)
+    template <typename T> void addInstrumentedObject(const T& t)
     {
-        addInstrumentedObject(t);
-        processDeferredInstrumentedPointers();
+        OwningTraits<T>::addInstrumentedObject(this, t);
     }
 
     template <typename Container> static size_t calculateContainerSize(const Container&, bool contentOnly = false);
@@ -69,12 +68,11 @@
         virtual void process(MemoryInstrumentation*) = 0;
     };
 
-private:
     virtual void countObjectSize(ObjectType, size_t) = 0;
     virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) = 0;
     virtual bool visited(const void*) = 0;
-    virtual void processDeferredInstrumentedPointers() = 0;
 
+private:
     template <typename T> friend class MemoryClassInfo;
     template <typename T> class InstrumentedPointer : public InstrumentedPointerBase {
     public:
@@ -90,7 +88,6 @@
         OwningTraits<T>::addObject(this, t, objectType);
     }
     void addString(const String&, ObjectType);
-    template <typename T> void addInstrumentedObject(const T& t) { OwningTraits<T>::addInstrumentedObject(this, t); }
     template <typename HashMapType> void addHashMap(const HashMapType&, ObjectType, bool contentOnly = false);
     template <typename HashSetType> void addHashSet(const HashSetType&, ObjectType, bool contentOnly = false);
     template <typename CollectionType> void addInstrumentedCollection(const CollectionType&, ObjectType, bool contentOnly = false);
@@ -125,8 +122,6 @@
     template <typename T> void addInstrumentedObjectImpl(const RefPtr<T>* const&, OwningType);
 
     template <typename T> void addObjectImpl(const T* const&, ObjectType, OwningType);
-    template <typename T> void addObjectImpl(const OwnPtr<T>* const&, ObjectType, OwningType);
-    template <typename T> void addObjectImpl(const RefPtr<T>* const&, ObjectType, OwningType);
 };
 
 class MemoryObjectInfo {
@@ -207,29 +202,17 @@
 }
 
 template <typename T>
-void MemoryInstrumentation::addInstrumentedObjectImpl(const OwnPtr<T>* const& object, OwningType)
+void MemoryInstrumentation::addInstrumentedObjectImpl(const OwnPtr<T>* const& object, OwningType owningType)
 {
-    addInstrumentedObjectImpl(object->get(), byPointer);
+    addInstrumentedObjectImpl(object->get(), owningType);
 }
 
 template <typename T>
-void MemoryInstrumentation::addInstrumentedObjectImpl(const RefPtr<T>* const& object, OwningType)
+void MemoryInstrumentation::addInstrumentedObjectImpl(const RefPtr<T>* const& object, OwningType owningType)
 {
-    addInstrumentedObjectImpl(object->get(), byPointer);
+    addInstrumentedObjectImpl(object->get(), owningType);
 }
 
-template <typename T>
-void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, ObjectType objectType, OwningType)
-{
-    addObjectImpl(object->get(), objectType, byPointer);
-}
-
-template <typename T>
-void MemoryInstrumentation::addObjectImpl(const RefPtr<T>* const& object, ObjectType objectType, OwningType)
-{
-    addObjectImpl(object->get(), objectType, byPointer);
-}
-
 // Link time guard for string members. They produce link error is a string is reported via addObject.
 template <> void MemoryInstrumentation::addObjectImpl<AtomicString>(const AtomicString* const&, MemoryInstrumentation::ObjectType, MemoryInstrumentation::OwningType);
 template <> void MemoryInstrumentation::addObjectImpl<String>(const String* const&, MemoryInstrumentation::ObjectType, MemoryInstrumentation::OwningType);

Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp (124341 => 124342)


--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp	2012-08-01 17:37:16 UTC (rev 124341)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp	2012-08-01 17:43:13 UTC (rev 124342)
@@ -443,6 +443,7 @@
 
 namespace {
 
+
 class DOMTreesIterator : public NodeWrapperVisitor {
 public:
     DOMTreesIterator(Page* page, VisitedObjects& visitedObjects)
@@ -456,17 +457,20 @@
         if (node->document() && node->document()->frame() && m_page != node->document()->frame()->page())
             return;
 
-        m_domMemoryUsage.addRootObject(node);
+        m_domMemoryUsage.addInstrumentedObject(node);
+        m_domMemoryUsage.processDeferredInstrumentedPointers();
     }
 
     void visitFrame(Frame* frame)
     {
-        m_domMemoryUsage.addRootObject(frame);
+        m_domMemoryUsage.addInstrumentedObject(frame);
+        m_domMemoryUsage.processDeferredInstrumentedPointers();
     }
 
     void visitBindings()
     {
         ScriptProfiler::collectBindingMemoryInfo(&m_domMemoryUsage);
+        m_domMemoryUsage.processDeferredInstrumentedPointers();
     }
 
     PassRefPtr<InspectorMemoryBlock> dumpStatistics(InspectorDataCounter* inspectorData)
@@ -475,14 +479,14 @@
 
         size_t totalSize = 0;
         for (int i = MemoryInstrumentation::Other; i < MemoryInstrumentation::LastTypeEntry; ++i)
-            totalSize += m_domMemoryUsage.totalSize(static_cast<MemoryInstrumentation::ObjectType>(i));
+            totalSize += m_domMemoryUsage.totalTypeSize(static_cast<MemoryInstrumentation::ObjectType>(i));
 
         RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > domChildren = TypeBuilder::Array<InspectorMemoryBlock>::create();
-        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::Other), MemoryBlockName::domTreeOther);
-        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::DOM), MemoryBlockName::domTreeDOM);
-        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::CSS), MemoryBlockName::domTreeCSS);
-        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::Binding), MemoryBlockName::domTreeBinding);
-        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalSize(MemoryInstrumentation::Loader), MemoryBlockName::domTreeLoader);
+        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalTypeSize(MemoryInstrumentation::Other), MemoryBlockName::domTreeOther);
+        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalTypeSize(MemoryInstrumentation::DOM), MemoryBlockName::domTreeDOM);
+        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalTypeSize(MemoryInstrumentation::CSS), MemoryBlockName::domTreeCSS);
+        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalTypeSize(MemoryInstrumentation::Binding), MemoryBlockName::domTreeBinding);
+        addMemoryBlockFor(domChildren.get(), m_domMemoryUsage.totalTypeSize(MemoryInstrumentation::Loader), MemoryBlockName::domTreeLoader);
 
         RefPtr<InspectorMemoryBlock> dom = InspectorMemoryBlock::create().setName(MemoryBlockName::dom);
         dom->setSize(totalSize);

Modified: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h (124341 => 124342)


--- trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h	2012-08-01 17:37:16 UTC (rev 124341)
+++ trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h	2012-08-01 17:43:13 UTC (rev 124342)
@@ -44,26 +44,18 @@
 public:
     explicit MemoryInstrumentationImpl(VisitedObjects&);
 
+    void processDeferredInstrumentedPointers();
     size_t selfSize() const;
-    size_t totalSize(ObjectType objectType) const
+    size_t totalTypeSize(ObjectType objectType)
     {
         ASSERT(objectType >= 0 && objectType < LastTypeEntry);
         return m_totalSizes[objectType];
     }
 
-    size_t reportedSizeForAllTypes() const
-    {
-        size_t size = 0;
-        for (int i = 0; i < LastTypeEntry; ++i)
-            size += m_totalSizes[i];
-        return size;
-    }
-
 private:
     virtual void countObjectSize(ObjectType, size_t) OVERRIDE;
     virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) OVERRIDE;
     virtual bool visited(const void*) OVERRIDE;
-    virtual void processDeferredInstrumentedPointers() OVERRIDE;
 
     size_t m_totalSizes[LastTypeEntry];
     VisitedObjects& m_visitedObjects;

Modified: trunk/Source/WebKit/chromium/ChangeLog (124341 => 124342)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-01 17:37:16 UTC (rev 124341)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-01 17:43:13 UTC (rev 124342)
@@ -1,3 +1,15 @@
+2012-08-01  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r124334.
+        http://trac.webkit.org/changeset/124334
+        https://bugs.webkit.org/show_bug.cgi?id=92879
+
+        Broke MemoryInstrumentationTest.sizeOf from webkit_unit_tests
+        on Chromium canaries (Requested by apavlov1 on #webkit).
+
+        * WebKit.gypi:
+        * tests/MemoryInstrumentationTest.cpp: Removed.
+
 2012-08-01  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: test native memory instrumentation code with help of unittests

Modified: trunk/Source/WebKit/chromium/WebKit.gypi (124341 => 124342)


--- trunk/Source/WebKit/chromium/WebKit.gypi	2012-08-01 17:37:16 UTC (rev 124341)
+++ trunk/Source/WebKit/chromium/WebKit.gypi	2012-08-01 17:43:13 UTC (rev 124342)
@@ -126,7 +126,6 @@
             'tests/LocalizedDateICUTest.cpp',
             'tests/LocalizedNumberICUTest.cpp',
             'tests/MemoryInfo.cpp',
-            'tests/MemoryInstrumentationTest.cpp',
             'tests/MockCCQuadCuller.h',
             'tests/OpaqueRectTrackingContentLayerDelegateTest.cpp',
             'tests/OpenTypeVerticalDataTest.cpp',

Deleted: trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp (124341 => 124342)


--- trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp	2012-08-01 17:37:16 UTC (rev 124341)
+++ trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp	2012-08-01 17:43:13 UTC (rev 124342)
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "MemoryInstrumentationImpl.h"
-
-#include <gtest/gtest.h>
-
-#include <wtf/HashSet.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-
-using namespace WebCore;
-
-namespace {
-
-class NotInstrumented {
-public:
-    char m_data[42];
-};
-
-class Instrumented : public RefCounted<Instrumented> {
-public:
-    Instrumented() : m_notInstrumented(new NotInstrumented) { }
-    virtual ~Instrumented() { delete m_notInstrumented; }
-
-    virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-    {
-        MemoryClassInfo<Instrumented> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
-        info.addMember(m_notInstrumented);
-    }
-    NotInstrumented* m_notInstrumented;
-};
-
-TEST(MemoryInstrumentationTest, sizeOf)
-{
-    VisitedObjects visitedObjects;
-    MemoryInstrumentationImpl impl(visitedObjects);
-    Instrumented instrumented;
-    impl.addRootObject(instrumented);
-    EXPECT_EQ(sizeof(NotInstrumented), impl.reportedSizeForAllTypes());
-    EXPECT_EQ(2, visitedObjects.size());
-}
-
-TEST(MemoryInstrumentationTest, nullCheck)
-{
-    VisitedObjects visitedObjects;
-    MemoryInstrumentationImpl impl(visitedObjects);
-    Instrumented* instrumented = 0;
-    impl.addRootObject(instrumented);
-    EXPECT_EQ(0u, impl.reportedSizeForAllTypes());
-    EXPECT_EQ(0, visitedObjects.size());
-}
-
-TEST(MemoryInstrumentationTest, ptrVsRef)
-{
-    {
-        VisitedObjects visitedObjects;
-        MemoryInstrumentationImpl impl(visitedObjects);
-        Instrumented* instrumented = adoptRef(new Instrumented).leakRef();
-        impl.addRootObject(instrumented);
-        delete instrumented;
-        EXPECT_EQ(sizeof(Instrumented) + sizeof(NotInstrumented), impl.reportedSizeForAllTypes());
-        EXPECT_EQ(2, visitedObjects.size());
-    }
-    {
-        VisitedObjects visitedObjects;
-        MemoryInstrumentationImpl impl(visitedObjects);
-        Instrumented instrumented;
-        impl.addRootObject(instrumented);
-        EXPECT_EQ(sizeof(NotInstrumented), impl.reportedSizeForAllTypes());
-        EXPECT_EQ(2, visitedObjects.size());
-    }
-}
-
-TEST(MemoryInstrumentationTest, ownPtr)
-{
-    VisitedObjects visitedObjects;
-    MemoryInstrumentationImpl impl(visitedObjects);
-    OwnPtr<Instrumented> instrumented(adoptPtr(new Instrumented));
-    impl.addRootObject(instrumented);
-    EXPECT_EQ(sizeof(Instrumented) + sizeof(NotInstrumented), impl.reportedSizeForAllTypes());
-    EXPECT_EQ(2, visitedObjects.size());
-}
-
-TEST(MemoryInstrumentationTest, refPtr)
-{
-    VisitedObjects visitedObjects;
-    MemoryInstrumentationImpl impl(visitedObjects);
-    RefPtr<Instrumented> instrumented(adoptRef(new Instrumented));
-    impl.addRootObject(instrumented);
-    EXPECT_EQ(sizeof(Instrumented) + sizeof(NotInstrumented), impl.reportedSizeForAllTypes());
-    EXPECT_EQ(2, visitedObjects.size());
-}
-
-class InstrumentedWithOwnPtr : public Instrumented {
-public:
-    InstrumentedWithOwnPtr() : m_notInstrumentedOwnPtr(adoptPtr(new NotInstrumented)) { }
-
-    virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-    {
-        MemoryClassInfo<InstrumentedWithOwnPtr> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
-        info.visitBaseClass<Instrumented>(this);
-        info.addMember(m_notInstrumentedOwnPtr);
-    }
-    OwnPtr<NotInstrumented> m_notInstrumentedOwnPtr;
-};
-
-TEST(MemoryInstrumentationTest, ownPtrNotInstrumented)
-{
-    VisitedObjects visitedObjects;
-    MemoryInstrumentationImpl impl(visitedObjects);
-    InstrumentedWithOwnPtr instrumentedWithOwnPtr;
-    impl.addRootObject(instrumentedWithOwnPtr);
-    EXPECT_EQ(2 * sizeof(NotInstrumented), impl.reportedSizeForAllTypes());
-    EXPECT_EQ(3, visitedObjects.size());
-}
-
-} // namespace
-
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to