mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2025-12-20 05:20:05 +01:00
Merge branch 'object-activation-improvements' into 'master'
object: Remove the idle callback on activation See merge request pipewire/wireplumber!654
This commit is contained in:
commit
25103e860f
1 changed files with 5 additions and 43 deletions
|
|
@ -147,7 +147,6 @@ struct _WpObjectPrivate
|
|||
/* features state */
|
||||
WpObjectFeatures ft_active;
|
||||
GQueue *transitions; // element-type: WpFeatureActivationTransition*
|
||||
GSource *idle_advnc_source;
|
||||
GWeakRef ongoing_transition;
|
||||
};
|
||||
|
||||
|
|
@ -184,15 +183,11 @@ static void
|
|||
wp_object_dispose (GObject * object)
|
||||
{
|
||||
WpObject *self = WP_OBJECT (object);
|
||||
WpObjectPrivate *priv = wp_object_get_instance_private (self);
|
||||
|
||||
wp_trace_object (self, "dispose");
|
||||
|
||||
wp_object_deactivate (self, WP_OBJECT_FEATURES_ALL);
|
||||
|
||||
if (priv->idle_advnc_source)
|
||||
g_source_destroy (priv->idle_advnc_source);
|
||||
|
||||
G_OBJECT_CLASS (wp_object_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +200,6 @@ wp_object_finalize (GObject * object)
|
|||
/* there should be no transitions, since transitions hold a ref on WpObject */
|
||||
g_warn_if_fail (g_queue_is_empty (priv->transitions));
|
||||
g_clear_pointer (&priv->transitions, g_queue_free);
|
||||
g_clear_pointer (&priv->idle_advnc_source, g_source_unref);
|
||||
g_weak_ref_clear (&priv->ongoing_transition);
|
||||
g_weak_ref_clear (&priv->core);
|
||||
|
||||
|
|
@ -389,16 +383,11 @@ wp_object_advance_transitions (WpObject * self)
|
|||
WpObjectPrivate *priv = wp_object_get_instance_private (self);
|
||||
g_autoptr (WpTransition) t = NULL;
|
||||
|
||||
/* clear before advancing; a transition may need to schedule
|
||||
a new call to wp_object_advance_transitions() */
|
||||
g_clear_pointer (&priv->idle_advnc_source, g_source_unref);
|
||||
|
||||
/* advance ongoing transition if any */
|
||||
t = g_weak_ref_get (&priv->ongoing_transition);
|
||||
if (t) {
|
||||
if (t && !wp_transition_get_completed (t)) {
|
||||
wp_transition_advance (t);
|
||||
if (!wp_transition_get_completed (t))
|
||||
return G_SOURCE_REMOVE;
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
/* set next transition and advance */
|
||||
|
|
@ -415,8 +404,6 @@ static void
|
|||
on_transition_completed (WpTransition * transition, GParamSpec * param,
|
||||
WpObject * self)
|
||||
{
|
||||
WpObjectPrivate *priv = wp_object_get_instance_private (self);
|
||||
|
||||
/* abort activation if a transition failed */
|
||||
if (wp_transition_had_error (transition)) {
|
||||
wp_object_abort_activation (self, "a transition failed");
|
||||
|
|
@ -424,14 +411,7 @@ on_transition_completed (WpTransition * transition, GParamSpec * param,
|
|||
}
|
||||
|
||||
/* advance pending transitions */
|
||||
if (!g_queue_is_empty (priv->transitions) && !priv->idle_advnc_source) {
|
||||
g_autoptr (WpCore) core = wp_object_get_core (self);
|
||||
g_return_if_fail (core != NULL);
|
||||
|
||||
wp_core_idle_add (core, &priv->idle_advnc_source,
|
||||
G_SOURCE_FUNC (wp_object_advance_transitions), g_object_ref (self),
|
||||
g_object_unref);
|
||||
}
|
||||
wp_object_advance_transitions (self);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -482,9 +462,6 @@ wp_object_activate_closure (WpObject * self,
|
|||
g_return_if_fail (WP_IS_OBJECT (self));
|
||||
|
||||
WpObjectPrivate *priv = wp_object_get_instance_private (self);
|
||||
g_autoptr (WpCore) core = wp_object_get_core (self);
|
||||
|
||||
g_return_if_fail (core != NULL);
|
||||
|
||||
WpTransition *transition = wp_transition_new_closure (
|
||||
WP_TYPE_FEATURE_ACTIVATION_TRANSITION, self, cancellable, closure);
|
||||
|
|
@ -495,11 +472,7 @@ wp_object_activate_closure (WpObject * self,
|
|||
|
||||
g_queue_push_tail (priv->transitions, transition);
|
||||
|
||||
if (!priv->idle_advnc_source) {
|
||||
wp_core_idle_add (core, &priv->idle_advnc_source,
|
||||
G_SOURCE_FUNC (wp_object_advance_transitions), g_object_ref (self),
|
||||
g_object_unref);
|
||||
}
|
||||
wp_object_advance_transitions (self);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -563,8 +536,6 @@ wp_object_abort_activation (WpObject * self, const gchar *msg)
|
|||
|
||||
priv = wp_object_get_instance_private (self);
|
||||
|
||||
g_clear_pointer (&priv->idle_advnc_source, g_source_unref);
|
||||
|
||||
/* abort ongoing transition if any */
|
||||
t = g_weak_ref_get (&priv->ongoing_transition);
|
||||
if (t && !wp_transition_get_completed (t)) {
|
||||
|
|
@ -604,7 +575,6 @@ wp_object_update_features (WpObject * self, WpObjectFeatures activated,
|
|||
|
||||
WpObjectPrivate *priv = wp_object_get_instance_private (self);
|
||||
guint old_ft = priv->ft_active;
|
||||
g_autoptr (WpTransition) t = NULL;
|
||||
|
||||
priv->ft_active |= activated;
|
||||
priv->ft_active &= ~deactivated;
|
||||
|
|
@ -615,13 +585,5 @@ wp_object_update_features (WpObject * self, WpObjectFeatures activated,
|
|||
g_object_notify (G_OBJECT (self), "active-features");
|
||||
}
|
||||
|
||||
t = g_weak_ref_get (&priv->ongoing_transition);
|
||||
if ((t || !g_queue_is_empty (priv->transitions)) && !priv->idle_advnc_source) {
|
||||
g_autoptr (WpCore) core = wp_object_get_core (self);
|
||||
g_return_if_fail (core != NULL);
|
||||
|
||||
wp_core_idle_add (core, &priv->idle_advnc_source,
|
||||
G_SOURCE_FUNC (wp_object_advance_transitions), g_object_ref (self),
|
||||
g_object_unref);
|
||||
}
|
||||
wp_object_advance_transitions (self);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue