libsysprof/instruments: add set_connection() vfunc

This is used to tell the instruments what GDBusConnection they should use
to query sysprofd. Lack of a connection means they should try to do things
in process without querying sysprofd.
This commit is contained in:
Christian Hergert
2025-03-21 12:00:55 -07:00
parent 2971f34541
commit 637dfceb85
2 changed files with 20 additions and 0 deletions

View File

@ -310,3 +310,19 @@ _sysprof_instruments_process_started (GPtrArray *instruments,
return dex_future_allv ((DexFuture **)futures->pdata, futures->len);
}
void
_sysprof_instruments_set_connection (GPtrArray *instruments,
GDBusConnection *connection)
{
g_return_if_fail (instruments != NULL);
g_return_if_fail (!connection || G_IS_DBUS_CONNECTION (connection));
for (guint i = 0; i < instruments->len; i++)
{
SysprofInstrument *instrument = g_ptr_array_index (instruments, i);
if (SYSPROF_INSTRUMENT_GET_CLASS (instrument)->set_connection)
SYSPROF_INSTRUMENT_GET_CLASS (instrument)->set_connection (instrument, connection);
}
}