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

Unified Diff: Source/heap/Visitor.h

Issue 169293002: Oilpan: Remove GC_INFO_{DEFINE,DECLARE} macros (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/heap/Heap.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/heap/Visitor.h
diff --git a/Source/heap/Visitor.h b/Source/heap/Visitor.h
index 0dc62ab25c9f1f65954d087c797272b87e0e0eff..fd8fed703c8adf0712dd2ea1804b588d6adec63e 100644
--- a/Source/heap/Visitor.h
+++ b/Source/heap/Visitor.h
@@ -136,29 +136,12 @@ struct FinalizerTrait {
// 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; \
Mads Ager (chromium) 2014/02/17 07:22:07 Here we are losing a friend declaration. Maybe tha
kouhei (in TOK) 2014/02/17 08:35:53 This friend stmt is for calling |finalize()| metho
wibling-chromium 2014/02/17 08:44:15 Can't we add the friend declaration to GarbageColl
kouhei (in TOK) 2014/02/17 08:48:19 Yes. I think we can add the friend decl to Garbage
-private: \
-
-#define DEFINE_GC_INFO(Type) \
-const GCInfo Type::s_gcInfo = { \
- #Type, \
- TraceTrait<Type>::trace, \
- FinalizerTrait<Type>::finalize, \
- FinalizerTrait<Type>::nonTrivialFinalizer, \
-}; \
+#define DECLARE_GC_INFO
+#define DEFINE_GC_INFO(Type)
// 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()
@@ -547,6 +530,31 @@ template<typename T> bool ObjectAliveTrait<Member<T> >::isAlive(Visitor* visitor
return visitor->isMarked(obj.get());
}
+template<typename T>
+struct GCInfoKeep
+{
+ static const GCInfo* get()
+ {
+ static char foo = 'a'; // FIXME: use extractNameFromFunctionName()
+ static const GCInfo gcInfo = {
Mads Ager (chromium) 2014/02/17 07:22:07 The other difference with this is that these struc
kouhei (in TOK) 2014/02/17 08:35:53 There is no difference in generated code. I tested
+ &foo,
+ TraceTrait<T>::trace,
+ FinalizerTrait<T>::finalize,
+ FinalizerTrait<T>::nonTrivialFinalizer,
+ };
+ return &gcInfo;
+ }
+};
+
+template<typename T>
+struct GCInfoTrait
+{
+ static const GCInfo* get()
+ {
+ return GCInfoKeep<typename T::GarbageCollectedBase>::get();
+ }
+};
+
}
#endif
« no previous file with comments | « Source/heap/Heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698