OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "platform/ThreadSafeFunctional.h" | 31 #include "platform/ThreadSafeFunctional.h" |
32 #include "platform/heap/Handle.h" | 32 #include "platform/heap/Handle.h" |
33 #include "platform/heap/Heap.h" | 33 #include "platform/heap/Heap.h" |
34 #include "platform/heap/HeapLinkedStack.h" | 34 #include "platform/heap/HeapLinkedStack.h" |
35 #include "platform/heap/HeapTerminatedArrayBuilder.h" | 35 #include "platform/heap/HeapTerminatedArrayBuilder.h" |
36 #include "platform/heap/SafePoint.h" | 36 #include "platform/heap/SafePoint.h" |
| 37 #include "platform/heap/SelfKeepAlive.h" |
37 #include "platform/heap/ThreadState.h" | 38 #include "platform/heap/ThreadState.h" |
38 #include "platform/heap/Visitor.h" | 39 #include "platform/heap/Visitor.h" |
39 #include "platform/testing/UnitTestHelpers.h" | 40 #include "platform/testing/UnitTestHelpers.h" |
40 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
41 #include "public/platform/WebTaskRunner.h" | 42 #include "public/platform/WebTaskRunner.h" |
42 #include "public/platform/WebTraceLocation.h" | 43 #include "public/platform/WebTraceLocation.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
44 #include "wtf/HashTraits.h" | 45 #include "wtf/HashTraits.h" |
45 #include "wtf/LinkedHashSet.h" | 46 #include "wtf/LinkedHashSet.h" |
46 | 47 |
(...skipping 6604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6651 weakWrapper = WithWeakConstObject::create(wrapper); | 6652 weakWrapper = WithWeakConstObject::create(wrapper); |
6652 conservativelyCollectGarbage(); | 6653 conservativelyCollectGarbage(); |
6653 EXPECT_EQ(wrapper, weakWrapper->value()); | 6654 EXPECT_EQ(wrapper, weakWrapper->value()); |
6654 // Stub out any stack reference. | 6655 // Stub out any stack reference. |
6655 wrapper = nullptr; | 6656 wrapper = nullptr; |
6656 } | 6657 } |
6657 preciselyCollectGarbage(); | 6658 preciselyCollectGarbage(); |
6658 EXPECT_EQ(nullptr, weakWrapper->value()); | 6659 EXPECT_EQ(nullptr, weakWrapper->value()); |
6659 } | 6660 } |
6660 | 6661 |
| 6662 TEST(HeapTest, IsGarbageCollected) |
| 6663 { |
| 6664 // Static sanity checks covering the correct operation of |
| 6665 // IsGarbageCollectedType<>. |
| 6666 |
| 6667 static_assert(WTF::IsGarbageCollectedType<SimpleObject>::value, "GarbageColl
ected<>"); |
| 6668 static_assert(WTF::IsGarbageCollectedType<const SimpleObject>::value, "const
GarbageCollected<>"); |
| 6669 static_assert(WTF::IsGarbageCollectedType<IntWrapper>::value, "GarbageCollec
tedFinalized<>"); |
| 6670 static_assert(WTF::IsGarbageCollectedType<GarbageCollectedMixin>::value, "Ga
rbageCollectedMixin"); |
| 6671 static_assert(WTF::IsGarbageCollectedType<const GarbageCollectedMixin>::valu
e, "const GarbageCollectedMixin"); |
| 6672 static_assert(WTF::IsGarbageCollectedType<UseMixin>::value, "GarbageCollecte
dMixin"); |
| 6673 static_assert(WTF::IsGarbageCollectedType<const UseMixin>::value, "GarbageCo
llectedMixin"); |
| 6674 static_assert(WTF::IsGarbageCollectedType<MultipleMixins>::value, "GarbageCo
llectedMixin"); |
| 6675 static_assert(WTF::IsGarbageCollectedType<HeapHashSet<Member<IntWrapper>>>::
value, "HeapHashSet"); |
| 6676 static_assert(WTF::IsGarbageCollectedType<HeapLinkedHashSet<Member<IntWrappe
r>>>::value, "HeapLinkedHashSet"); |
| 6677 static_assert(WTF::IsGarbageCollectedType<HeapListHashSet<Member<IntWrapper>
>>::value, "HeapListHashSet"); |
| 6678 static_assert(WTF::IsGarbageCollectedType<HeapHashCountedSet<Member<IntWrapp
er>>>::value, "HeapHashCountedSet"); |
| 6679 static_assert(WTF::IsGarbageCollectedType<HeapHashMap<int, Member<IntWrapper
>>>::value, "HeapHashMap"); |
| 6680 static_assert(WTF::IsGarbageCollectedType<HeapVector<Member<IntWrapper>>>::v
alue, "HeapVector"); |
| 6681 static_assert(WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::va
lue, "HeapDeque"); |
| 6682 static_assert(WTF::IsGarbageCollectedType<HeapTerminatedArray<Member<IntWrap
per>>>::value, "HeapTerminatedArray"); |
| 6683 } |
| 6684 |
6661 } // namespace blink | 6685 } // namespace blink |
OLD | NEW |