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

@@ -186,6 +186,7 @@ g_tls_database_real_verify_chain_async (GTlsDatabase *self,
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, g_tls_database_real_verify_chain_async);
g_task_set_name (task, "[gio] verify TLS chain");
g_task_set_task_data (task, args, async_verify_chain_free);
g_task_run_in_thread (task, async_verify_chain_thread);
g_object_unref (task);
@@ -264,6 +265,7 @@ g_tls_database_real_lookup_certificate_for_handle_async (GTlsDatabase
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task,
g_tls_database_real_lookup_certificate_for_handle_async);
g_task_set_name (task, "[gio] lookup TLS certificate");
g_task_set_task_data (task, args, async_lookup_certificate_for_handle_free);
g_task_run_in_thread (task, async_lookup_certificate_for_handle_thread);
g_object_unref (task);
@@ -338,6 +340,7 @@ g_tls_database_real_lookup_certificate_issuer_async (GTlsDatabase *sel
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task,
g_tls_database_real_lookup_certificate_issuer_async);
g_task_set_name (task, "[gio] lookup certificate issuer");
g_task_set_task_data (task, args, async_lookup_certificate_issuer_free);
g_task_run_in_thread (task, async_lookup_certificate_issuer_thread);
g_object_unref (task);
@@ -419,6 +422,7 @@ g_tls_database_real_lookup_certificates_issued_by_async (GTlsDatabase
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task,
g_tls_database_real_lookup_certificates_issued_by_async);
g_task_set_name (task, "[gio] lookup certificates issued by");
g_task_set_task_data (task, args, async_lookup_certificates_issued_by_free);
g_task_run_in_thread (task, async_lookup_certificates_issued_by_thread);
g_object_unref (task);