Merge branch '424-gdbus-proxy-debugging' into 'master'

gdbusproxy: Add G_DBUS_DEBUG=proxy support

Closes #424

See merge request GNOME/glib!618
This commit is contained in:
Philip Withnall 2019-01-25 14:42:52 +00:00
commit cc95f819e2
3 changed files with 25 additions and 9 deletions

View File

@ -1817,6 +1817,7 @@ _g_dbus_worker_flush_sync (GDBusWorker *worker,
#define G_DBUS_DEBUG_RETURN (1<<7)
#define G_DBUS_DEBUG_EMISSION (1<<8)
#define G_DBUS_DEBUG_ADDRESS (1<<9)
#define G_DBUS_DEBUG_PROXY (1<<10)
static gint _gdbus_debug_flags = 0;
@ -1890,6 +1891,13 @@ _g_dbus_debug_address (void)
return (_gdbus_debug_flags & G_DBUS_DEBUG_ADDRESS) != 0;
}
gboolean
_g_dbus_debug_proxy (void)
{
_g_dbus_initialize ();
return (_gdbus_debug_flags & G_DBUS_DEBUG_PROXY) != 0;
}
G_LOCK_DEFINE_STATIC (print_lock);
void
@ -1938,7 +1946,8 @@ _g_dbus_initialize (void)
{ "incoming", G_DBUS_DEBUG_INCOMING },
{ "return", G_DBUS_DEBUG_RETURN },
{ "emission", G_DBUS_DEBUG_EMISSION },
{ "address", G_DBUS_DEBUG_ADDRESS }
{ "address", G_DBUS_DEBUG_ADDRESS },
{ "proxy", G_DBUS_DEBUG_PROXY }
};
_gdbus_debug_flags = g_parse_debug_string (debug, keys, G_N_ELEMENTS (keys));

View File

@ -91,6 +91,7 @@ gboolean _g_dbus_debug_incoming (void);
gboolean _g_dbus_debug_return (void);
gboolean _g_dbus_debug_emission (void);
gboolean _g_dbus_debug_address (void);
gboolean _g_dbus_debug_proxy (void);
void _g_dbus_debug_print_lock (void);
void _g_dbus_debug_print_unlock (void);

View File

@ -1235,11 +1235,14 @@ on_name_owner_changed_get_all_cb (GDBusConnection *connection,
*
* Either way, apps can know about this by using
* get_cached_property_names() or get_cached_property().
*
* TODO: handle G_DBUS_DEBUG flag 'proxy' and, if enabled, log the
* fact that GetAll() failed
*/
//g_debug ("error: %d %d %s", error->domain, error->code, error->message);
if (G_UNLIKELY (_g_dbus_debug_proxy ()))
{
g_debug ("error: %d %d %s",
error->domain,
error->code,
error->message);
}
g_error_free (error);
}
@ -1432,11 +1435,14 @@ async_init_get_all_cb (GDBusConnection *connection,
*
* Either way, apps can know about this by using
* get_cached_property_names() or get_cached_property().
*
* TODO: handle G_DBUS_DEBUG flag 'proxy' and, if enabled, log the
* fact that GetAll() failed
*/
//g_debug ("error: %d %d %s", error->domain, error->code, error->message);
if (G_UNLIKELY (_g_dbus_debug_proxy ()))
{
g_debug ("error: %d %d %s",
error->domain,
error->code,
error->message);
}
g_error_free (error);
}