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

Side by Side Diff: third_party/WebKit/Source/platform/heap/ThreadingTraits.h

Issue 2592063002: SameThreadCheckedMember<>: verify same-thread usage of heap references. (Closed)
Patch Set: emphasize that the extended Member is for diagnosing/debugging Created 3 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ThreadingTraits_h 5 #ifndef ThreadingTraits_h
6 #define ThreadingTraits_h 6 #define ThreadingTraits_h
7 7
8 #include "wtf/Allocator.h" 8 #include "wtf/Allocator.h"
9 #include "wtf/Deque.h" 9 #include "wtf/Deque.h"
10 #include "wtf/HashCountedSet.h" 10 #include "wtf/HashCountedSet.h"
11 #include "wtf/HashMap.h" 11 #include "wtf/HashMap.h"
12 #include "wtf/HashSet.h" 12 #include "wtf/HashSet.h"
13 #include "wtf/HashTable.h" 13 #include "wtf/HashTable.h"
14 #include "wtf/LinkedHashSet.h" 14 #include "wtf/LinkedHashSet.h"
15 #include "wtf/ListHashSet.h" 15 #include "wtf/ListHashSet.h"
16 #include "wtf/TypeTraits.h" 16 #include "wtf/TypeTraits.h"
17 #include "wtf/Vector.h" 17 #include "wtf/Vector.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 template <typename T> 21 template <typename T>
22 class SameThreadCheckedMember;
23 template <typename T>
22 class TraceWrapperMember; 24 class TraceWrapperMember;
23 25
24 // ThreadAffinity indicates which threads objects can be used on. We 26 // ThreadAffinity indicates which threads objects can be used on. We
25 // distinguish between objects that can be used on the main thread 27 // distinguish between objects that can be used on the main thread
26 // only and objects that can be used on any thread. 28 // only and objects that can be used on any thread.
27 // 29 //
28 // For objects that can only be used on the main thread, we avoid going 30 // For objects that can only be used on the main thread, we avoid going
29 // through thread-local storage to get to the thread state. This is 31 // through thread-local storage to get to the thread state. This is
30 // important for performance. 32 // important for performance.
31 enum ThreadAffinity { 33 enum ThreadAffinity {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 template <typename U> 78 template <typename U>
77 class ThreadingTrait<const U> : public ThreadingTrait<U> {}; 79 class ThreadingTrait<const U> : public ThreadingTrait<U> {};
78 80
79 template <typename T> 81 template <typename T>
80 struct ThreadingTrait<Member<T>> { 82 struct ThreadingTrait<Member<T>> {
81 STATIC_ONLY(ThreadingTrait); 83 STATIC_ONLY(ThreadingTrait);
82 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; 84 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity;
83 }; 85 };
84 86
85 template <typename T> 87 template <typename T>
88 struct ThreadingTrait<SameThreadCheckedMember<T>> {
89 STATIC_ONLY(ThreadingTrait);
90 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity;
91 };
92
93 template <typename T>
86 struct ThreadingTrait<TraceWrapperMember<T>> { 94 struct ThreadingTrait<TraceWrapperMember<T>> {
87 STATIC_ONLY(ThreadingTrait); 95 STATIC_ONLY(ThreadingTrait);
88 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; 96 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity;
89 }; 97 };
90 98
91 template <typename T> 99 template <typename T>
92 struct ThreadingTrait<WeakMember<T>> { 100 struct ThreadingTrait<WeakMember<T>> {
93 STATIC_ONLY(ThreadingTrait); 101 STATIC_ONLY(ThreadingTrait);
94 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity; 102 static const ThreadAffinity Affinity = ThreadingTrait<T>::Affinity;
95 }; 103 };
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 }; 197 };
190 template <typename T, typename U, typename V> 198 template <typename T, typename U, typename V>
191 struct ThreadingTrait<HeapHashCountedSet<T, U, V>> 199 struct ThreadingTrait<HeapHashCountedSet<T, U, V>>
192 : public ThreadingTrait<HashCountedSet<T, U, V, HeapAllocator>> { 200 : public ThreadingTrait<HashCountedSet<T, U, V, HeapAllocator>> {
193 STATIC_ONLY(ThreadingTrait); 201 STATIC_ONLY(ThreadingTrait);
194 }; 202 };
195 203
196 } // namespace blink 204 } // namespace blink
197 205
198 #endif 206 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Member.h ('k') | third_party/WebKit/Source/platform/heap/TraceTraits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698