| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef HeapAllocator_h | 5 #ifndef HeapAllocator_h |
| 6 #define HeapAllocator_h | 6 #define HeapAllocator_h |
| 7 | 7 |
| 8 #include "platform/heap/Heap.h" | 8 #include "platform/heap/Heap.h" |
| 9 #include "platform/heap/TraceTraits.h" | 9 #include "platform/heap/TraceTraits.h" |
| 10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| 11 #include "wtf/Assertions.h" | 11 #include "wtf/Assertions.h" |
| 12 #include "wtf/Deque.h" | 12 #include "wtf/Deque.h" |
| 13 #include "wtf/HashCountedSet.h" | 13 #include "wtf/HashCountedSet.h" |
| 14 #include "wtf/HashMap.h" | 14 #include "wtf/HashMap.h" |
| 15 #include "wtf/HashSet.h" | 15 #include "wtf/HashSet.h" |
| 16 #include "wtf/HashTable.h" | 16 #include "wtf/HashTable.h" |
| 17 #include "wtf/LinkedHashSet.h" | 17 #include "wtf/LinkedHashSet.h" |
| 18 #include "wtf/ListHashSet.h" | 18 #include "wtf/ListHashSet.h" |
| 19 #include "wtf/TypeTraits.h" | 19 #include "wtf/TypeTraits.h" |
| 20 #include "wtf/Vector.h" | 20 #include "wtf/Vector.h" |
| 21 | 21 |
| 22 namespace blink { | 22 namespace blink { |
| 23 | 23 |
| 24 template<typename T, typename Traits = WTF::VectorTraits<T>> class HeapVectorBac
king { | 24 template<typename T, typename Traits = WTF::VectorTraits<T>> class HeapVectorBac
king { |
| 25 DISALLOW_NEW(); | 25 DISALLOW_NEW(); |
| 26 IS_GARBAGE_COLLECTED_TYPE(); |
| 26 public: | 27 public: |
| 27 static void finalize(void* pointer); | 28 static void finalize(void* pointer); |
| 28 void finalizeGarbageCollectedObject() { finalize(this); } | 29 void finalizeGarbageCollectedObject() { finalize(this); } |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 template<typename Table> class HeapHashTableBacking { | 32 template<typename Table> class HeapHashTableBacking { |
| 32 DISALLOW_NEW(); | 33 DISALLOW_NEW(); |
| 34 IS_GARBAGE_COLLECTED_TYPE(); |
| 33 public: | 35 public: |
| 34 static void finalize(void* pointer); | 36 static void finalize(void* pointer); |
| 35 void finalizeGarbageCollectedObject() { finalize(this); } | 37 void finalizeGarbageCollectedObject() { finalize(this); } |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 // This is a static-only class used as a trait on collections to make them heap | 40 // This is a static-only class used as a trait on collections to make them heap |
| 39 // allocated. However see also HeapListHashSetAllocator. | 41 // allocated. However see also HeapListHashSetAllocator. |
| 40 class PLATFORM_EXPORT HeapAllocator { | 42 class PLATFORM_EXPORT HeapAllocator { |
| 41 STATIC_ONLY(HeapAllocator); | 43 STATIC_ONLY(HeapAllocator); |
| 42 public: | 44 public: |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 template<typename T, size_t inlineCapacity> | 539 template<typename T, size_t inlineCapacity> |
| 538 struct NeedsTracing<ListHashSetNode<T, blink::HeapListHashSetAllocator<T, inline
Capacity>> *> { | 540 struct NeedsTracing<ListHashSetNode<T, blink::HeapListHashSetAllocator<T, inline
Capacity>> *> { |
| 539 STATIC_ONLY(NeedsTracing); | 541 STATIC_ONLY(NeedsTracing); |
| 540 static_assert(sizeof(T), "T must be fully defined"); | 542 static_assert(sizeof(T), "T must be fully defined"); |
| 541 // All heap allocated node pointers need visiting to keep the nodes alive, | 543 // All heap allocated node pointers need visiting to keep the nodes alive, |
| 542 // regardless of whether they contain pointers to other heap allocated | 544 // regardless of whether they contain pointers to other heap allocated |
| 543 // objects. | 545 // objects. |
| 544 static const bool value = true; | 546 static const bool value = true; |
| 545 }; | 547 }; |
| 546 | 548 |
| 549 template<typename T, size_t inlineCapacity> |
| 550 struct IsGarbageCollectedType<ListHashSetNode<T, blink::HeapListHashSetAllocator
<T, inlineCapacity>>> { |
| 551 static const bool value = true; |
| 552 }; |
| 553 |
| 547 } // namespace WTF | 554 } // namespace WTF |
| 548 | 555 |
| 549 #endif | 556 #endif |
| OLD | NEW |