Index: Source/heap/Visitor.h |
diff --git a/Source/heap/Visitor.h b/Source/heap/Visitor.h |
index 80623bf29531b79daa213ccdecb17877dff4bd6d..c98b13e08ae848dbad71e3214a11fbd3c463cf9c 100644 |
--- a/Source/heap/Visitor.h |
+++ b/Source/heap/Visitor.h |
@@ -134,31 +134,9 @@ struct FinalizerTrait { |
static void finalize(void* obj) { FinalizerTraitImpl<T, nonTrivialFinalizer>::finalize(obj); } |
}; |
-// Macros to declare and define GCInfo structures for objects |
-// allocated in the Blink garbage-collected heap. |
-#define DECLARE_GC_INFO \ |
-public: \ |
- static const GCInfo s_gcInfo; \ |
- template<typename Any> friend struct FinalizerTrait; \ |
-private: \ |
- |
-#define DEFINE_GC_INFO(Type) \ |
-const GCInfo Type::s_gcInfo = { \ |
- #Type, \ |
- TraceTrait<Type>::trace, \ |
- FinalizerTrait<Type>::finalize, \ |
- FinalizerTrait<Type>::nonTrivialFinalizer, \ |
-}; \ |
- |
// Trait to get the GCInfo structure for types that have their |
// instances allocated in the Blink garbage-collected heap. |
-template<typename T> |
-struct GCInfoTrait { |
- static const GCInfo* get() |
- { |
- return &T::s_gcInfo; |
- } |
-}; |
+template<typename T> struct GCInfoTrait; |
template<typename T> |
const char* getTypeMarker() |
@@ -545,6 +523,29 @@ template<typename T> bool ObjectAliveTrait<Member<T> >::isAlive(Visitor* visitor |
return visitor->isMarked(obj.get()); |
} |
+template<typename T> |
+struct GCInfoAtBase { |
+ static const GCInfo* get() |
+ { |
+ static char pseudoTypeMarker = 'a'; |
+ static const GCInfo gcInfo = { |
+ &pseudoTypeMarker, |
+ TraceTrait<T>::trace, |
+ FinalizerTrait<T>::finalize, |
+ FinalizerTrait<T>::nonTrivialFinalizer, |
+ }; |
+ return &gcInfo; |
+ } |
+}; |
+ |
+template<typename T> |
+struct GCInfoTrait { |
+ static const GCInfo* get() |
+ { |
+ return GCInfoAtBase<typename T::GarbageCollectedBase>::get(); |
+ } |
+}; |
+ |
} |
#endif |