From ae008b90cfc2028e878100f78b21d70f923a6044 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 27 Apr 2011 16:12:12 -0400 Subject: [PATCH] [object] Add tracing support back in --- src/hb-object-private.hh | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh index 8142bd42b..c3cdeb541 100644 --- a/src/hb-object-private.hh +++ b/src/hb-object-private.hh @@ -91,21 +91,37 @@ struct _hb_object_header_t { HB_END_DECLS - template -static inline Type *hb_object_create () { return (Type *) hb_object_header_t::create (sizeof (Type)); } - +static inline void hb_object_trace (const Type *obj, const char *function) +{ + obj->header.trace (function); +} template -static inline bool hb_object_is_inert (const Type *obj) { return unlikely (obj->header.is_inert()); } - +static inline Type *hb_object_create () +{ + Type *obj = (Type *) hb_object_header_t::create (sizeof (Type)); + hb_object_trace (obj, HB_FUNC); + return obj; +} template -static inline Type *hb_object_reference (Type *obj) { obj->header.reference (); return obj; } - +static inline bool hb_object_is_inert (const Type *obj) +{ + return unlikely (obj->header.is_inert()); +} template -static inline bool hb_object_destroy (Type *obj) { return obj->header.destroy (); } - +static inline Type *hb_object_reference (Type *obj) +{ + hb_object_trace (obj, HB_FUNC); + obj->header.reference (); + return obj; +} template -static inline void hb_object_trace (const Type *obj) { obj->header.trace (__FUNCTION__); } +static inline bool hb_object_destroy (Type *obj) +{ + hb_object_trace (obj, HB_FUNC); + return obj->header.destroy (); +} + HB_BEGIN_DECLS @@ -113,8 +129,6 @@ HB_BEGIN_DECLS /* Object allocation and lifecycle manamgement macros */ -/* XXX Trace objects. Got removed in refactoring */ -#define HB_TRACE_OBJECT(obj) hb_object_trace (obj) #define HB_OBJECT_DO_CREATE(Type, obj) likely (obj = hb_object_create ()) #define HB_OBJECT_IS_INERT(obj) hb_object_is_inert (obj) #define HB_OBJECT_DO_REFERENCE(obj) return hb_object_reference (obj)