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

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

Issue 1598103003: Migrate Handle.h WTF decls closer to their corresponding definitions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Handle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ea42c891e7969af168895193838850052a23d199..aaeef621abcbb11ea6d807ee1a2c768a9656302c 100644
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
@@ -393,4 +393,155 @@ public:
} // namespace blink
+namespace WTF {
+
+template <typename T> struct VectorTraits<blink::Member<T>> : VectorTraitsBase<blink::Member<T>> {
+ static const bool needsDestruction = false;
+ static const bool canInitializeWithMemset = true;
+ static const bool canClearUnusedSlotsWithMemset = true;
+ static const bool canMoveWithMemcpy = true;
+};
+
+template <typename T> struct VectorTraits<blink::WeakMember<T>> : VectorTraitsBase<blink::WeakMember<T>> {
+ static const bool needsDestruction = false;
+ static const bool canInitializeWithMemset = true;
+ static const bool canClearUnusedSlotsWithMemset = true;
+ static const bool canMoveWithMemcpy = true;
+};
+
+template <typename T> struct VectorTraits<blink::UntracedMember<T>> : VectorTraitsBase<blink::UntracedMember<T>> {
+ static const bool needsDestruction = false;
+ static const bool canInitializeWithMemset = true;
+ static const bool canClearUnusedSlotsWithMemset = true;
+ static const bool canMoveWithMemcpy = true;
+};
+
+template <typename T> struct VectorTraits<blink::HeapVector<T, 0>> : VectorTraitsBase<blink::HeapVector<T, 0>> {
+ static const bool needsDestruction = false;
+ static const bool canInitializeWithMemset = true;
+ static const bool canClearUnusedSlotsWithMemset = true;
+ static const bool canMoveWithMemcpy = true;
+};
+
+template <typename T> struct VectorTraits<blink::HeapDeque<T, 0>> : VectorTraitsBase<blink::HeapDeque<T, 0>> {
+ static const bool needsDestruction = false;
+ static const bool canInitializeWithMemset = true;
+ static const bool canClearUnusedSlotsWithMemset = true;
+ static const bool canMoveWithMemcpy = true;
+};
+
+template <typename T, size_t inlineCapacity> struct VectorTraits<blink::HeapVector<T, inlineCapacity>> : VectorTraitsBase<blink::HeapVector<T, inlineCapacity>> {
+ static const bool needsDestruction = VectorTraits<T>::needsDestruction;
+ static const bool canInitializeWithMemset = VectorTraits<T>::canInitializeWithMemset;
+ static const bool canClearUnusedSlotsWithMemset = VectorTraits<T>::canClearUnusedSlotsWithMemset;
+ static const bool canMoveWithMemcpy = VectorTraits<T>::canMoveWithMemcpy;
+};
+
+template <typename T, size_t inlineCapacity> struct VectorTraits<blink::HeapDeque<T, inlineCapacity>> : VectorTraitsBase<blink::HeapDeque<T, inlineCapacity>> {
+ static const bool needsDestruction = VectorTraits<T>::needsDestruction;
+ static const bool canInitializeWithMemset = VectorTraits<T>::canInitializeWithMemset;
+ static const bool canClearUnusedSlotsWithMemset = VectorTraits<T>::canClearUnusedSlotsWithMemset;
+ static const bool canMoveWithMemcpy = VectorTraits<T>::canMoveWithMemcpy;
+};
+
+template<typename T> struct HashTraits<blink::Member<T>> : SimpleClassHashTraits<blink::Member<T>> {
+ // 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 = RawPtr<T>;
+ using PassInType = RawPtr<T>;
+ using IteratorGetType = blink::Member<T>*;
+ using IteratorConstGetType = const blink::Member<T>*;
+ using IteratorReferenceType = blink::Member<T>&;
+ using IteratorConstReferenceType = const blink::Member<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::Member<T>& storage) { storage = value; }
+
+ static PeekOutType peek(const blink::Member<T>& value) { return value; }
+ static PassOutType passOut(const blink::Member<T>& value) { return value; }
+};
+
+template<typename T> struct HashTraits<blink::WeakMember<T>> : SimpleClassHashTraits<blink::WeakMember<T>> {
+ static const bool needsDestruction = false;
+ // 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 = RawPtr<T>;
+ using PassInType = RawPtr<T>;
+ using IteratorGetType = blink::WeakMember<T>*;
+ using IteratorConstGetType = const blink::WeakMember<T>*;
+ using IteratorReferenceType = blink::WeakMember<T>&;
+ using IteratorConstReferenceType = const blink::WeakMember<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::WeakMember<T>& storage) { storage = value; }
+
+ static PeekOutType peek(const blink::WeakMember<T>& value) { return value; }
+ static PassOutType passOut(const blink::WeakMember<T>& value) { return value; }
+
+ template<typename VisitorDispatcher>
+ static bool traceInCollection(VisitorDispatcher visitor, blink::WeakMember<T>& weakMember, ShouldWeakPointersBeMarkedStrongly strongify)
+ {
+ if (strongify == WeakPointersActStrong) {
+ visitor->trace(weakMember.get()); // Strongified visit.
+ return false;
+ }
+ return !blink::Heap::isHeapObjectAlive(weakMember);
+ }
+};
+
+template<typename T> struct HashTraits<blink::UntracedMember<T>> : SimpleClassHashTraits<blink::UntracedMember<T>> {
+ static const bool needsDestruction = false;
+ // 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.
+ using PeekInType = RawPtr<T>;
+ using PassInType = RawPtr<T>;
+ using IteratorGetType = blink::UntracedMember<T>*;
+ using IteratorConstGetType = const blink::UntracedMember<T>*;
+ using IteratorReferenceType = blink::UntracedMember<T>&;
+ using IteratorConstReferenceType = const blink::UntracedMember<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::UntracedMember<T>& storage) { storage = value; }
+
+ static PeekOutType peek(const blink::UntracedMember<T>& value) { return value; }
+ static PassOutType passOut(const blink::UntracedMember<T>& value) { return value; }
+};
+
+template<typename T, size_t inlineCapacity>
+struct NeedsTracing<ListHashSetNode<T, blink::HeapListHashSetAllocator<T, inlineCapacity>> *> {
+ static_assert(sizeof(T), "T must be fully defined");
+ // All heap allocated node pointers need visiting to keep the nodes alive,
+ // regardless of whether they contain pointers to other heap allocated
+ // objects.
+ static const bool value = true;
+};
+
+} // namespace WTF
+
#endif
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698