Index: Source/platform/heap/ThreadState.h |
diff --git a/Source/platform/heap/ThreadState.h b/Source/platform/heap/ThreadState.h |
index b6405a8fee1d13baf529a6e6061a7341ef851050..2dbb608081dac6235dd2d3b6e627999143c41175 100644 |
--- a/Source/platform/heap/ThreadState.h |
+++ b/Source/platform/heap/ThreadState.h |
@@ -80,28 +80,22 @@ typedef VisitorCallback EphemeronCallback; |
// rid of it if it is fast enough to go through thread-local storage |
// always. |
enum ThreadAffinity { |
- AnyThread, |
- MainThreadOnly, |
+ AnyThreadAffinity, |
+ MainThreadAffinity, |
}; |
-// FIXME: These forward declarations violate dependency rules. Remove them. |
-// Ideally we want to provide a USED_IN_MAIN_THREAD_ONLY(T) macro, which |
-// indicates that classes in T's hierarchy are used only by the main thread. |
-class Node; |
-class NodeList; |
+class MainThreadOnly { }; |
-template<typename T, |
- bool mainThreadOnly = WTF::IsSubclass<typename WTF::RemoveConst<T>::Type, Node>::value |
- || WTF::IsSubclass<typename WTF::RemoveConst<T>::Type, NodeList>::value> struct DefaultThreadingTrait; |
+template<typename T, bool mainThreadOnly = WTF::IsSubclass<typename WTF::RemoveConst<T>::Type, MainThreadOnly>::value> struct DefaultThreadingTrait; |
template<typename T> |
struct DefaultThreadingTrait<T, false> { |
- static const ThreadAffinity Affinity = AnyThread; |
+ static const ThreadAffinity Affinity = AnyThreadAffinity; |
}; |
template<typename T> |
struct DefaultThreadingTrait<T, true> { |
- static const ThreadAffinity Affinity = MainThreadOnly; |
+ static const ThreadAffinity Affinity = MainThreadAffinity; |
}; |
template<typename T> |
@@ -109,28 +103,6 @@ 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 |
-// and when allocating a Persistent handle for an object with that |
-// type. Notice that marking the base class does not automatically |
-// mark its descendants and they have to be explicitly marked. |
-#define USED_FROM_MULTIPLE_THREADS(Class) \ |
- class Class; \ |
- template<> struct ThreadingTrait<Class> { \ |
- static const ThreadAffinity Affinity = AnyThread; \ |
- } |
- |
-#define USED_FROM_MULTIPLE_THREADS_NAMESPACE(Namespace, Class) \ |
- namespace Namespace { \ |
- class Class; \ |
- } \ |
- namespace blink { \ |
- template<> struct ThreadingTrait<Namespace::Class> { \ |
- static const ThreadAffinity Affinity = AnyThread; \ |
- }; \ |
- } |
- |
template<typename U> class ThreadingTrait<const U> : public ThreadingTrait<U> { }; |
// Declare that a class has a pre-finalizer function. The function is called in |
@@ -827,7 +799,7 @@ private: |
template<ThreadAffinity affinity> class ThreadStateFor; |
-template<> class ThreadStateFor<MainThreadOnly> { |
+template<> class ThreadStateFor<MainThreadAffinity> { |
public: |
static ThreadState* state() |
{ |
@@ -837,7 +809,7 @@ public: |
} |
}; |
-template<> class ThreadStateFor<AnyThread> { |
+template<> class ThreadStateFor<AnyThreadAffinity> { |
public: |
static ThreadState* state() { return ThreadState::current(); } |
}; |