diff options
author | Ms2ger <Ms2ger@gmail.com> | 2015-11-06 17:51:58 +0100 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2015-11-09 09:04:02 +0100 |
commit | c469d09543ff8ae94104e499b4347c333fd137bb (patch) | |
tree | 841d06ff5a25a1bc6f5ba4bf2b8479cceb77b818 /components | |
parent | ee2b77e8f5bb1a87c97ac639bc99fbdf8c223243 (diff) | |
download | servo-c469d09543ff8ae94104e499b4347c333fd137bb.tar.gz servo-c469d09543ff8ae94104e499b4347c333fd137bb.zip |
Move running_animations from LayoutTaskData to LayoutTask.
Diffstat (limited to 'components')
-rw-r--r-- | components/layout/animation.rs | 7 | ||||
-rw-r--r-- | components/layout/layout_task.rs | 13 |
2 files changed, 11 insertions, 9 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 74f4400fc92..786c1dba92e 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -51,6 +51,7 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Mutex<Sender<Anim /// Processes any new animations that were discovered after style recalculation. /// Also expire any old animations that have completed. pub fn update_animation_state(rw_data: &mut LayoutTaskData, + running_animations: &mut Arc<HashMap<OpaqueNode, Vec<Animation>>>, new_animations_receiver: &Receiver<Animation>, pipeline_id: PipelineId) { let mut new_running_animations = Vec::new(); @@ -58,7 +59,7 @@ pub fn update_animation_state(rw_data: &mut LayoutTaskData, new_running_animations.push(animation) } - let mut running_animations_hash = (*rw_data.running_animations).clone(); + let mut running_animations_hash = (**running_animations).clone(); if running_animations_hash.is_empty() && new_running_animations.is_empty() { // Nothing to do. Return early so we don't flood the compositor with @@ -91,10 +92,10 @@ pub fn update_animation_state(rw_data: &mut LayoutTaskData, } } - rw_data.running_animations = Arc::new(running_animations_hash); + *running_animations = Arc::new(running_animations_hash); let animation_state; - if rw_data.running_animations.is_empty() { + if running_animations.is_empty() { animation_state = AnimationState::NoAnimationsPresent; } else { animation_state = AnimationState::AnimationsPresent; diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index ee4008ede39..2b0c3b1f90d 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -122,9 +122,6 @@ pub struct LayoutTaskData { /// A queued response for the offset parent/rect of a node. pub offset_parent_response: OffsetParentResponse, - /// The list of currently-running animations. - pub running_animations: Arc<HashMap<OpaqueNode, Vec<Animation>>>, - /// A counter for epoch messages epoch: Epoch, } @@ -214,6 +211,9 @@ pub struct LayoutTask { /// for any areas more than `DISPLAY_PORT_SIZE_FACTOR` screens away from this area. visible_rects: Arc<HashMap<LayerId, Rect<Au>, DefaultState<FnvHasher>>>, + /// The list of currently-running animations. + running_animations: Arc<HashMap<OpaqueNode, Vec<Animation>>>, + /// A mutex to allow for fast, read-only RPC of layout's internal data /// structures, while still letting the LayoutTask modify them. /// @@ -430,6 +430,7 @@ impl LayoutTask { outstanding_web_fonts: outstanding_web_fonts_counter, root_flow: None, visible_rects: Arc::new(HashMap::with_hash_state(Default::default())), + running_animations: Arc::new(HashMap::new()), rw_data: Arc::new(Mutex::new( LayoutTaskData { constellation_chan: constellation_chan, @@ -440,7 +441,6 @@ impl LayoutTask { content_boxes_response: Vec::new(), client_rect_response: Rect::zero(), resolved_style_response: None, - running_animations: Arc::new(HashMap::new()), offset_parent_response: OffsetParentResponse::empty(), epoch: Epoch(0), })), @@ -480,7 +480,7 @@ impl LayoutTask { generation: self.generation, new_animations_sender: Mutex::new(self.new_animations_sender.clone()), goal: goal, - running_animations: rw_data.running_animations.clone(), + running_animations: self.running_animations.clone(), } } @@ -1288,7 +1288,7 @@ impl LayoutTask { if let Some(mut root_flow) = self.root_flow.clone() { // Perform an abbreviated style recalc that operates without access to the DOM. - let animations = &*rw_data.running_animations; + let animations = &*self.running_animations; profile(time::ProfilerCategory::LayoutStyleRecalc, self.profiler_metadata(), self.time_profiler_chan.clone(), @@ -1333,6 +1333,7 @@ impl LayoutTask { if let Some(mut root_flow) = self.root_flow.clone() { // Kick off animations if any were triggered, expire completed ones. animation::update_animation_state(&mut *rw_data, + &mut self.running_animations, &self.new_animations_receiver, self.id); |