Pass the constellation_chan to animation::update_animation_state directly.

This commit is contained in:
Ms2ger 2015-11-06 17:56:02 +01:00
parent c469d09543
commit 4c3038f378
2 changed files with 6 additions and 8 deletions

View file

@ -9,7 +9,7 @@ use flow::{self, Flow};
use gfx::display_list::OpaqueNode; use gfx::display_list::OpaqueNode;
use incremental::{self, RestyleDamage}; use incremental::{self, RestyleDamage};
use layout_task::{LayoutTask, LayoutTaskData}; use layout_task::{LayoutTask, LayoutTaskData};
use msg::constellation_msg::{AnimationState, Msg, PipelineId}; use msg::constellation_msg::{AnimationState, ConstellationChan, Msg, PipelineId};
use script::layout_interface::Animation; use script::layout_interface::Animation;
use script_traits::ConstellationControlMsg; use script_traits::ConstellationControlMsg;
use std::collections::HashMap; use std::collections::HashMap;
@ -50,7 +50,7 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Mutex<Sender<Anim
/// Processes any new animations that were discovered after style recalculation. /// Processes any new animations that were discovered after style recalculation.
/// Also expire any old animations that have completed. /// Also expire any old animations that have completed.
pub fn update_animation_state(rw_data: &mut LayoutTaskData, pub fn update_animation_state(constellation_chan: &ConstellationChan,
running_animations: &mut Arc<HashMap<OpaqueNode, Vec<Animation>>>, running_animations: &mut Arc<HashMap<OpaqueNode, Vec<Animation>>>,
new_animations_receiver: &Receiver<Animation>, new_animations_receiver: &Receiver<Animation>,
pipeline_id: PipelineId) { pipeline_id: PipelineId) {
@ -101,11 +101,9 @@ pub fn update_animation_state(rw_data: &mut LayoutTaskData,
animation_state = AnimationState::AnimationsPresent; animation_state = AnimationState::AnimationsPresent;
} }
rw_data.constellation_chan constellation_chan.0
.0
.send(Msg::ChangeRunningAnimationsState(pipeline_id, animation_state)) .send(Msg::ChangeRunningAnimationsState(pipeline_id, animation_state))
.unwrap(); .unwrap();
} }
/// Recalculates style for a set of animations. This does *not* run with the DOM lock held. /// Recalculates style for a set of animations. This does *not* run with the DOM lock held.

View file

@ -1332,7 +1332,7 @@ impl LayoutTask {
layout_context: &mut SharedLayoutContext) { layout_context: &mut SharedLayoutContext) {
if let Some(mut root_flow) = self.root_flow.clone() { if let Some(mut root_flow) = self.root_flow.clone() {
// Kick off animations if any were triggered, expire completed ones. // Kick off animations if any were triggered, expire completed ones.
animation::update_animation_state(&mut *rw_data, animation::update_animation_state(&self.constellation_chan,
&mut self.running_animations, &mut self.running_animations,
&self.new_animations_receiver, &self.new_animations_receiver,
self.id); self.id);