From 85f811f1472d5b7cb6a42ec08702e239469120c1 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 10 Apr 2014 19:27:23 +0200 Subject: [PATCH] src: Name all the timeouts and idles https://bugzilla.gnome.org/show_bug.cgi?id=727983 --- src/calendar-server/calendar-sources.c | 1 + .../gnome-shell-calendar-server.c | 1 + src/hotplug-sniffer/hotplug-sniffer.c | 1 + src/hotplug-sniffer/shell-mime-sniffer.c | 1 + src/shell-app-usage.c | 1 + src/shell-global.c | 9 ++++--- src/shell-perf-helper.c | 1 + src/shell-perf-log.c | 1 + src/shell-polkit-authentication-agent.c | 5 +++- src/shell-recorder-src.c | 5 +++- src/shell-recorder.c | 26 +++++++++++++------ src/st/st-scroll-bar.c | 2 ++ src/st/st-theme-context.c | 5 +++- 13 files changed, 45 insertions(+), 14 deletions(-) diff --git a/src/calendar-server/calendar-sources.c b/src/calendar-server/calendar-sources.c index cc9cf1d79..219fc451f 100644 --- a/src/calendar-server/calendar-sources.c +++ b/src/calendar-server/calendar-sources.c @@ -369,6 +369,7 @@ backend_died_cb (EClient *client, CalendarSourceData *source_data) source_data->timeout_id = g_timeout_add_seconds (2, backend_restart, source_data); + g_source_set_name_by_id (source_data->timeout_id, "[gnome-shell] backend_restart"); } static void diff --git a/src/calendar-server/gnome-shell-calendar-server.c b/src/calendar-server/gnome-shell-calendar-server.c index d35306624..da7d6e8fe 100644 --- a/src/calendar-server/gnome-shell-calendar-server.c +++ b/src/calendar-server/gnome-shell-calendar-server.c @@ -537,6 +537,7 @@ app_schedule_changed (App *app) app->changed_timeout_id = g_timeout_add (2000, on_app_schedule_changed_cb, app); + g_source_set_name_by_id (app->changed_timeout_id, "[gnome-shell] on_app_schedule_changed_cb"); } } diff --git a/src/hotplug-sniffer/hotplug-sniffer.c b/src/hotplug-sniffer/hotplug-sniffer.c index 239f8b91b..c229af51f 100644 --- a/src/hotplug-sniffer/hotplug-sniffer.c +++ b/src/hotplug-sniffer/hotplug-sniffer.c @@ -76,6 +76,7 @@ ensure_autoquit_on (void) autoquit_id = g_timeout_add_seconds (AUTOQUIT_TIMEOUT, autoquit_timeout_cb, NULL); + g_source_set_name_by_id (autoquit_id, "[gnome-shell] autoquit_timeout_cb"); } typedef struct { diff --git a/src/hotplug-sniffer/shell-mime-sniffer.c b/src/hotplug-sniffer/shell-mime-sniffer.c index d4253ca32..723249692 100644 --- a/src/hotplug-sniffer/shell-mime-sniffer.c +++ b/src/hotplug-sniffer/shell-mime-sniffer.c @@ -590,6 +590,7 @@ shell_mime_sniffer_sniff_async (ShellMimeSniffer *self, self->priv->watchdog_id = g_timeout_add (WATCHDOG_TIMEOUT, watchdog_timeout_reached_cb, self); + g_source_set_name_by_id (self->priv->watchdog_id, "[gnome-shell] watchdog_timeout_reached_cb"); start_loading_file (self); } diff --git a/src/shell-app-usage.c b/src/shell-app-usage.c index c733ce4c5..799028109 100644 --- a/src/shell-app-usage.c +++ b/src/shell-app-usage.c @@ -567,6 +567,7 @@ ensure_queued_save (ShellAppUsage *self) if (self->save_id != 0) return; self->save_id = g_timeout_add_seconds (SAVE_APPS_TIMEOUT_SECONDS, idle_save_application_usage, self); + g_source_set_name_by_id (self->save_id, "[gnome-shell] idle_save_application_usage"); } /* Clean up apps we see rarely. diff --git a/src/shell-global.c b/src/shell-global.c index d6de365ea..78d149fae 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -1434,9 +1434,12 @@ schedule_leisure_functions (ShellGlobal *global) * in another thread. */ if (!global->leisure_function_id) - global->leisure_function_id = g_idle_add_full (G_PRIORITY_LOW, - run_leisure_functions, - global, NULL); + { + global->leisure_function_id = g_idle_add_full (G_PRIORITY_LOW, + run_leisure_functions, + global, NULL); + g_source_set_name_by_id (global->leisure_function_id, "[gnome-shell] run_leisure_functions"); + } } /** diff --git a/src/shell-perf-helper.c b/src/shell-perf-helper.c index 92de68b0a..6d955bfd5 100644 --- a/src/shell-perf-helper.c +++ b/src/shell-perf-helper.c @@ -81,6 +81,7 @@ establish_timeout () g_source_remove (timeout_id); timeout_id = g_timeout_add (opt_idle_timeout * 1000, on_timeout, NULL); + g_source_set_name_by_id (timeout_id, "[gnome-shell] on_timeout"); } static void diff --git a/src/shell-perf-log.c b/src/shell-perf-log.c index 72c4210e2..6c1f293ce 100644 --- a/src/shell-perf-log.c +++ b/src/shell-perf-log.c @@ -223,6 +223,7 @@ shell_perf_log_set_enabled (ShellPerfLog *perf_log, perf_log->statistics_timeout_id = g_timeout_add (STATISTIC_COLLECTION_INTERVAL_MS, statistics_timeout, perf_log); + g_source_set_name_by_id (perf_log->statistics_timeout_id, "[gnome-shell] statistics_timeout"); } else { diff --git a/src/shell-polkit-authentication-agent.c b/src/shell-polkit-authentication-agent.c index f1e8bf6d0..3a15e2dd2 100644 --- a/src/shell-polkit-authentication-agent.c +++ b/src/shell-polkit-authentication-agent.c @@ -300,11 +300,14 @@ on_request_cancelled (GCancellable *cancellable, gpointer user_data) { AuthRequest *request = user_data; + guint id; + /* post-pone to idle to handle GCancellable deadlock in * * https://bugzilla.gnome.org/show_bug.cgi?id=642968 */ - g_idle_add (handle_cancelled_in_idle, request); + id = g_idle_add (handle_cancelled_in_idle, request); + g_source_set_name_by_id (id, "[gnome-shell] handle_cancelled_in_idle"); } static void diff --git a/src/shell-recorder-src.c b/src/shell-recorder-src.c index 5e325cf02..dd4b37734 100644 --- a/src/shell-recorder-src.c +++ b/src/shell-recorder-src.c @@ -78,7 +78,10 @@ shell_recorder_src_update_memory_used (ShellRecorderSrc *src, g_mutex_lock (src->mutex); src->memory_used += delta; if (src->memory_used_update_idle == 0) - src->memory_used_update_idle = g_idle_add (shell_recorder_src_memory_used_update_idle, src); + { + src->memory_used_update_idle = g_idle_add (shell_recorder_src_memory_used_update_idle, src); + g_source_set_name_by_id (src->memory_used_update_idle, "[gnome-shell] shell_recorder_src_memory_used_update_idle"); + } g_mutex_unlock (src->mutex); } diff --git a/src/shell-recorder.c b/src/shell-recorder.c index 23f2c072c..1a0b208a0 100644 --- a/src/shell-recorder.c +++ b/src/shell-recorder.c @@ -311,6 +311,7 @@ recorder_add_redraw_timeout (ShellRecorder *recorder) recorder->redraw_timeout = g_timeout_add (MAXIMUM_PAUSE_TIME, recorder_redraw_timeout, recorder); + g_source_set_name_by_id (recorder->redraw_timeout, "[gnome-shell] recorder_redraw_timeout"); } } @@ -533,8 +534,11 @@ recorder_queue_redraw (ShellRecorder *recorder) * we need to queue a "low priority redraw" after timeline updates */ if (recorder->state == RECORDER_STATE_RECORDING && recorder->redraw_idle == 0) - recorder->redraw_idle = g_idle_add_full (CLUTTER_PRIORITY_REDRAW + 1, - recorder_idle_redraw, recorder, NULL); + { + recorder->redraw_idle = g_idle_add_full (CLUTTER_PRIORITY_REDRAW + 1, + recorder_idle_redraw, recorder, NULL); + g_source_set_name_by_id (recorder->redraw_idle, "[gnome-shell] recorder_idle_redraw"); + } } static void @@ -720,9 +724,12 @@ static void recorder_add_update_pointer_timeout (ShellRecorder *recorder) { if (!recorder->update_pointer_timeout) - recorder->update_pointer_timeout = g_timeout_add (UPDATE_POINTER_TIME, - recorder_update_pointer_timeout, - recorder); + { + recorder->update_pointer_timeout = g_timeout_add (UPDATE_POINTER_TIME, + recorder_update_pointer_timeout, + recorder); + g_source_set_name_by_id (recorder->update_pointer_timeout, "[gnome-shell] recorder_update_pointer_timeout"); + } } static void @@ -1336,9 +1343,12 @@ recorder_pipeline_on_memory_used_changed (ShellRecorderSrc *src, return; if (recorder->update_memory_used_timeout == 0) - recorder->update_memory_used_timeout = g_timeout_add (UPDATE_MEMORY_USED_DELAY, - recorder_update_memory_used_timeout, - recorder); + { + recorder->update_memory_used_timeout = g_timeout_add (UPDATE_MEMORY_USED_DELAY, + recorder_update_memory_used_timeout, + recorder); + g_source_set_name_by_id (recorder->update_memory_used_timeout, "[gnome-shell] recorder_update_memory_used_timeout"); + } } static void diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c index f908101dd..b8161ea35 100644 --- a/src/st/st-scroll-bar.c +++ b/src/st/st-scroll-bar.c @@ -692,6 +692,7 @@ trough_paging_cb (StScrollBar *self) PAGING_INITIAL_REPEAT_TIMEOUT, (GSourceFunc) trough_paging_cb, self); + g_source_set_name_by_id (self->priv->paging_source_id, "[gnome-shell] trough_paging_cb"); } else if (self->priv->paging_event_no == 1) { @@ -703,6 +704,7 @@ trough_paging_cb (StScrollBar *self) PAGING_SUBSEQUENT_REPEAT_TIMEOUT, (GSourceFunc) trough_paging_cb, self); + g_source_set_name_by_id (self->priv->paging_source_id, "[gnome-shell] trough_paging_cb"); } else { diff --git a/src/st/st-theme-context.c b/src/st/st-theme-context.c index 34ac2955b..25d03cceb 100644 --- a/src/st/st-theme-context.c +++ b/src/st/st-theme-context.c @@ -246,12 +246,15 @@ static void on_icon_theme_changed (StTextureCache *cache, StThemeContext *context) { + guint id; + /* Note that an icon theme change isn't really a change of the StThemeContext; * the style information has changed. But since the style factors into the * icon_name => icon lookup, faking a theme context change is a good way * to force users such as StIcon to look up icons again. */ - g_idle_add ((GSourceFunc) changed_idle, context); + id = g_idle_add ((GSourceFunc) changed_idle, context); + g_source_set_name_by_id (id, "[gnome-shell] changed_idle"); } /**