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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 6640 matching lines...) Expand 10 before | Expand all | Expand 10 after
6651 weakWrapper = WithWeakConstObject::create(wrapper); 6651 weakWrapper = WithWeakConstObject::create(wrapper);
6652 conservativelyCollectGarbage(); 6652 conservativelyCollectGarbage();
6653 EXPECT_EQ(wrapper, weakWrapper->value()); 6653 EXPECT_EQ(wrapper, weakWrapper->value());
6654 // Stub out any stack reference. 6654 // Stub out any stack reference.
6655 wrapper = nullptr; 6655 wrapper = nullptr;
6656 } 6656 }
6657 preciselyCollectGarbage(); 6657 preciselyCollectGarbage();
6658 EXPECT_EQ(nullptr, weakWrapper->value()); 6658 EXPECT_EQ(nullptr, weakWrapper->value());
6659 } 6659 }
6660 6660
6661 class EmptyMixin : public GarbageCollectedMixin {};
6662 class UseMixinFromLeftmostInherited : public UseMixin, public EmptyMixin {
6663 public:
6664 ~UseMixinFromLeftmostInherited() { }
6665 };
6666
6667 TEST(HeapTest, IsGarbageCollected)
6668 {
6669 // Static sanity checks covering the correct operation of
6670 // IsGarbageCollectedType<>.
6671
6672 static_assert(WTF::IsGarbageCollectedType<SimpleObject>::value, "GarbageColl ected<>");
6673 static_assert(WTF::IsGarbageCollectedType<const SimpleObject>::value, "const GarbageCollected<>");
6674 static_assert(WTF::IsGarbageCollectedType<IntWrapper>::value, "GarbageCollec tedFinalized<>");
6675 static_assert(WTF::IsGarbageCollectedType<GarbageCollectedMixin>::value, "Ga rbageCollectedMixin");
6676 static_assert(WTF::IsGarbageCollectedType<const GarbageCollectedMixin>::valu e, "const GarbageCollectedMixin");
6677 static_assert(WTF::IsGarbageCollectedType<UseMixin>::value, "GarbageCollecte dMixin instance");
6678 static_assert(WTF::IsGarbageCollectedType<const UseMixin>::value, "const Gar bageCollectedMixin instance");
6679 static_assert(WTF::IsGarbageCollectedType<UseMixinFromLeftmostInherited>::va lue, "GarbageCollectedMixin derived instance");
6680 static_assert(WTF::IsGarbageCollectedType<MultipleMixins>::value, "GarbageCo llectedMixin");
6681
6682 static_assert(WTF::IsGarbageCollectedType<HeapHashSet<Member<IntWrapper>>>:: value, "HeapHashSet");
6683 static_assert(WTF::IsGarbageCollectedType<HeapLinkedHashSet<Member<IntWrappe r>>>::value, "HeapLinkedHashSet");
6684 static_assert(WTF::IsGarbageCollectedType<HeapListHashSet<Member<IntWrapper> >>::value, "HeapListHashSet");
6685 static_assert(WTF::IsGarbageCollectedType<HeapHashCountedSet<Member<IntWrapp er>>>::value, "HeapHashCountedSet");
6686 static_assert(WTF::IsGarbageCollectedType<HeapHashMap<int, Member<IntWrapper >>>::value, "HeapHashMap");
6687 static_assert(WTF::IsGarbageCollectedType<HeapVector<Member<IntWrapper>>>::v alue, "HeapVector");
6688 static_assert(WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::va lue, "HeapDeque");
6689 static_assert(WTF::IsGarbageCollectedType<HeapTerminatedArray<Member<IntWrap per>>>::value, "HeapTerminatedArray");
6690 }
6691
6661 } // namespace blink 6692 } // namespace blink
OLDNEW
« 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