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

Unified Diff: third_party/WebKit/Source/platform/heap/HeapAllocator.h

Issue 2007283002: Allow CrossThreadPersistent in collections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
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..d6204e7fe75fd5e9453d5b83d2d6b8988956c799 100644
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
@@ -422,6 +422,14 @@ template <typename T> struct VectorTraits<blink::UntracedMember<T>> : VectorTrai
static const bool canMoveWithMemcpy = true;
};
+template <typename T> struct VectorTraits<blink::CrossThreadPersistent<T>> : VectorTraitsBase<blink::CrossThreadPersistent<T>> {
sof 2016/05/25 13:26:39 Why is this needed for CrossThreadPersistent, but
keishi 2016/05/26 04:23:13 I need this to do typedef Deque<CrossThreadPersist
keishi 2016/05/26 04:45:43 So I don't need support for Persistent right now.
sof 2016/05/26 05:14:05 That would my preference.
+ STATIC_ONLY(VectorTraits);
+ static const bool needsDestruction = true;
+ static const bool canInitializeWithMemset = false;
sof 2016/05/25 13:26:39 This can be |true|.
keishi 2016/05/26 04:23:13 Done.
+ static const bool canClearUnusedSlotsWithMemset = false;
+ static const bool canMoveWithMemcpy = false;
sof 2016/05/25 13:26:39 Wouldn't |true| work out?
keishi 2016/05/26 04:23:13 Done.
+};
+
template <typename T> struct VectorTraits<blink::HeapVector<T, 0>> : VectorTraitsBase<blink::HeapVector<T, 0>> {
STATIC_ONLY(VectorTraits);
static const bool needsDestruction = false;
@@ -551,6 +559,33 @@ struct IsGarbageCollectedType<ListHashSetNode<T, blink::HeapListHashSetAllocator
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
sof 2016/05/25 13:26:39 nit: shouldn't be adding new FIXMEs by now.
keishi 2016/05/26 04:23:13 Done.
+ // 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>*;
sof 2016/05/25 13:26:39 why Member<> ?
keishi 2016/05/26 04:23:13 Done.
+ 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

Powered by Google App Engine
This is Rietveld 408576698