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

Unified Diff: Source/platform/heap/Handle.h

Issue 228403002: Deque: Add HeapDeque and prevent buggy use of swap and operator= (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix Ians nit Created 6 years, 8 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 | « no previous file | Source/platform/heap/Heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Handle.h
diff --git a/Source/platform/heap/Handle.h b/Source/platform/heap/Handle.h
index 8c7cedd603ea3dcde1be702b72970e729aef0f12..feec0b0b4c1172e070c16292c91c7b0819cc956f 100644
--- a/Source/platform/heap/Handle.h
+++ b/Source/platform/heap/Handle.h
@@ -52,12 +52,14 @@ template<typename T> class HeapTerminatedArray;
typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapHashSet> HeapHashSetSubclass; \
typedef WTF::IsSubclassOfTemplate5<NonConstType, HeapHashMap> HeapHashMapSubclass; \
typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapVector> HeapVectorSubclass; \
+ typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapDeque> HeapDequeSubclass; \
typedef WTF::IsSubclassOfTemplate<NonConstType, HeapTerminatedArray> HeapTerminatedArraySubclass; \
COMPILE_ASSERT(GarbageCollectedSubclass::value || \
GarbageCollectedMixinSubclass::value || \
HeapHashSetSubclass::value || \
HeapHashMapSubclass::value || \
HeapVectorSubclass::value || \
+ HeapDequeSubclass::value || \
HeapTerminatedArraySubclass::value, \
ErrorMessage); \
} while (0)
@@ -420,6 +422,18 @@ public:
}
};
+template<typename T, size_t inlineCapacity = 0>
+class PersistentHeapDeque : public PersistentHeapCollectionBase<HeapDeque<T, inlineCapacity> > {
+public:
+ PersistentHeapDeque() { }
+
+ template<size_t otherCapacity>
+ PersistentHeapDeque(const HeapDeque<T, otherCapacity>& other)
+ : PersistentHeapCollectionBase<HeapDeque<T, inlineCapacity> >(other)
+ {
+ }
+};
+
// Members are used in classes to contain strong pointers to other oilpan heap
// allocated objects.
// All Member fields of a class must be traced in the class' trace method.
@@ -719,6 +733,8 @@ template<typename T, typename U> inline bool operator!=(const Persistent<T>& a,
#define WillBePersistentHeapHashSet WebCore::PersistentHeapHashSet
#define WillBeHeapVector WebCore::HeapVector
#define WillBePersistentHeapVector WebCore::PersistentHeapVector
+#define WillBeHeapDeque WebCore::HeapDeque
+#define WillBePersistentHeapDeque WebCore::PersistentHeapDeque
#define WillBeGarbageCollectedMixin WebCore::GarbageCollectedMixin
#define WillBeHeapSupplement WebCore::HeapSupplement
#define WillBeHeapSupplementable WebCore::HeapSupplementable
@@ -789,6 +805,8 @@ public:
#define WillBePersistentHeapHashSet WTF::HashSet
#define WillBeHeapVector WTF::Vector
#define WillBePersistentHeapVector WTF::Vector
+#define WillBeHeapDeque WTF::Deque
+#define WillBePersistentHeapDeque WTF::Deque
#define WillBeGarbageCollectedMixin WebCore::DummyBase<void>
#define WillBeHeapSupplement WebCore::Supplement
#define WillBeHeapSupplementable WebCore::Supplementable
@@ -837,12 +855,24 @@ template <typename T> struct VectorTraits<WebCore::HeapVector<T, 0> > : VectorTr
static const bool canMoveWithMemcpy = true;
};
+template <typename T> struct VectorTraits<WebCore::HeapDeque<T, 0> > : VectorTraitsBase<WebCore::HeapDeque<T, 0> > {
+ static const bool needsDestruction = false;
+ static const bool canInitializeWithMemset = true;
+ static const bool canMoveWithMemcpy = true;
+};
+
template <typename T, size_t inlineCapacity> struct VectorTraits<WebCore::HeapVector<T, inlineCapacity> > : VectorTraitsBase<WebCore::HeapVector<T, inlineCapacity> > {
static const bool needsDestruction = VectorTraits<T>::needsDestruction;
static const bool canInitializeWithMemset = VectorTraits<T>::canInitializeWithMemset;
static const bool canMoveWithMemcpy = VectorTraits<T>::canMoveWithMemcpy;
};
+template <typename T, size_t inlineCapacity> struct VectorTraits<WebCore::HeapDeque<T, inlineCapacity> > : VectorTraitsBase<WebCore::HeapDeque<T, inlineCapacity> > {
+ static const bool needsDestruction = VectorTraits<T>::needsDestruction;
+ static const bool canInitializeWithMemset = VectorTraits<T>::canInitializeWithMemset;
+ static const bool canMoveWithMemcpy = VectorTraits<T>::canMoveWithMemcpy;
+};
+
template<typename T> struct HashTraits<WebCore::Member<T> > : SimpleClassHashTraits<WebCore::Member<T> > {
static const bool needsDestruction = false;
// FIXME: The distinction between PeekInType and PassInType is there for
« no previous file with comments | « no previous file | Source/platform/heap/Heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698