Chromium Code Reviews| Index: third_party/WebKit/Source/platform/heap/HeapAllocator.h |
| diff --git a/third_party/WebKit/Source/platform/heap/HeapAllocator.h b/third_party/WebKit/Source/platform/heap/HeapAllocator.h |
| index 40e0d381d90225e8c4bdae2271e9e72bf48ae07b..dc8fa7e00b188cfb302bea945fcadcbdbfda2aba 100644 |
| --- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h |
| +++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h |
| @@ -6,6 +6,7 @@ |
| #define HeapAllocator_h |
| #include "platform/heap/Heap.h" |
| +#include "platform/heap/Persistent.h" |
| #include "platform/heap/TraceTraits.h" |
| #include "wtf/Allocator.h" |
| #include "wtf/Assertions.h" |
| @@ -422,6 +423,16 @@ template <typename T> struct VectorTraits<blink::UntracedMember<T>> : VectorTrai |
| static const bool canMoveWithMemcpy = true; |
| }; |
| +template <typename T, blink::WeaknessPersistentConfiguration weaknessConfiguration, blink::CrossThreadnessPersistentConfiguration crossThreadnessConfiguration> |
| +struct VectorTraits<blink::PersistentBase<T, weaknessConfiguration, crossThreadnessConfiguration>> |
| + : VectorTraitsBase<blink::PersistentBase<T, weaknessConfiguration, crossThreadnessConfiguration>> { |
| + STATIC_ONLY(VectorTraits); |
| + static const bool needsDestruction = true; |
| + static const bool canInitializeWithMemset = true; |
| + static const bool canClearUnusedSlotsWithMemset = false; |
| + static const bool canMoveWithMemcpy = true; |
| +}; |
| + |
| template <typename T> struct VectorTraits<blink::HeapVector<T, 0>> : VectorTraitsBase<blink::HeapVector<T, 0>> { |
| STATIC_ONLY(VectorTraits); |
| static const bool needsDestruction = false; |
| @@ -551,6 +562,33 @@ struct IsGarbageCollectedType<ListHashSetNode<T, blink::HeapListHashSetAllocator |
| static const bool value = true; |
| }; |
| +template<typename T> struct HashTraits<blink::CrossThreadPersistent<T>> : SimpleClassHashTraits<blink::CrossThreadPersistent<T>> { |
|
sof
2016/05/26 09:41:44
Can we make this be over PersistentBase<> also, or
keishi
2016/05/26 11:38:17
I tried PersistentBase but it didn't work so had t
|
| + STATIC_ONLY(HashTraits); |
| + // TODO: The distinction between PeekInType and PassInType is there for |
| + // the sake of the reference counting handles. When they are gone the two |
| + // types can be merged into PassInType. |
| + // TODO: Implement proper const'ness for iterator types. Requires support |
| + // in the marking Visitor. |
| + using PeekInType = T*; |
| + using PassInType = T*; |
| + using IteratorGetType = blink::CrossThreadPersistent<T>*; |
| + using IteratorConstGetType = const blink::CrossThreadPersistent<T>*; |
| + using IteratorReferenceType = blink::CrossThreadPersistent<T>&; |
| + using IteratorConstReferenceType = const blink::CrossThreadPersistent<T>&; |
| + static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { return *x; } |
| + static IteratorConstReferenceType getToReferenceConstConversion(IteratorConstGetType x) { return *x; } |
| + // TODO: Similarly, there is no need for a distinction between PeekOutType |
| + // and PassOutType without reference counting. |
| + using PeekOutType = T*; |
| + using PassOutType = T*; |
| + |
| + template<typename U> |
| + static void store(const U& value, blink::CrossThreadPersistent<T>& storage) { storage = value; } |
| + |
| + static PeekOutType peek(const blink::CrossThreadPersistent<T>& value) { return value; } |
| + static PassOutType passOut(const blink::CrossThreadPersistent<T>& value) { return value; } |
| +}; |
| + |
| } // namespace WTF |
| #endif |