trace: make alloc trace work for miniobject again
[platform/upstream/gstreamer.git] / gst / gstminiobject.c
index 9e83e8d..2a42b61 100644 (file)
@@ -38,8 +38,6 @@
 #include "gst/gstinfo.h"
 #include <gobject/gvaluecollector.h>
 
-#define GST_DISABLE_TRACE
-
 #ifndef GST_DISABLE_TRACE
 #include "gsttrace.h"
 static GstAllocTrace *_gst_mini_object_trace;
@@ -48,46 +46,12 @@ static GstAllocTrace *_gst_mini_object_trace;
 /* Mutex used for weak referencing */
 G_LOCK_DEFINE_STATIC (weak_refs_mutex);
 
-/* boxed copy and free functions. Don't real copy or free but simply
- * change the refcount */
-static GstMiniObject *
-_gst_mini_object_boxed_copy (GstMiniObject * mini_object)
-{
-  if (mini_object)
-    return gst_mini_object_ref (mini_object);
-  else
-    return NULL;
-}
-
-static void
-_gst_mini_object_boxed_free (GstMiniObject * mini_object)
-{
-  if (mini_object)
-    gst_mini_object_unref (mini_object);
-}
-
-/**
- * gst_mini_object_register:
- * @name: name of the new boxed type
- *
- * This function creates a new G_TYPE_BOXED derived type id for a new boxed type
- * with name @name. The default miniobject refcounting copy and free function
- * are used for the boxed type.
- *
- * Returns: a new G_TYPE_BOXED derived type id for @name.
- */
-GType
-gst_mini_object_register (const gchar * name)
+void
+_priv_gst_mini_object_initialize (void)
 {
-  GType type;
-
-  g_return_val_if_fail (name != NULL, 0);
-
-  type = g_boxed_type_register_static (name,
-      (GBoxedCopyFunc) _gst_mini_object_boxed_copy,
-      (GBoxedFreeFunc) _gst_mini_object_boxed_free);
-
-  return type;
+#ifndef GST_DISABLE_TRACE
+  _gst_mini_object_trace = gst_alloc_trace_register ("GstMiniObject");
+#endif
 }
 
 /**
@@ -111,6 +75,10 @@ gst_mini_object_init (GstMiniObject * mini_object, GType type, gsize size)
   mini_object->size = size;
   mini_object->n_weak_refs = 0;
   mini_object->weak_refs = NULL;
+
+#ifndef GST_DISABLE_TRACE
+  gst_alloc_trace_new (_gst_mini_object_trace, mini_object);
+#endif
 }
 
 /**
@@ -357,6 +325,7 @@ gst_mini_object_steal (GstMiniObject ** olddata)
  * gst_mini_object_take:
  * @olddata: (inout) (transfer full): pointer to a pointer to a mini-object to
  *     be replaced
+ * @newdata: pointer to new mini-object
  *
  * Modifies a pointer to point to a new mini-object. The modification
  * is done atomically. This version is similar to gst_mini_object_replace()