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

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

Issue 1504013004: GC plugin: remove mixin trace override restriction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.h » ('j') | 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 d75c36deb5669fb103b82a34dd69ae696702640a..02fa6ee69b75c3ccc330171f678ce73645bfc95f 100644
--- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -4568,11 +4568,17 @@ public:
MixinA() : m_obj(IntWrapper::create(100)) { }
DEFINE_INLINE_VIRTUAL_TRACE()
{
+ s_traceCount++;
visitor->trace(m_obj);
}
+
+ static int s_traceCount;
+
Member<IntWrapper> m_obj;
};
+int MixinA::s_traceCount = 0;
+
class MixinB : public GarbageCollectedMixin {
public:
MixinB() : m_obj(IntWrapper::create(101)) { }
@@ -4663,6 +4669,35 @@ TEST(HeapTest, DerivedMultipleMixins)
EXPECT_EQ(4, IntWrapper::s_destructorCalls);
}
+class MixinInstanceWithoutTrace : public GarbageCollected<MixinInstanceWithoutTrace>, public MixinA {
+ USING_GARBAGE_COLLECTED_MIXIN(MixinInstanceWithoutTrace);
+public:
+ MixinInstanceWithoutTrace()
+ {
+ }
+};
+
+TEST(HeapTest, MixinInstanceWithoutTrace)
+{
+ // Verify that a mixin instance without any traceable
+ // references inherits the mixin's trace implementation.
+ clearOutOldGarbage();
+ MixinA::s_traceCount = 0;
+ MixinInstanceWithoutTrace* obj = new MixinInstanceWithoutTrace();
+ {
+ Persistent<MixinA> a = obj;
+ preciselyCollectGarbage();
+ EXPECT_EQ(1, MixinA::s_traceCount);
+ }
+ {
+ Persistent<MixinInstanceWithoutTrace> b = obj;
+ preciselyCollectGarbage();
+ EXPECT_EQ(2, MixinA::s_traceCount);
+ }
+ preciselyCollectGarbage();
+ EXPECT_EQ(2, MixinA::s_traceCount);
+}
+
class GCParkingThreadTester {
public:
static void test()
« no previous file with comments | « no previous file | tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698