mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #8485 - hfaulds:make-layout-task-fields-private, r=Ms2ger
Make layout task fields private For https://github.com/servo/servo/issues/8471 The second commit I'm slightly less sure about but with `chan` made private this warning was shown: ``` components/layout/layout_task.rs:152:5: 152:21 warning: struct field is never used: `chan`, #[warn(dead_code)] on by default ``` There might be some cleanup around `layout_chan` in https://github.com/hfaulds/servo/blob/make-layout-task-fields-private/components/layout/layout_task.rs#L244-L261 as well but that was a bit beyond me. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8485) <!-- Reviewable:end -->
This commit is contained in:
commit
1e10b67b18
2 changed files with 23 additions and 37 deletions
|
@ -8,10 +8,8 @@ use clock_ticks;
|
||||||
use flow::{self, Flow};
|
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 msg::constellation_msg::{AnimationState, ConstellationChan, 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 std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
use std::sync::mpsc::{Sender, Receiver};
|
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)
|
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();
|
|
||||||
}
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ use query::{MarginPadding, MarginRetrievingFragmentBorderBoxIterator, PositionPr
|
||||||
use query::{PositionRetrievingFragmentBorderBoxIterator, Side};
|
use query::{PositionRetrievingFragmentBorderBoxIterator, Side};
|
||||||
use script::dom::node::LayoutData;
|
use script::dom::node::LayoutData;
|
||||||
use script::layout_interface::Animation;
|
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::{Msg, NewLayoutTaskInfo, Reflow, ReflowGoal, ReflowQueryType};
|
||||||
use script::layout_interface::{ScriptLayoutChan, ScriptReflow, TrustedNodeAddress};
|
use script::layout_interface::{ScriptLayoutChan, ScriptReflow, TrustedNodeAddress};
|
||||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel};
|
use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel};
|
||||||
|
@ -122,19 +122,19 @@ pub struct LayoutTaskData {
|
||||||
/// Information needed by the layout task.
|
/// Information needed by the layout task.
|
||||||
pub struct LayoutTask {
|
pub struct LayoutTask {
|
||||||
/// The ID of the pipeline that we belong to.
|
/// The ID of the pipeline that we belong to.
|
||||||
pub id: PipelineId,
|
id: PipelineId,
|
||||||
|
|
||||||
/// The URL of the pipeline that we belong to.
|
/// 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?
|
/// 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.
|
/// 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.
|
/// 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
|
/// The port on which we receive messages from the image cache
|
||||||
image_cache_receiver: Receiver<ImageCacheResult>,
|
image_cache_receiver: Receiver<ImageCacheResult>,
|
||||||
|
@ -148,37 +148,34 @@ pub struct LayoutTask {
|
||||||
/// The channel on which the font cache can send messages to us.
|
/// The channel on which the font cache can send messages to us.
|
||||||
font_cache_sender: Sender<()>,
|
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.
|
/// 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.
|
/// 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.
|
/// 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.
|
/// 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.
|
/// 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.
|
/// 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.
|
/// Public interface to the font cache task.
|
||||||
pub font_cache_task: FontCacheTask,
|
font_cache_task: FontCacheTask,
|
||||||
|
|
||||||
/// Is this the first reflow in this LayoutTask?
|
/// 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 receive a canvas renderer associated to a layer, this message is propagated
|
||||||
/// to the paint chan
|
/// to the paint chan
|
||||||
pub canvas_layers_receiver: Receiver<(LayerId, IpcSender<CanvasMsg>)>,
|
canvas_layers_receiver: Receiver<(LayerId, IpcSender<CanvasMsg>)>,
|
||||||
pub canvas_layers_sender: Sender<(LayerId, IpcSender<CanvasMsg>)>,
|
canvas_layers_sender: Sender<(LayerId, IpcSender<CanvasMsg>)>,
|
||||||
|
|
||||||
/// The workers that we use for parallel operation.
|
/// The workers that we use for parallel operation.
|
||||||
parallel_traversal: Option<WorkQueue<SharedLayoutContext, WorkQueueData>>,
|
parallel_traversal: Option<WorkQueue<SharedLayoutContext, WorkQueueData>>,
|
||||||
|
@ -218,7 +215,7 @@ pub struct LayoutTask {
|
||||||
/// structures, while still letting the LayoutTask modify them.
|
/// structures, while still letting the LayoutTask modify them.
|
||||||
///
|
///
|
||||||
/// All the other elements of this struct are read-only.
|
/// 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 {
|
impl LayoutTaskFactory for LayoutTask {
|
||||||
|
@ -244,12 +241,10 @@ impl LayoutTaskFactory for LayoutTask {
|
||||||
move || {
|
move || {
|
||||||
{ // Ensures layout task is destroyed before we send shutdown message
|
{ // Ensures layout task is destroyed before we send shutdown message
|
||||||
let sender = chan.sender();
|
let sender = chan.sender();
|
||||||
let layout_chan = LayoutChan(sender);
|
|
||||||
let layout = LayoutTask::new(id,
|
let layout = LayoutTask::new(id,
|
||||||
url,
|
url,
|
||||||
is_iframe,
|
is_iframe,
|
||||||
chan.receiver(),
|
chan.receiver(),
|
||||||
layout_chan.clone(),
|
|
||||||
pipeline_port,
|
pipeline_port,
|
||||||
constellation_chan,
|
constellation_chan,
|
||||||
script_chan,
|
script_chan,
|
||||||
|
@ -262,7 +257,7 @@ impl LayoutTaskFactory for LayoutTask {
|
||||||
let reporter_name = format!("layout-reporter-{}", id);
|
let reporter_name = format!("layout-reporter-{}", id);
|
||||||
mem_profiler_chan.run_with_memory_reporting(|| {
|
mem_profiler_chan.run_with_memory_reporting(|| {
|
||||||
layout.start();
|
layout.start();
|
||||||
}, reporter_name, layout_chan.0, Msg::CollectReports);
|
}, reporter_name, sender, Msg::CollectReports);
|
||||||
}
|
}
|
||||||
shutdown_chan.send(()).unwrap();
|
shutdown_chan.send(()).unwrap();
|
||||||
}, ConstellationMsg::Failure(failure_msg), con_chan);
|
}, ConstellationMsg::Failure(failure_msg), con_chan);
|
||||||
|
@ -358,7 +353,6 @@ impl LayoutTask {
|
||||||
url: Url,
|
url: Url,
|
||||||
is_iframe: bool,
|
is_iframe: bool,
|
||||||
port: Receiver<Msg>,
|
port: Receiver<Msg>,
|
||||||
chan: LayoutChan,
|
|
||||||
pipeline_port: IpcReceiver<LayoutControlMsg>,
|
pipeline_port: IpcReceiver<LayoutControlMsg>,
|
||||||
constellation_chan: ConstellationChan,
|
constellation_chan: ConstellationChan,
|
||||||
script_chan: Sender<ConstellationControlMsg>,
|
script_chan: Sender<ConstellationControlMsg>,
|
||||||
|
@ -408,7 +402,6 @@ impl LayoutTask {
|
||||||
is_iframe: is_iframe,
|
is_iframe: is_iframe,
|
||||||
port: port,
|
port: port,
|
||||||
pipeline_port: pipeline_receiver,
|
pipeline_port: pipeline_receiver,
|
||||||
chan: chan,
|
|
||||||
script_chan: script_chan,
|
script_chan: script_chan,
|
||||||
constellation_chan: constellation_chan.clone(),
|
constellation_chan: constellation_chan.clone(),
|
||||||
paint_chan: paint_chan,
|
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>) {
|
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();
|
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) {
|
pub fn tick_animations(&mut self, rw_data: &mut LayoutTaskData) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue