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

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

Issue 2592063002: SameThreadCheckedMember<>: verify same-thread usage of heap references. (Closed)
Patch Set: emphasize that the extended Member is for diagnosing/debugging Created 4 years 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 | third_party/WebKit/Source/platform/heap/Member.h » ('j') | 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 7d23b2cb0436195b7862bd7d53019fb0e06ad7e8..b82eaaaccb591404e7e84b63328fccc67a17d932 100644
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
@@ -479,6 +479,17 @@ struct VectorTraits<blink::Member<T>> : VectorTraitsBase<blink::Member<T>> {
};
template <typename T>
+struct VectorTraits<blink::SameThreadCheckedMember<T>>
+ : VectorTraitsBase<blink::SameThreadCheckedMember<T>> {
+ STATIC_ONLY(VectorTraits);
+ static const bool needsDestruction = false;
+ static const bool canInitializeWithMemset = true;
+ static const bool canClearUnusedSlotsWithMemset = true;
+ static const bool canMoveWithMemcpy = true;
+ static const bool canSwapUsingCopyOrMove = false;
+};
+
+template <typename T>
struct VectorTraits<blink::TraceWrapperMember<T>>
: VectorTraitsBase<blink::TraceWrapperMember<T>> {
STATIC_ONLY(VectorTraits);
@@ -603,6 +614,46 @@ struct HashTraits<blink::Member<T>> : SimpleClassHashTraits<blink::Member<T>> {
};
template <typename T>
+struct HashTraits<blink::SameThreadCheckedMember<T>>
+ : SimpleClassHashTraits<blink::SameThreadCheckedMember<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::SameThreadCheckedMember<T>*;
+ using IteratorConstGetType = const blink::SameThreadCheckedMember<T>*;
+ using IteratorReferenceType = blink::SameThreadCheckedMember<T>&;
+ using IteratorConstReferenceType = const blink::SameThreadCheckedMember<T>&;
+ static IteratorReferenceType getToReferenceConversion(IteratorGetType x) {
+ return *x;
+ }
+ static IteratorConstReferenceType getToReferenceConstConversion(
+ IteratorConstGetType x) {
+ return *x;
+ }
+
+ using PeekOutType = T*;
+
+ template <typename U>
+ static void store(const U& value,
+ blink::SameThreadCheckedMember<T>& storage) {
+ storage = value;
+ }
+
+ static PeekOutType peek(const blink::SameThreadCheckedMember<T>& value) {
+ return value;
+ }
+
+ static blink::SameThreadCheckedMember<T> emptyValue() {
+ return blink::SameThreadCheckedMember<T>(nullptr, nullptr);
+ }
+};
+
+template <typename T>
struct HashTraits<blink::TraceWrapperMember<T>>
: SimpleClassHashTraits<blink::TraceWrapperMember<T>> {
STATIC_ONLY(HashTraits);
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/Member.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698