mirror of
https://gitlab.gnome.org/GNOME/libgnome-volume-control.git
synced 2024-12-22 04:12:07 +00:00
mixer-control: Don't specify default c_marshaller
Apart from being less code, this actually gives us a tiny performance improvement. Up until a few years ago, if you pass `NULL` as the marshaller for a signal, GLib would fall back to `g_cclosure_marshal_generic` which uses libffi to pack/unpack its arguments. One could avoid this by specifying a more specific marshaller which would then be used to immediately pack and unpack into GValues with the correct type. Lately however, as a way of optimizing signal emission (which can be quite expensive), GLib added a possibility to set a `va_marshaller`, which skips the unnecessary GValue packing and unpacking and just uses a valist variant. Since the performance difference is big enough, if the marshaller argument is NULL, `g_signal_new()` will now check for the simple marshallers (return type NONE and a single argument) and set both the generic and the valist marshaller. In other words, less code for us with behind-the-scenes optimizations. In case you also want va_marshallers for more complex signals, you can use `g_signal_set_va_marshaller()`.
This commit is contained in:
parent
dc5fd4f15e
commit
9fa985ca25
@ -3707,120 +3707,105 @@ gvc_mixer_control_class_init (GvcMixerControlClass *klass)
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, state_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [STREAM_ADDED] =
|
||||
g_signal_new ("stream-added",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, stream_added),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [STREAM_REMOVED] =
|
||||
g_signal_new ("stream-removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, stream_removed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [STREAM_CHANGED] =
|
||||
g_signal_new ("stream-changed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, stream_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [AUDIO_DEVICE_SELECTION_NEEDED] =
|
||||
g_signal_new ("audio-device-selection-needed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_generic,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_BOOLEAN, G_TYPE_UINT);
|
||||
signals [CARD_ADDED] =
|
||||
g_signal_new ("card-added",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, card_added),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [CARD_REMOVED] =
|
||||
g_signal_new ("card-removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, card_removed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [DEFAULT_SINK_CHANGED] =
|
||||
g_signal_new ("default-sink-changed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, default_sink_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [DEFAULT_SOURCE_CHANGED] =
|
||||
g_signal_new ("default-source-changed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, default_source_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [ACTIVE_OUTPUT_UPDATE] =
|
||||
g_signal_new ("active-output-update",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, active_output_update),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [ACTIVE_INPUT_UPDATE] =
|
||||
g_signal_new ("active-input-update",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, active_input_update),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [OUTPUT_ADDED] =
|
||||
g_signal_new ("output-added",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, output_added),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [INPUT_ADDED] =
|
||||
g_signal_new ("input-added",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, input_added),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [OUTPUT_REMOVED] =
|
||||
g_signal_new ("output-removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, output_removed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals [INPUT_REMOVED] =
|
||||
g_signal_new ("input-removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GvcMixerControlClass, input_removed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user