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

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

Issue 1999343002: Unify and provide one IsGarbageCollectedType<T> implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test Created 4 years, 7 months 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
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 5adcc2bb7161094a3f38d5e17c318a8c8f9d3fe5..ebea3af519972e85e6ec37cce3fd2cd417e1a44a 100644
--- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -6658,4 +6658,35 @@ TEST(HeapTest, TestWeakConstObject)
EXPECT_EQ(nullptr, weakWrapper->value());
}
+class EmptyMixin : public GarbageCollectedMixin {};
+class UseMixinFromLeftmostInherited : public UseMixin, public EmptyMixin {
+public:
+ ~UseMixinFromLeftmostInherited() { }
+};
+
+TEST(HeapTest, IsGarbageCollected)
+{
+ // Static sanity checks covering the correct operation of
+ // IsGarbageCollectedType<>.
+
+ static_assert(WTF::IsGarbageCollectedType<SimpleObject>::value, "GarbageCollected<>");
+ static_assert(WTF::IsGarbageCollectedType<const SimpleObject>::value, "const GarbageCollected<>");
+ static_assert(WTF::IsGarbageCollectedType<IntWrapper>::value, "GarbageCollectedFinalized<>");
+ static_assert(WTF::IsGarbageCollectedType<GarbageCollectedMixin>::value, "GarbageCollectedMixin");
+ static_assert(WTF::IsGarbageCollectedType<const GarbageCollectedMixin>::value, "const GarbageCollectedMixin");
+ static_assert(WTF::IsGarbageCollectedType<UseMixin>::value, "GarbageCollectedMixin instance");
+ static_assert(WTF::IsGarbageCollectedType<const UseMixin>::value, "const GarbageCollectedMixin instance");
+ static_assert(WTF::IsGarbageCollectedType<UseMixinFromLeftmostInherited>::value, "GarbageCollectedMixin derived instance");
+ static_assert(WTF::IsGarbageCollectedType<MultipleMixins>::value, "GarbageCollectedMixin");
+
+ static_assert(WTF::IsGarbageCollectedType<HeapHashSet<Member<IntWrapper>>>::value, "HeapHashSet");
+ static_assert(WTF::IsGarbageCollectedType<HeapLinkedHashSet<Member<IntWrapper>>>::value, "HeapLinkedHashSet");
+ static_assert(WTF::IsGarbageCollectedType<HeapListHashSet<Member<IntWrapper>>>::value, "HeapListHashSet");
+ static_assert(WTF::IsGarbageCollectedType<HeapHashCountedSet<Member<IntWrapper>>>::value, "HeapHashCountedSet");
+ static_assert(WTF::IsGarbageCollectedType<HeapHashMap<int, Member<IntWrapper>>>::value, "HeapHashMap");
+ static_assert(WTF::IsGarbageCollectedType<HeapVector<Member<IntWrapper>>>::value, "HeapVector");
+ static_assert(WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value, "HeapDeque");
+ static_assert(WTF::IsGarbageCollectedType<HeapTerminatedArray<Member<IntWrapper>>>::value, "HeapTerminatedArray");
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapTerminatedArray.h ('k') | third_party/WebKit/Source/wtf/Functional.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698