[gnome-photos/wip/rishi/misc-fixes: 4/22] Sprinkle some counters to keep track of object count
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/misc-fixes: 4/22] Sprinkle some counters to keep track of object count
- Date: Fri, 25 Dec 2015 09:20:02 +0000 (UTC)
commit 2ec44f91ba506d3d88239528a5510c1cedd10f53
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Dec 15 14:51:43 2015 +0100
Sprinkle some counters 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-tracker-controller.c | 9 +++++++++
6 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index c7d01f1..4d49f62 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -37,6 +37,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"
@@ -124,6 +125,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");
static GdkPixbuf *failed_icon;
@@ -1233,6 +1235,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);
}
@@ -1282,6 +1286,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 b13c9bf..4f4010a 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
@@ -435,12 +437,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 f84cbfd..33f1772 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"
@@ -51,6 +52,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
@@ -112,10 +117,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);
+
self->priv = photos_offset_controller_get_instance_private (self);
priv = self->priv;
@@ -129,6 +145,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 984b312..eed5e9c 100644
--- a/src/photos-pipeline.c
+++ b/src/photos-pipeline.c
@@ -23,6 +23,7 @@
#include <glib.h>
+#include "egg-counter.h"
#include "photos-debug.h"
#include "photos-operation-insta-common.h"
#include "photos-pipeline.h"
@@ -50,6 +51,7 @@ enum
G_DEFINE_TYPE (PhotosPipeline, photos_pipeline, G_TYPE_OBJECT);
+EGG_DEFINE_COUNTER (instances, "PhotosPipeline", "Instances", "Number of PhotosPipeline instances");
static gchar *
@@ -120,6 +122,8 @@ photos_pipeline_finalize (GObject *object)
g_queue_free (self->history);
G_OBJECT_CLASS (photos_pipeline_parent_class)->finalize (object);
+
+ EGG_COUNTER_DEC (instances);
}
@@ -144,6 +148,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);
self->history = g_queue_new ();
}
diff --git a/src/photos-selection-controller.c b/src/photos-selection-controller.c
index 449a842..404fb01 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"
@@ -53,6 +54,10 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE_WITH_PRIVATE (PhotosSelectionController, photos_selection_controller, G_TYPE_OBJECT);
+EGG_DEFINE_COUNTER (instances,
+ "PhotosSelectionController",
+ "Instances",
+ "Number of PhotosSelectionController instances");
static void
@@ -112,6 +117,8 @@ photos_selection_controller_finalize (GObject *object)
g_object_remove_weak_pointer (G_OBJECT (priv->item_mngr), (gpointer *) &priv->item_mngr);
G_OBJECT_CLASS (photos_selection_controller_parent_class)->finalize (object);
+
+ EGG_COUNTER_DEC (instances);
}
@@ -122,6 +129,8 @@ photos_selection_controller_init (PhotosSelectionController *self)
GApplication *app;
PhotosSearchContextState *state;
+ EGG_COUNTER_INC (instances);
+
self->priv = photos_selection_controller_get_instance_private (self);
priv = self->priv;
diff --git a/src/photos-tracker-controller.c b/src/photos-tracker-controller.c
index 0666143..7d7bfce 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
@@ -365,6 +370,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);
}
@@ -393,6 +400,8 @@ photos_tracker_controller_init (PhotosTrackerController *self)
GApplication *app;
PhotosSearchContextState *state;
+ EGG_COUNTER_INC (instances);
+
self->priv = photos_tracker_controller_get_instance_private (self);
priv = self->priv;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]