mirror of
https://gitlab.gnome.org/GNOME/libgnome-volume-control.git
synced 2024-11-23 17:30:40 -05: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_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, state_changed),
|
G_STRUCT_OFFSET (GvcMixerControlClass, state_changed),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [STREAM_ADDED] =
|
signals [STREAM_ADDED] =
|
||||||
g_signal_new ("stream-added",
|
g_signal_new ("stream-added",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, stream_added),
|
G_STRUCT_OFFSET (GvcMixerControlClass, stream_added),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [STREAM_REMOVED] =
|
signals [STREAM_REMOVED] =
|
||||||
g_signal_new ("stream-removed",
|
g_signal_new ("stream-removed",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, stream_removed),
|
G_STRUCT_OFFSET (GvcMixerControlClass, stream_removed),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [STREAM_CHANGED] =
|
signals [STREAM_CHANGED] =
|
||||||
g_signal_new ("stream-changed",
|
g_signal_new ("stream-changed",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, stream_changed),
|
G_STRUCT_OFFSET (GvcMixerControlClass, stream_changed),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [AUDIO_DEVICE_SELECTION_NEEDED] =
|
signals [AUDIO_DEVICE_SELECTION_NEEDED] =
|
||||||
g_signal_new ("audio-device-selection-needed",
|
g_signal_new ("audio-device-selection-needed",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
0,
|
0,
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_generic,
|
|
||||||
G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_BOOLEAN, G_TYPE_UINT);
|
G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_BOOLEAN, G_TYPE_UINT);
|
||||||
signals [CARD_ADDED] =
|
signals [CARD_ADDED] =
|
||||||
g_signal_new ("card-added",
|
g_signal_new ("card-added",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, card_added),
|
G_STRUCT_OFFSET (GvcMixerControlClass, card_added),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [CARD_REMOVED] =
|
signals [CARD_REMOVED] =
|
||||||
g_signal_new ("card-removed",
|
g_signal_new ("card-removed",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, card_removed),
|
G_STRUCT_OFFSET (GvcMixerControlClass, card_removed),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [DEFAULT_SINK_CHANGED] =
|
signals [DEFAULT_SINK_CHANGED] =
|
||||||
g_signal_new ("default-sink-changed",
|
g_signal_new ("default-sink-changed",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, default_sink_changed),
|
G_STRUCT_OFFSET (GvcMixerControlClass, default_sink_changed),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [DEFAULT_SOURCE_CHANGED] =
|
signals [DEFAULT_SOURCE_CHANGED] =
|
||||||
g_signal_new ("default-source-changed",
|
g_signal_new ("default-source-changed",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, default_source_changed),
|
G_STRUCT_OFFSET (GvcMixerControlClass, default_source_changed),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [ACTIVE_OUTPUT_UPDATE] =
|
signals [ACTIVE_OUTPUT_UPDATE] =
|
||||||
g_signal_new ("active-output-update",
|
g_signal_new ("active-output-update",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, active_output_update),
|
G_STRUCT_OFFSET (GvcMixerControlClass, active_output_update),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [ACTIVE_INPUT_UPDATE] =
|
signals [ACTIVE_INPUT_UPDATE] =
|
||||||
g_signal_new ("active-input-update",
|
g_signal_new ("active-input-update",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, active_input_update),
|
G_STRUCT_OFFSET (GvcMixerControlClass, active_input_update),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [OUTPUT_ADDED] =
|
signals [OUTPUT_ADDED] =
|
||||||
g_signal_new ("output-added",
|
g_signal_new ("output-added",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, output_added),
|
G_STRUCT_OFFSET (GvcMixerControlClass, output_added),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [INPUT_ADDED] =
|
signals [INPUT_ADDED] =
|
||||||
g_signal_new ("input-added",
|
g_signal_new ("input-added",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, input_added),
|
G_STRUCT_OFFSET (GvcMixerControlClass, input_added),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [OUTPUT_REMOVED] =
|
signals [OUTPUT_REMOVED] =
|
||||||
g_signal_new ("output-removed",
|
g_signal_new ("output-removed",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, output_removed),
|
G_STRUCT_OFFSET (GvcMixerControlClass, output_removed),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
signals [INPUT_REMOVED] =
|
signals [INPUT_REMOVED] =
|
||||||
g_signal_new ("input-removed",
|
g_signal_new ("input-removed",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GvcMixerControlClass, input_removed),
|
G_STRUCT_OFFSET (GvcMixerControlClass, input_removed),
|
||||||
NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user