Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: third_party/WebKit/Source/platform/heap/HeapTest.cpp

Issue 1465083002: Add unit test for non-leftmost GC mixin instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove temporary, but broken isHeapObjectAlive() testing Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/HeapTest.cpp
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
index 071b252ccef1f31554f9bc528b1586ce8d199117..d75c36deb5669fb103b82a34dd69ae696702640a 100644
--- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -4596,6 +4596,25 @@ public:
Member<IntWrapper> m_obj;
};
+class DerivedMultipleMixins : public MultipleMixins {
+public:
+ DerivedMultipleMixins() : m_obj(IntWrapper::create(103)) { }
+
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ s_traceCalled++;
+ visitor->trace(m_obj);
+ MultipleMixins::trace(visitor);
+ }
+
+ static int s_traceCalled;
+
+private:
+ Member<IntWrapper> m_obj;
+};
+
+int DerivedMultipleMixins::s_traceCalled = 0;
+
static const bool s_isMixinTrue = IsGarbageCollectedMixin<MultipleMixins>::value;
static const bool s_isMixinFalse = IsGarbageCollectedMixin<IntWrapper>::value;
@@ -4621,6 +4640,29 @@ TEST(HeapTest, MultipleMixins)
EXPECT_EQ(3, IntWrapper::s_destructorCalls);
}
+TEST(HeapTest, DerivedMultipleMixins)
+{
+ clearOutOldGarbage();
+ IntWrapper::s_destructorCalls = 0;
+ DerivedMultipleMixins::s_traceCalled = 0;
+
+ DerivedMultipleMixins* obj = new DerivedMultipleMixins();
+ {
+ Persistent<MixinA> a = obj;
+ preciselyCollectGarbage();
+ EXPECT_EQ(0, IntWrapper::s_destructorCalls);
+ EXPECT_EQ(1, DerivedMultipleMixins::s_traceCalled);
+ }
+ {
+ Persistent<MixinB> b = obj;
+ preciselyCollectGarbage();
+ EXPECT_EQ(0, IntWrapper::s_destructorCalls);
+ EXPECT_EQ(2, DerivedMultipleMixins::s_traceCalled);
+ }
+ preciselyCollectGarbage();
+ EXPECT_EQ(4, IntWrapper::s_destructorCalls);
+}
+
class GCParkingThreadTester {
public:
static void test()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698