[gnome-photos/wip/rishi/misc-fixes: 16/20] 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: 16/20] Sprinkle some counters to keep track of object count
- Date: Wed, 16 Dec 2015 11:59:16 +0000 (UTC)
commit 5b179c8fbbcb728437d2b33a26f6a375688281b0
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 | 19 ++++++++++++++++++-
src/photos-pipeline.c | 6 ++++++
src/photos-selection-controller.c | 11 ++++++++++-
src/photos-tracker-controller.c | 9 +++++++++
6 files changed, 55 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 0dde9b8..fa65b46 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;
@@ -1234,6 +1236,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);
}
@@ -1283,6 +1287,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 5e50948..fb8a8aa 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"
@@ -84,6 +85,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
@@ -426,12 +428,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 5337fda..33f1772 100644
--- a/src/photos-offset-controller.c
+++ b/src/photos-offset-controller.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2015 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -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 7b2a2d1..806747d 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 *
@@ -118,6 +120,8 @@ photos_pipeline_finalize (GObject *object)
g_queue_free (self->history);
G_OBJECT_CLASS (photos_pipeline_parent_class)->finalize (object);
+
+ EGG_COUNTER_DEC (instances);
}
@@ -142,6 +146,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 3186f11..404fb01 100644
--- a/src/photos-selection-controller.c
+++ b/src/photos-selection-controller.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012, 2014 Red Hat, Inc.
+ * Copyright © 2012, 2014, 2015 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -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]