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 31441f1f08e99b1af055122b42ff52ce607fb0b2..a13706d96c705c7d6760dc144d6c7e338542a8a7 100644 |
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h |
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h |
@@ -572,6 +572,33 @@ struct NeedsTracing<ListHashSetNode<T, blink::HeapListHashSetAllocator<T, inline |
static const bool value = true; |
}; |
+template<typename T> struct HashTraits<blink::CrossThreadPersistent<T>> : SimpleClassHashTraits<blink::CrossThreadPersistent<T>> { |
+ STATIC_ONLY(HashTraits); |
+ // FIXME: 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. |
+ // FIXME: Implement proper const'ness for iterator types. Requires support |
+ // in the marking Visitor. |
+ using PeekInType = T*; |
+ using PassInType = T*; |
+ using IteratorGetType = blink::Member<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; } |
+ // FIXME: 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 |