| OLD | NEW |
| 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 Loading... |
| 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_base_of<Node, T>::value |
| 39 || WTF::IsSubclass<typename std::remove_const<T>::type, NodeList>::value
> struct DefaultThreadingTrait; | 39 || std::is_base_of<NodeList, T>::value> struct DefaultThreadingTrait; |
| 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 Loading... |
| 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 |
| OLD | NEW |