[grilo-plugins] all: Add names to all the timeouts and idles



commit 33ba4c70b55bba3ad878c40264b634af0f766674
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Feb 28 21:23:37 2014 +0100

    all: Add names to all the timeouts and idles
    
    For debugging purposes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725420

 src/apple-trailers/grl-apple-trailers.c |    4 +++-
 src/filesystem/grl-filesystem.c         |    5 ++++-
 src/jamendo/grl-jamendo.c               |    3 ++-
 src/podcasts/grl-podcasts.c             |    4 +++-
 src/shoutcast/grl-shoutcast.c           |   15 +++++++++++----
 src/vimeo/gvimeo.c                      |    4 +++-
 6 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/src/apple-trailers/grl-apple-trailers.c b/src/apple-trailers/grl-apple-trailers.c
index 7aed5bc..9b3deb4 100644
--- a/src/apple-trailers/grl-apple-trailers.c
+++ b/src/apple-trailers/grl-apple-trailers.c
@@ -489,8 +489,10 @@ xml_parse_result (const gchar *str, OperationData *op_data)
   if (!node) {
     goto finalize;
   } else {
+    guint id;
     op_data->xml_entries = node;
-    g_idle_add ((GSourceFunc) send_movie_info, op_data);
+    id = g_idle_add ((GSourceFunc) send_movie_info, op_data);
+    g_source_set_name_by_id (id, "[apple-trailers] send_movie_info");
   }
 
   return;
