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

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

Issue 1477213003: More switching to standard type traits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use std::is_convertible in threading traits Created 5 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 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/Deque.h" 8 #include "wtf/Deque.h"
9 #include "wtf/HashCountedSet.h" 9 #include "wtf/HashCountedSet.h"
10 #include "wtf/HashMap.h" 10 #include "wtf/HashMap.h"
(...skipping 17 matching lines...) Expand all
28 AnyThread, 28 AnyThread,
29 MainThreadOnly, 29 MainThreadOnly,
30 }; 30 };
31 31
32 // TODO(haraken): These forward declarations violate dependency rules. 32 // TODO(haraken): These forward declarations violate dependency rules.
33 // Remove them. 33 // Remove them.
34 class Node; 34 class Node;
35 class NodeList; 35 class NodeList;
36 36
37 template<typename T, 37 template<typename T,
38 bool mainThreadOnly = WTF::IsSubclass<typename std::remove_const<T>::type, N ode>::value 38 bool mainThreadOnly = std::is_convertible<typename std::remove_const<T>::typ e*, Node*>::value
39 || WTF::IsSubclass<typename std::remove_const<T>::type, NodeList>::value > struct DefaultThreadingTrait; 39 || std::is_convertible<typename std::remove_const<T>::type*, NodeList*>: :value> struct DefaultThreadingTrait;
Nico 2015/12/18 14:14:14 Now that I think about it, this is a risky change,
40 40
41 template<typename T> 41 template<typename T>
42 struct DefaultThreadingTrait<T, false> { 42 struct DefaultThreadingTrait<T, false> {
43 static const ThreadAffinity Affinity = AnyThread; 43 static const ThreadAffinity Affinity = AnyThread;
44 }; 44 };
45 45
46 template<typename T> 46 template<typename T>
47 struct DefaultThreadingTrait<T, true> { 47 struct DefaultThreadingTrait<T, true> {
48 static const ThreadAffinity Affinity = MainThreadOnly; 48 static const ThreadAffinity Affinity = MainThreadOnly;
49 }; 49 };
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 template<typename T, size_t inlineCapacity> 132 template<typename T, size_t inlineCapacity>
133 struct ThreadingTrait<HeapVector<T, inlineCapacity>> : public ThreadingTrait<Vec tor<T, inlineCapacity, HeapAllocator>> { }; 133 struct ThreadingTrait<HeapVector<T, inlineCapacity>> : public ThreadingTrait<Vec tor<T, inlineCapacity, HeapAllocator>> { };
134 template<typename T, size_t inlineCapacity> 134 template<typename T, size_t inlineCapacity>
135 struct ThreadingTrait<HeapDeque<T, inlineCapacity>> : public ThreadingTrait<Dequ e<T, inlineCapacity, HeapAllocator>> { }; 135 struct ThreadingTrait<HeapDeque<T, inlineCapacity>> : public ThreadingTrait<Dequ e<T, inlineCapacity, HeapAllocator>> { };
136 template<typename T, typename U, typename V> 136 template<typename T, typename U, typename V>
137 struct ThreadingTrait<HeapHashCountedSet<T, U, V>> : public ThreadingTrait<HashC ountedSet<T, U, V, HeapAllocator>> { }; 137 struct ThreadingTrait<HeapHashCountedSet<T, U, V>> : public ThreadingTrait<HashC ountedSet<T, U, V, HeapAllocator>> { };
138 138
139 } // namespace blink 139 } // namespace blink
140 140
141 #endif 141 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapAllocator.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