mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
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:
@ -39,6 +39,8 @@ struct _SysprofInstrumentClass
|
||||
GObjectClass parent_class;
|
||||
|
||||
char **(*list_required_policy) (SysprofInstrument *self);
|
||||
void (*set_connection) (SysprofInstrument *self,
|
||||
GDBusConnection *connection);
|
||||
DexFuture *(*prepare) (SysprofInstrument *self,
|
||||
SysprofRecording *recording);
|
||||
DexFuture *(*record) (SysprofInstrument *self,
|
||||
@ -52,6 +54,8 @@ struct _SysprofInstrumentClass
|
||||
const char *comm);
|
||||
};
|
||||
|
||||
void _sysprof_instruments_set_connection (GPtrArray *instruments,
|
||||
GDBusConnection *connection);
|
||||
DexFuture *_sysprof_instruments_acquire_policy (GPtrArray *instruments,
|
||||
SysprofRecording *recording);
|
||||
DexFuture *_sysprof_instruments_prepare (GPtrArray *instruments,
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user