gtask: Improve task names used internally within GLib

And improve them externally, where not otherwise set, by setting them
from the function name passed to `g_task_set_source_tag()`, if called by
third party code.

This should make profiling and debug output from GLib more useful.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall
2020-06-25 23:36:08 +01:00
parent 7cd67c935f
commit b08bd04abe
11 changed files with 42 additions and 8 deletions

View File

@@ -305,7 +305,8 @@ eject_mount_do (GVolume *volume,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data,
const gchar * const *argv)
const gchar * const *argv,
const gchar *task_name)
{
GSubprocess *subprocess;
GError *error = NULL;
@@ -313,6 +314,7 @@ eject_mount_do (GVolume *volume,
task = g_task_new (volume, cancellable, callback, user_data);
g_task_set_source_tag (task, eject_mount_do);
g_task_set_name (task, task_name);
if (g_task_return_error_if_cancelled (task))
{
@@ -344,7 +346,7 @@ g_unix_volume_mount (GVolume *volume,
else
argv[1] = unix_volume->device_path;
eject_mount_do (volume, cancellable, callback, user_data, argv);
eject_mount_do (volume, cancellable, callback, user_data, argv, "[gio] mount volume");
}
static gboolean
@@ -369,7 +371,7 @@ g_unix_volume_eject (GVolume *volume,
argv[1] = unix_volume->device_path;
eject_mount_do (volume, cancellable, callback, user_data, argv);
eject_mount_do (volume, cancellable, callback, user_data, argv, "[gio] eject volume");
}
static gboolean