diff --git a/components/layout/animation.rs b/components/layout/animation.rs index de60a3100be..74f4400fc92 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -14,7 +14,7 @@ use script::layout_interface::Animation; use script_traits::ConstellationControlMsg; use std::collections::HashMap; use std::collections::hash_map::Entry; -use std::sync::mpsc::Sender; +use std::sync::mpsc::{Sender, Receiver}; use std::sync::{Arc, Mutex}; use style::animation::{GetMod, PropertyAnimation}; use style::properties::ComputedValues; @@ -50,9 +50,11 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Mutex, + pipeline_id: PipelineId) { let mut new_running_animations = Vec::new(); - while let Ok(animation) = rw_data.new_animations_receiver.try_recv() { + while let Ok(animation) = new_animations_receiver.try_recv() { new_running_animations.push(animation) } diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index e9e705fde85..637f2ff6f94 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -128,9 +128,6 @@ pub struct LayoutTaskData { /// The list of currently-running animations. pub running_animations: Arc>>, - /// Receives newly-discovered animations. - pub new_animations_receiver: Receiver, - /// A counter for epoch messages epoch: Epoch, @@ -222,6 +219,9 @@ pub struct LayoutTask { /// sent. new_animations_sender: Sender, + /// Receives newly-discovered animations. + new_animations_receiver: Receiver, + /// A mutex to allow for fast, read-only RPC of layout's internal data /// structures, while still letting the LayoutTask modify them. /// @@ -434,6 +434,7 @@ impl LayoutTask { parallel_traversal: parallel_traversal, generation: 0, new_animations_sender: new_animations_sender, + new_animations_receiver: new_animations_receiver, rw_data: Arc::new(Mutex::new( LayoutTaskData { root_flow: None, @@ -448,7 +449,6 @@ impl LayoutTask { running_animations: Arc::new(HashMap::new()), offset_parent_response: OffsetParentResponse::empty(), visible_rects: Arc::new(HashMap::with_hash_state(Default::default())), - new_animations_receiver: new_animations_receiver, epoch: Epoch(0), outstanding_web_fonts: outstanding_web_fonts_counter, })), @@ -1340,7 +1340,9 @@ impl LayoutTask { layout_context: &mut SharedLayoutContext) { if let Some(mut root_flow) = rw_data.layout_root() { // Kick off animations if any were triggered, expire completed ones. - animation::update_animation_state(&mut *rw_data, self.id); + animation::update_animation_state(&mut *rw_data, + &self.new_animations_receiver, + self.id); profile(time::ProfilerCategory::LayoutRestyleDamagePropagation, self.profiler_metadata(),