aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/layout/animation.rs11
-rw-r--r--components/layout/layout_task.rs49
2 files changed, 23 insertions, 37 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs
index 247765c8d92..84b7a30479f 100644
--- a/components/layout/animation.rs
+++ b/components/layout/animation.rs
@@ -8,10 +8,8 @@ use clock_ticks;
use flow::{self, Flow};
use gfx::display_list::OpaqueNode;
use incremental::{self, RestyleDamage};
-use layout_task::{LayoutTask, LayoutTaskData};
use msg::constellation_msg::{AnimationState, ConstellationChan, Msg, PipelineId};
use script::layout_interface::Animation;
-use script_traits::ConstellationControlMsg;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::sync::mpsc::{Sender, Receiver};
@@ -138,12 +136,3 @@ pub fn recalc_style_for_animations(flow: &mut Flow,
recalc_style_for_animations(kid, animations)
}
}
-
-/// Handles animation updates.
-pub fn tick_all_animations(layout_task: &mut LayoutTask, rw_data: &mut LayoutTaskData) {
- layout_task.tick_animations(rw_data);
-
- layout_task.script_chan
- .send(ConstellationControlMsg::TickAllAnimations(layout_task.id))
- .unwrap();
-}
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index 603a08491d0..f391d8bc547 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -50,7 +50,7 @@ use query::{MarginPadding, MarginRetrievingFragmentBorderBoxIterator, PositionPr
use query::{PositionRetrievingFragmentBorderBoxIterator, Side};
use script::dom::node::LayoutData;
use script::layout_interface::Animation;
-use script::layout_interface::{LayoutChan, LayoutRPC, OffsetParentResponse};
+use script::layout_interface::{LayoutRPC, OffsetParentResponse};
use script::layout_interface::{Msg, NewLayoutTaskInfo, Reflow, ReflowGoal, ReflowQueryType};
use script::layout_interface::{ScriptLayoutChan, ScriptReflow, TrustedNodeAddress};
use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel};
@@ -122,19 +122,19 @@ pub struct LayoutTaskData {
/// Information needed by the layout task.
pub struct LayoutTask {
/// The ID of the pipeline that we belong to.
- pub id: PipelineId,
+ id: PipelineId,
/// The URL of the pipeline that we belong to.
- pub url: Url,
+ url: Url,
/// Is the current reflow of an iframe, as opposed to a root window?
- pub is_iframe: bool,
+ is_iframe: bool,
/// The port on which we receive messages from the script task.
- pub port: Receiver<Msg>,
+ port: Receiver<Msg>,
/// The port on which we receive messages from the constellation.
- pub pipeline_port: Receiver<LayoutControlMsg>,
+ pipeline_port: Receiver<LayoutControlMsg>,
/// The port on which we receive messages from the image cache
image_cache_receiver: Receiver<ImageCacheResult>,
@@ -148,37 +148,34 @@ pub struct LayoutTask {
/// The channel on which the font cache can send messages to us.
font_cache_sender: Sender<()>,
- /// The channel on which we or others can send messages to ourselves.
- pub chan: LayoutChan,
-
/// The channel on which messages can be sent to the constellation.
- pub constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan,
/// The channel on which messages can be sent to the script task.
- pub script_chan: Sender<ConstellationControlMsg>,
+ script_chan: Sender<ConstellationControlMsg>,
/// The channel on which messages can be sent to the painting task.
- pub paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
+ paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
/// The channel on which messages can be sent to the time profiler.
- pub time_profiler_chan: time::ProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
/// The channel on which messages can be sent to the memory profiler.
- pub mem_profiler_chan: mem::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan,
/// The channel on which messages can be sent to the image cache.
- pub image_cache_task: ImageCacheTask,
+ image_cache_task: ImageCacheTask,
/// Public interface to the font cache task.
- pub font_cache_task: FontCacheTask,
+ font_cache_task: FontCacheTask,
/// Is this the first reflow in this LayoutTask?
- pub first_reflow: bool,
+ first_reflow: bool,
/// To receive a canvas renderer associated to a layer, this message is propagated
/// to the paint chan
- pub canvas_layers_receiver: Receiver<(LayerId, IpcSender<CanvasMsg>)>,
- pub canvas_layers_sender: Sender<(LayerId, IpcSender<CanvasMsg>)>,
+ canvas_layers_receiver: Receiver<(LayerId, IpcSender<CanvasMsg>)>,
+ canvas_layers_sender: Sender<(LayerId, IpcSender<CanvasMsg>)>,
/// The workers that we use for parallel operation.
parallel_traversal: Option<WorkQueue<SharedLayoutContext, WorkQueueData>>,
@@ -218,7 +215,7 @@ pub struct LayoutTask {
/// structures, while still letting the LayoutTask modify them.
///
/// All the other elements of this struct are read-only.
- pub rw_data: Arc<Mutex<LayoutTaskData>>,
+ rw_data: Arc<Mutex<LayoutTaskData>>,
}
impl LayoutTaskFactory for LayoutTask {
@@ -244,12 +241,10 @@ impl LayoutTaskFactory for LayoutTask {
move || {
{ // Ensures layout task is destroyed before we send shutdown message
let sender = chan.sender();
- let layout_chan = LayoutChan(sender);
let layout = LayoutTask::new(id,
url,
is_iframe,
chan.receiver(),
- layout_chan.clone(),
pipeline_port,
constellation_chan,
script_chan,
@@ -262,7 +257,7 @@ impl LayoutTaskFactory for LayoutTask {
let reporter_name = format!("layout-reporter-{}", id);
mem_profiler_chan.run_with_memory_reporting(|| {
layout.start();
- }, reporter_name, layout_chan.0, Msg::CollectReports);
+ }, reporter_name, sender, Msg::CollectReports);
}
shutdown_chan.send(()).unwrap();
}, ConstellationMsg::Failure(failure_msg), con_chan);
@@ -358,7 +353,6 @@ impl LayoutTask {
url: Url,
is_iframe: bool,
port: Receiver<Msg>,
- chan: LayoutChan,
pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: ConstellationChan,
script_chan: Sender<ConstellationControlMsg>,
@@ -408,7 +402,6 @@ impl LayoutTask {
is_iframe: is_iframe,
port: port,
pipeline_port: pipeline_receiver,
- chan: chan,
script_chan: script_chan,
constellation_chan: constellation_chan.clone(),
paint_chan: paint_chan,
@@ -1294,7 +1287,11 @@ impl LayoutTask {
fn tick_all_animations<'a, 'b>(&mut self, possibly_locked_rw_data: &mut RwData<'a, 'b>) {
let mut rw_data = possibly_locked_rw_data.lock();
- animation::tick_all_animations(self, &mut rw_data)
+ self.tick_animations(&mut rw_data);
+
+ self.script_chan
+ .send(ConstellationControlMsg::TickAllAnimations(self.id))
+ .unwrap();
}
pub fn tick_animations(&mut self, rw_data: &mut LayoutTaskData) {