diff --git a/src/filesystem/grl-filesystem.c b/src/filesystem/grl-filesystem.c
index 89e58a9..143f0e6 100644
--- a/src/filesystem/grl-filesystem.c
+++ b/src/filesystem/grl-filesystem.c
@@ -534,6 +534,8 @@ produce_from_uri (GrlSourceBrowseSpec *bs, const gchar *uri, GrlOperationOptions
 
   /* Emit results */
   if (entries) {
+    guint id;
+
     /* Use the idle loop to avoid blocking for too long */
     BrowseIdleData *idle_data = g_slice_new (BrowseIdleData);
     gint global_count = grl_operation_options_get_count (bs->options);
@@ -548,7 +550,8 @@ produce_from_uri (GrlSourceBrowseSpec *bs, const gchar *uri, GrlOperationOptions
                          GUINT_TO_POINTER (bs->operation_id),
                          idle_data->cancellable);
 
-    g_idle_add (browse_emit_idle, idle_data);
+    id = g_idle_add (browse_emit_idle, idle_data);
+    g_source_set_name_by_id (id, "[filesystem] browse_emit_idle");
   } else {
     /* No results */
     bs->callback (bs->source,
diff --git a/src/jamendo/grl-jamendo.c b/src/jamendo/grl-jamendo.c
index 0dd8873..62f7a9b 100644
--- a/src/jamendo/grl-jamendo.c
+++ b/src/jamendo/grl-jamendo.c
@@ -687,7 +687,8 @@ read_done_cb (GObject *source_object,
       free_entry (entry);
       goto invoke_cb;
     } else {
-      g_idle_add (xml_parse_entries_idle, xpe);
+      guint id = g_idle_add (xml_parse_entries_idle, xpe);
+      g_source_set_name_by_id (id, "[jamendo] xml_parse_entries_idle");
     }
   } else {
     if (xpe->type == RESOLVE) {
diff --git a/src/podcasts/grl-podcasts.c b/src/podcasts/grl-podcasts.c
index 32faef4..285aace 100644
--- a/src/podcasts/grl-podcasts.c
+++ b/src/podcasts/grl-podcasts.c
@@ -1227,6 +1227,7 @@ parse_feed (OperationSpec *os, const gchar *str, GError **error)
   xmlXPathObjectPtr xpathObj = NULL;
   guint stream_count;
   PodcastData *podcast_data = NULL;
+  guint id;
 
   GRL_DEBUG ("parse_feed");
 
@@ -1334,7 +1335,8 @@ parse_feed (OperationSpec *os, const gchar *str, GError **error)
   osp->xpathCtx = xpathCtx;
   osp->xpathObj = xpathObj;
   osp->parse_count = stream_count;
-  g_idle_add (parse_entry_idle, osp);
+  id = g_idle_add (parse_entry_idle, osp);
+  g_source_set_name_by_id (id, "[podcasts] parse_entry_idle");
   return;
 
  free_resources:
diff --git a/src/shoutcast/grl-shoutcast.c b/src/shoutcast/grl-shoutcast.c
index 78b0386..96b1fc6 100644
--- a/src/shoutcast/grl-shoutcast.c
+++ b/src/shoutcast/grl-shoutcast.c
@@ -396,6 +396,7 @@ xml_parse_result (const gchar *str, OperationData *op_data)
   xmlNodePtr node;
   xmlXPathContextPtr xpath_ctx;
   xmlXPathObjectPtr xpath_res;
+  guint id;
 
   if (op_data->cancelled) {
     op_data->result_cb (op_data->source,
@@ -503,9 +504,11 @@ xml_parse_result (const gchar *str, OperationData *op_data)
   }
 
   if (stationlist_result) {
-    g_idle_add ((GSourceFunc) send_stationlist_entries, op_data);
+    id = g_idle_add ((GSourceFunc) send_stationlist_entries, op_data);
+    g_source_set_name_by_id (id, "[shoutcast] send_stationlist_entries");
   } else {
-    g_idle_add ((GSourceFunc) send_genrelist_entries, op_data);
+    id = g_idle_add ((GSourceFunc) send_genrelist_entries, op_data);
+    g_source_set_name_by_id (id, "[shoutcast] send_genrelist_entries");
   }
 
   return;
@@ -580,11 +583,13 @@ read_done_cb (GObject *source_object,
   cache = op_data->cache;
   xml_parse_result (content, op_data);
   if (cache && source->priv->cached_page_expired) {
+    guint id;
     GRL_DEBUG ("Caching page");
     g_free (source->priv->cached_page);
     source->priv->cached_page = g_strdup (content);
     source->priv->cached_page_expired = FALSE;
-    g_timeout_add_seconds (EXPIRE_CACHE_TIMEOUT, expire_cache, source);
+    id = g_timeout_add_seconds (EXPIRE_CACHE_TIMEOUT, expire_cache, source);
+    g_source_set_name_by_id (id, "[shoutcast] expire_cache");
   }
 }
 
@@ -602,8 +607,10 @@ read_url_async (GrlShoutcastSource *source,
                 OperationData *op_data)
 {
   if (op_data->cache && !source->priv->cached_page_expired) {
+    guint id;
     GRL_DEBUG ("Using cached page");
-    g_idle_add ((GSourceFunc) read_cached_page, op_data);
+    id = g_idle_add ((GSourceFunc) read_cached_page, op_data);
+    g_source_set_name_by_id (id, "[shoutcast] read_cached_page");
   } else {
     if (!source->priv->wc)
       source->priv->wc = grl_net_wc_new ();
diff --git a/src/vimeo/gvimeo.c b/src/vimeo/gvimeo.c
index e541938..1e89c30 100644
--- a/src/vimeo/gvimeo.c
+++ b/src/vimeo/gvimeo.c
@@ -497,6 +497,7 @@ g_vimeo_video_get_play_url (GVimeo *vimeo,
                            gpointer user_data)
 {
   GVimeoVideoURLData *data;
+  guint tag_id;
 
   data = g_slice_new (GVimeoVideoURLData);
   data->vimeo = g_object_ref (vimeo);
@@ -504,5 +505,6 @@ g_vimeo_video_get_play_url (GVimeo *vimeo,
   data->callback = callback;
   data->user_data = user_data;
 
-  g_idle_add ((GSourceFunc) get_video_play_url_cb, data);
+  tag_id = g_idle_add ((GSourceFunc) get_video_play_url_cb, data);
+  g_source_set_name_by_id (tag_id, "[vimeo] get_video_play_url_cb");
 }


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