diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-22 15:40:17 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-22 15:40:17 +0200 |
commit | 43a42f108af6bcbd91f2672731c3047c26213af1 (patch) | |
tree | 7fa092e5f5d873c72f2486a70e26be26f7a38bec /Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp | |
parent | d9cf437c840c6eb7417bdd97e6c40979255d3158 (diff) | |
download | qtwebkit-43a42f108af6bcbd91f2672731c3047c26213af1.tar.gz |
Imported WebKit commit 302e7806bff028bd1167a1ec7c86a1ee00ecfb49 (http://svn.webkit.org/repository/webkit/trunk@132067)
New snapshot that fixes build without QtWidgets
Diffstat (limited to 'Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp')
-rw-r--r-- | Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp b/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp index 7847d7d26..c6368bf3f 100644 --- a/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp +++ b/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp @@ -95,7 +95,7 @@ public: private: class Client : public WTF::MemoryInstrumentationClient { public: - virtual void countObjectSize(MemoryObjectType objectType, size_t size) + virtual void countObjectSize(const void*, MemoryObjectType objectType, size_t size) { TypeToSizeMap::AddResult result = m_totalSizes.add(objectType, size); if (!result.isNewEntry) @@ -734,5 +734,28 @@ TEST(MemoryInstrumentationTest, arrayBuffer) EXPECT_EQ(2u, helper.visitedObjects()); } +class ClassWithTwoAncestors : public NotInstrumented, public Instrumented { +public: + virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const + { + MemoryClassInfo info(memoryObjectInfo, this, TestType); + } +}; + + +TEST(MemoryInstrumentationTest, instrumentedWithMultipleAncestors) +{ + InstrumentationTestHelper helper; + OwnPtr<ClassWithTwoAncestors> instance = adoptPtr(new ClassWithTwoAncestors()); + ClassWithTwoAncestors* descendantPointer = instance.get(); + InstrumentedOwner<ClassWithTwoAncestors*> descendantPointerOwner(descendantPointer); + Instrumented* ancestorPointer = descendantPointer; + InstrumentedOwner<Instrumented*> ancestorPointerOwner(ancestorPointer); + helper.addRootObject(descendantPointerOwner); + helper.addRootObject(ancestorPointerOwner); + EXPECT_EQ(sizeof(ClassWithTwoAncestors), helper.reportedSizeForAllTypes()); + EXPECT_EQ(1u, helper.visitedObjects()); +} + } // namespace |