[tracker] libtracker-miner: set pool owner only if traces enabled



commit 69c8b2a164ef23afe1f11abc48da31d2e5ced0d0
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Fri Dec 17 17:41:40 2010 +0100

    libtracker-miner: set pool owner only if traces enabled

 .../tracker-miner-fs-processing-pool.c             |   19 +++++++++++++------
 .../tracker-miner-fs-processing-pool.h             |    8 ++++++--
 src/libtracker-miner/tracker-miner-fs.c            |    9 +++++++--
 3 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs-processing-pool.c b/src/libtracker-miner/tracker-miner-fs-processing-pool.c
index cf2fbfc..31c2653 100644
--- a/src/libtracker-miner/tracker-miner-fs-processing-pool.c
+++ b/src/libtracker-miner/tracker-miner-fs-processing-pool.c
@@ -158,8 +158,6 @@ struct _TrackerProcessingTask {
 };
 
 struct _TrackerProcessingPool {
-	/* Owner of the pool */
-	GObject *owner;
 	/* Connection to the Store */
 	TrackerSparqlConnection *connection;
 
@@ -173,10 +171,12 @@ struct _TrackerProcessingPool {
 	GFile *sparql_buffer_current_parent;
 	time_t sparql_buffer_start_time;
 
+#ifdef PROCESSING_POOL_ENABLE_TRACE
 	/* Timeout to notify status of the queues, if traces
 	 * enabled only. */
-#ifdef PROCESSING_POOL_ENABLE_TRACE
 	guint timeout_id;
+	/* Owner of the pool */
+	GObject *owner;
 #endif /* PROCESSING_POOL_ENABLE_TRACE */
 };
 
@@ -315,6 +315,15 @@ pool_status_trace_timeout_cb (gpointer data)
 	}
 	return TRUE;
 }
+
+void
+tracker_processing_pool_set_owner (TrackerProcessingPool *pool,
+                                   GObject               *owner)
+{
+	/* Used only for logging, to differenciate between the
+	 * apps and fs miners. */
+	pool->owner = owner;
+}
 #endif /* PROCESSING_POOL_ENABLE_TRACE */
 
 static void
@@ -367,8 +376,7 @@ tracker_processing_pool_free (TrackerProcessingPool *pool)
 }
 
 TrackerProcessingPool *
-tracker_processing_pool_new (GObject                 *owner,
-                             TrackerSparqlConnection *connection,
+tracker_processing_pool_new (TrackerSparqlConnection *connection,
                              guint                    limit_wait,
                              guint                    limit_ready)
 {
@@ -376,7 +384,6 @@ tracker_processing_pool_new (GObject                 *owner,
 
 	pool = g_new0 (TrackerProcessingPool, 1);
 
-	pool->owner = owner;
 	pool->connection = g_object_ref (connection);
 	pool->limit[TRACKER_PROCESSING_TASK_STATUS_WAIT] = limit_wait;
 	pool->limit[TRACKER_PROCESSING_TASK_STATUS_READY] = limit_ready;
diff --git a/src/libtracker-miner/tracker-miner-fs-processing-pool.h b/src/libtracker-miner/tracker-miner-fs-processing-pool.h
index b7166e7..490a3e4 100644
--- a/src/libtracker-miner/tracker-miner-fs-processing-pool.h
+++ b/src/libtracker-miner/tracker-miner-fs-processing-pool.h
@@ -49,8 +49,7 @@ void                   tracker_processing_task_set_sparql_string (TrackerProcess
                                                                   gchar                 *sparql_string);
 
 
-TrackerProcessingPool *tracker_processing_pool_new                   (GObject                 *owner,
-                                                                      TrackerSparqlConnection *connection,
+TrackerProcessingPool *tracker_processing_pool_new                   (TrackerSparqlConnection *connection,
                                                                       guint                    limit_wait,
                                                                       guint                    limit_process);
 void                   tracker_processing_pool_free                  (TrackerProcessingPool   *pool);
@@ -85,6 +84,11 @@ void                   tracker_processing_pool_foreach               (TrackerPro
 void                   tracker_processing_pool_buffer_flush          (TrackerProcessingPool   *pool,
                                                                       const gchar             *reason);
 
+#ifdef PROCESSING_POOL_ENABLE_TRACE
+void                   tracker_processing_pool_set_owner             (TrackerProcessingPool   *pool,
+                                                                      GObject                 *owner);
+#endif
+
 G_END_DECLS
 
 #endif /* __LIBTRACKER_MINER_MINER_FS_PROCESSING_POOL_H__ */
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 712c5a8..1b6d38d 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -578,11 +578,16 @@ tracker_miner_fs_init (TrackerMinerFS *object)
 	                                                        (GDestroyNotify) NULL);
 
 	/* Create processing pool */
-	priv->processing_pool = tracker_processing_pool_new (G_OBJECT (object),
-	                                                     tracker_miner_get_connection (TRACKER_MINER (object)),
+	priv->processing_pool = tracker_processing_pool_new (tracker_miner_get_connection (TRACKER_MINER (object)),
 	                                                     DEFAULT_WAIT_POOL_LIMIT,
 	                                                     DEFAULT_READY_POOL_LIMIT);
 
+#ifdef PROCESSING_POOL_ENABLE_TRACE
+	/* Set owner, only if enabling traces */
+	tracker_processing_pool_set_owner (priv->processing_pool,
+	                                   G_OBJECT(object));
+#endif
+
 	/* Set up the crawlers now we have config and hal */
 	priv->crawler = tracker_crawler_new ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]