[gnome-photos] Sprinkle some EggCounters to keep track of object count
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] Sprinkle some EggCounters to keep track of object count
- Date: Wed, 13 Jul 2016 15:00:16 +0000 (UTC)
commit d8f647a7a81c87315d6ce4f2979f84b1609b69e7
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Dec 15 14:51:43 2015 +0100
Sprinkle some EggCounters to keep track of object count
src/photos-base-item.c | 6 ++++++
src/photos-item-manager.c | 6 ++++++
src/photos-offset-controller.c | 17 +++++++++++++++++
src/photos-pipeline.c | 6 ++++++
src/photos-selection-controller.c | 9 +++++++++
src/photos-source.c | 5 +++++
src/photos-tracker-controller.c | 9 +++++++++
7 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index fd8a48d..c838581 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -39,6 +39,7 @@
#include <libgd/gd.h>
#include <tracker-sparql.h>
+#include "egg-counter.h"
#include "photos-application.h"
#include "photos-base-item.h"
#include "photos-collection-icon-watcher.h"
@@ -127,6 +128,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (PhotosBaseItem, photos_base_item, G_TYPE_OBJEC
G_ADD_PRIVATE (PhotosBaseItem)
G_IMPLEMENT_INTERFACE (PHOTOS_TYPE_FILTERABLE,
photos_base_item_filterable_iface_init));
+EGG_DEFINE_COUNTER (instances, "PhotosBaseItem", "Instances", "Number of PhotosBaseItem instances")
typedef struct _PhotosBaseItemSaveData PhotosBaseItemSaveData;
@@ -1718,6 +1720,8 @@ photos_base_item_finalize (GObject *object)
g_mutex_clear (&priv->mutex);
G_OBJECT_CLASS (photos_base_item_parent_class)->finalize (object);
+
+ EGG_COUNTER_DEC (instances);
}
@@ -1767,6 +1771,8 @@ photos_base_item_init (PhotosBaseItem *self)
{
PhotosBaseItemPrivate *priv;
+ EGG_COUNTER_INC (instances);
+
self->priv = photos_base_item_get_instance_private (self);
priv = self->priv;
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index f8f3067..d943385 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -29,6 +29,7 @@
#include <glib.h>
#include <tracker-sparql.h>
+#include "egg-counter.h"
#include "photos-enums.h"
#include "photos-filterable.h"
#include "photos-item-manager.h"
@@ -85,6 +86,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (PhotosItemManager, photos_item_manager, PHOTOS_TYPE_BASE_MANAGER);
+EGG_DEFINE_COUNTER (instances, "PhotosItemManager", "Instances", "Number of PhotosItemManager instances")
static void
@@ -445,12 +447,16 @@ photos_item_manager_finalize (GObject *object)
g_queue_free (self->history);
G_OBJECT_CLASS (photos_item_manager_parent_class)->finalize (object);
+
+ EGG_COUNTER_DEC (instances);
}
static void
photos_item_manager_init (PhotosItemManager *self)
{
+ EGG_COUNTER_INC (instances);
+
self->collections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
self->extension_point = g_io_extension_point_lookup (PHOTOS_BASE_ITEM_EXTENSION_POINT_NAME);
self->collection_path = g_queue_new ();
diff --git a/src/photos-offset-controller.c b/src/photos-offset-controller.c
index 5d29e4e..77691af 100644
--- a/src/photos-offset-controller.c
+++ b/src/photos-offset-controller.c
@@ -28,6 +28,7 @@
#include <glib.h>
#include <tracker-sparql.h>
+#include "egg-counter.h"
#include "photos-offset-controller.h"
#include "photos-query-builder.h"
#include "photos-tracker-queue.h"
@@ -52,6 +53,10 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (PhotosOffsetController, photos_offset_controller, G_TYPE_OBJECT);
+EGG_DEFINE_COUNTER (instances,
+ "PhotosOffsetController",
+ "Instances",
+ "Number of PhotosOffsetController instances")
enum
@@ -144,10 +149,21 @@ photos_offset_controller_dispose (GObject *object)
static void
+photos_offset_controller_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (photos_offset_controller_parent_class)->finalize (object);
+
+ EGG_COUNTER_DEC (instances);
+}
+
+
+static void
photos_offset_controller_init (PhotosOffsetController *self)
{
PhotosOffsetControllerPrivate *priv;
+ EGG_COUNTER_INC (instances);
+
priv = photos_offset_controller_get_instance_private (self);
priv->cancellable = g_cancellable_new ();
@@ -161,6 +177,7 @@ photos_offset_controller_class_init (PhotosOffsetControllerClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = photos_offset_controller_dispose;
+ object_class->finalize = photos_offset_controller_finalize;
signals[COUNT_CHANGED] = g_signal_new ("count-changed",
G_TYPE_FROM_CLASS (class),
diff --git a/src/photos-pipeline.c b/src/photos-pipeline.c
index 2db7943..871b1b1 100644
--- a/src/photos-pipeline.c
+++ b/src/photos-pipeline.c
@@ -26,6 +26,7 @@
#include <glib.h>
+#include "egg-counter.h"
#include "photos-debug.h"
#include "photos-operation-insta-common.h"
#include "photos-pipeline.h"
@@ -59,6 +60,7 @@ static void photos_pipeline_async_initable_iface_init (GAsyncInitableIface *ifac
G_DEFINE_TYPE_EXTENDED (PhotosPipeline, photos_pipeline, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE,
photos_pipeline_async_initable_iface_init));
+EGG_DEFINE_COUNTER (instances, "PhotosPipeline", "Instances", "Number of PhotosPipeline instances")
static void
@@ -231,6 +233,8 @@ photos_pipeline_finalize (GObject *object)
g_free (self->uri);
G_OBJECT_CLASS (photos_pipeline_parent_class)->finalize (object);
+
+ EGG_COUNTER_DEC (instances);
}
@@ -259,6 +263,8 @@ photos_pipeline_set_property (GObject *object, guint prop_id, const GValue *valu
static void
photos_pipeline_init (PhotosPipeline *self)
{
+ EGG_COUNTER_INC (instances);
+
self->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
}
diff --git a/src/photos-selection-controller.c b/src/photos-selection-controller.c
index 2953163..1f540c7 100644
--- a/src/photos-selection-controller.c
+++ b/src/photos-selection-controller.c
@@ -28,6 +28,7 @@
#include <gio/gio.h>
#include <glib.h>
+#include "egg-counter.h"
#include "photos-base-manager.h"
#include "photos-filterable.h"
#include "photos-search-context.h"
@@ -62,6 +63,10 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (PhotosSelectionController, photos_selection_controller, G_TYPE_OBJECT);
+EGG_DEFINE_COUNTER (instances,
+ "PhotosSelectionController",
+ "Instances",
+ "Number of PhotosSelectionController instances")
static void
@@ -119,6 +124,8 @@ photos_selection_controller_finalize (GObject *object)
g_object_remove_weak_pointer (G_OBJECT (self->item_mngr), (gpointer *) &self->item_mngr);
G_OBJECT_CLASS (photos_selection_controller_parent_class)->finalize (object);
+
+ EGG_COUNTER_DEC (instances);
}
@@ -128,6 +135,8 @@ photos_selection_controller_init (PhotosSelectionController *self)
GApplication *app;
PhotosSearchContextState *state;
+ EGG_COUNTER_INC (instances);
+
app = g_application_get_default ();
state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
diff --git a/src/photos-source.c b/src/photos-source.c
index 30fe34f..08bd63f 100644
--- a/src/photos-source.c
+++ b/src/photos-source.c
@@ -27,6 +27,7 @@
#include <gio/gio.h>
+#include "egg-counter.h"
#include "photos-filterable.h"
#include "photos-query-builder.h"
#include "photos-source.h"
@@ -62,6 +63,7 @@ static void photos_filterable_interface_init (PhotosFilterableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (PhotosSource, photos_source, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (PHOTOS_TYPE_FILTERABLE,
photos_filterable_interface_init));
+EGG_DEFINE_COUNTER (instances, "PhotosSource", "Instances", "Number of PhotosSource instances")
static gchar *
@@ -121,6 +123,8 @@ photos_source_finalize (GObject *object)
g_free (self->name);
G_OBJECT_CLASS (photos_source_parent_class)->finalize (object);
+
+ EGG_COUNTER_DEC (instances);
}
@@ -204,6 +208,7 @@ photos_source_set_property (GObject *object, guint prop_id, const GValue *value,
static void
photos_source_init (PhotosSource *self)
{
+ EGG_COUNTER_INC (instances);
}
diff --git a/src/photos-tracker-controller.c b/src/photos-tracker-controller.c
index b80b96f..9e0cdbe 100644
--- a/src/photos-tracker-controller.c
+++ b/src/photos-tracker-controller.c
@@ -30,6 +30,7 @@
#include <gio/gio.h>
+#include "egg-counter.h"
#include "photos-base-manager.h"
#include "photos-debug.h"
#include "photos-enums.h"
@@ -79,6 +80,10 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (PhotosTrackerController, photos_tracker_controller, G_TYPE_OBJECT);
+EGG_DEFINE_COUNTER (instances,
+ "PhotosTrackerController",
+ "Instances",
+ "Number of PhotosTrackerController instances")
typedef enum
@@ -390,6 +395,8 @@ photos_tracker_controller_finalize (GObject *object)
photos_query_free (priv->current_query);
G_OBJECT_CLASS (photos_tracker_controller_parent_class)->finalize (object);
+
+ EGG_COUNTER_DEC (instances);
}
@@ -421,6 +428,8 @@ photos_tracker_controller_init (PhotosTrackerController *self)
GApplication *app;
PhotosSearchContextState *state;
+ EGG_COUNTER_INC (instances);
+
priv = photos_tracker_controller_get_instance_private (self);
app = g_application_get_default ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]