Chromium Code Reviews| Index: Source/heap/ThreadState.h |
| diff --git a/Source/heap/ThreadState.h b/Source/heap/ThreadState.h |
| index 80a80afe0c7dd4e3b7a1547342d8a6e4088875f3..e36b20f19bde209d6c715164e63e8c05555e59de 100644 |
| --- a/Source/heap/ThreadState.h |
| +++ b/Source/heap/ThreadState.h |
| @@ -71,12 +71,26 @@ enum ThreadAffinity { |
| MainThreadOnly, |
| }; |
| -// By default all types are considered to be used on the main thread only. |
| +class Node; |
| +class CSSValue; |
| + |
| +template<typename T, bool derivesNodeOrCSSValue = WTF::IsSubclass<T, Node>::value || WTF::IsSubclass<T, CSSValue>::value > class DefaultThreadingTrait; |
|
zerny-chromium
2014/02/27 11:05:46
Error: class/struct mismatch.
|
| + |
| template<typename T> |
| -struct ThreadingTrait { |
| +struct DefaultThreadingTrait<T, false> { |
| + static const ThreadAffinity Affinity = AnyThread; |
| +}; |
| + |
| +template<typename T> |
| +struct DefaultThreadingTrait<T, true> { |
| static const ThreadAffinity Affinity = MainThreadOnly; |
| }; |
| +template<typename T> |
| +struct ThreadingTrait { |
| + static const ThreadAffinity Affinity = DefaultThreadingTrait<T>::Affinity; |
| +}; |
| + |
| // Marks the specified class as being used from multiple threads. When |
| // a class is used from multiple threads we go through thread local |
| // storage to get the heap in which to allocate an object of that type |
| @@ -545,43 +559,6 @@ public: |
| static ThreadState* state() { return ThreadState::current(); } |
| }; |
| -// FIXME: Experiment if the threading affinity really matters for performance. |
| -// FIXME: Move these macros and other related structures to a separate file. |
| -USED_FROM_MULTIPLE_THREADS(Crypto); |
| -USED_FROM_MULTIPLE_THREADS(DOMParser); |
| -USED_FROM_MULTIPLE_THREADS(DOMURL); |
| -USED_FROM_MULTIPLE_THREADS(DeprecatedStorageQuota); |
| -USED_FROM_MULTIPLE_THREADS(Event); |
| -USED_FROM_MULTIPLE_THREADS(EventSource); |
| -USED_FROM_MULTIPLE_THREADS(EventTarget); |
| -USED_FROM_MULTIPLE_THREADS(Key); |
| -USED_FROM_MULTIPLE_THREADS(KeyAlgorithm); |
| -USED_FROM_MULTIPLE_THREADS(KeyPair); |
| -USED_FROM_MULTIPLE_THREADS(MemoryInfo); |
| -USED_FROM_MULTIPLE_THREADS(MessageEvent); |
| -USED_FROM_MULTIPLE_THREADS(Notification); |
| -USED_FROM_MULTIPLE_THREADS(NotificationCenter); |
| -USED_FROM_MULTIPLE_THREADS(Performance); |
| -USED_FROM_MULTIPLE_THREADS(PerformanceEntry); |
| -USED_FROM_MULTIPLE_THREADS(PerformanceMark); |
| -USED_FROM_MULTIPLE_THREADS(PerformanceNavigation); |
| -USED_FROM_MULTIPLE_THREADS(PerformanceResourceTiming); |
| -USED_FROM_MULTIPLE_THREADS(PerformanceTiming); |
| -USED_FROM_MULTIPLE_THREADS(SubtleCrypto); |
| -USED_FROM_MULTIPLE_THREADS(TextDecoder); |
| -USED_FROM_MULTIPLE_THREADS(TextEncoder); |
| -USED_FROM_MULTIPLE_THREADS(UserTiming); |
| -USED_FROM_MULTIPLE_THREADS(WebKitNotification); |
| -USED_FROM_MULTIPLE_THREADS(WorkerCrypto); |
| -USED_FROM_MULTIPLE_THREADS(WorkerPerformance); |
| -USED_FROM_MULTIPLE_THREADS(XMLHttpRequest); |
| -USED_FROM_MULTIPLE_THREADS(XMLSerializer); |
| -USED_FROM_MULTIPLE_THREADS(XPathEvaluator); |
| -USED_FROM_MULTIPLE_THREADS(XPathExpression); |
| -USED_FROM_MULTIPLE_THREADS(XPathNSResolver); |
| -USED_FROM_MULTIPLE_THREADS(XPathResult); |
| -USED_FROM_MULTIPLE_THREADS(XSLTProcessor); |
| - |
| } |
| #endif // ThreadState_h |