Auto merge of #8688 - Ms2ger:compositing, r=pcwalton

Some compositing cleanup.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8688)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-11-28 07:26:14 +05:30
commit fa7e1d07ff
2 changed files with 35 additions and 27 deletions

View file

@ -362,7 +362,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
script_channel: Option<IpcSender<ConstellationControlMsg>>, script_channel: Option<IpcSender<ConstellationControlMsg>>,
load_data: LoadData) { load_data: LoadData) {
let spawning_paint_only = script_channel.is_some(); let spawning_paint_only = script_channel.is_some();
let (pipeline, unprivileged_pipeline_content, mut privileged_pipeline_content) = let (pipeline, unprivileged_pipeline_content, privileged_pipeline_content) =
Pipeline::create::<LTF, STF>(InitialPipelineState { Pipeline::create::<LTF, STF>(InitialPipelineState {
id: pipeline_id, id: pipeline_id,
parent_info: parent_info, parent_info: parent_info,

View file

@ -199,7 +199,7 @@ impl Pipeline {
let unprivileged_pipeline_content = UnprivilegedPipelineContent { let unprivileged_pipeline_content = UnprivilegedPipelineContent {
id: state.id, id: state.id,
parent_info: state.parent_info, parent_info: state.parent_info,
constellation_chan: state.constellation_chan.clone(), constellation_chan: state.constellation_chan,
scheduler_chan: state.scheduler_chan, scheduler_chan: state.scheduler_chan,
devtools_chan: script_to_devtools_chan, devtools_chan: script_to_devtools_chan,
image_cache_task: state.image_cache_task, image_cache_task: state.image_cache_task,
@ -228,7 +228,6 @@ impl Pipeline {
let privileged_pipeline_content = PrivilegedPipelineContent { let privileged_pipeline_content = PrivilegedPipelineContent {
id: state.id, id: state.id,
constellation_chan: state.constellation_chan,
painter_chan: state.painter_chan, painter_chan: state.painter_chan,
compositor_proxy: state.compositor_proxy, compositor_proxy: state.compositor_proxy,
font_cache_task: state.font_cache_task, font_cache_task: state.font_cache_task,
@ -236,11 +235,11 @@ impl Pipeline {
mem_profiler_chan: state.mem_profiler_chan, mem_profiler_chan: state.mem_profiler_chan,
load_data: state.load_data, load_data: state.load_data,
failure: failure, failure: failure,
layout_to_paint_port: Some(layout_to_paint_port), layout_to_paint_port: layout_to_paint_port,
chrome_to_paint_chan: chrome_to_paint_chan, chrome_to_paint_chan: chrome_to_paint_chan,
chrome_to_paint_port: Some(chrome_to_paint_port), chrome_to_paint_port: chrome_to_paint_port,
paint_shutdown_chan: paint_shutdown_chan, paint_shutdown_chan: paint_shutdown_chan,
script_to_compositor_port: Some(script_to_compositor_port), script_to_compositor_port: script_to_compositor_port,
}; };
(pipeline, unprivileged_pipeline_content, privileged_pipeline_content) (pipeline, unprivileged_pipeline_content, privileged_pipeline_content)
@ -385,7 +384,7 @@ impl UnprivilegedPipelineContent {
ScriptTaskFactory::create(None::<&mut STF>, InitialScriptState { ScriptTaskFactory::create(None::<&mut STF>, InitialScriptState {
id: self.id, id: self.id,
parent_info: self.parent_info, parent_info: self.parent_info,
compositor: self.script_to_compositor_chan.clone(), compositor: self.script_to_compositor_chan,
control_chan: self.script_chan.clone(), control_chan: self.script_chan.clone(),
control_port: mem::replace(&mut self.script_port, None).unwrap(), control_port: mem::replace(&mut self.script_port, None).unwrap(),
constellation_chan: self.constellation_chan.clone(), constellation_chan: self.constellation_chan.clone(),
@ -432,29 +431,38 @@ impl UnprivilegedPipelineContent {
pub struct PrivilegedPipelineContent { pub struct PrivilegedPipelineContent {
id: PipelineId, id: PipelineId,
constellation_chan: ConstellationChan<ConstellationMsg>,
painter_chan: ConstellationChan<PaintMsg>, painter_chan: ConstellationChan<PaintMsg>,
compositor_proxy: Box<CompositorProxy + Send + 'static>, compositor_proxy: Box<CompositorProxy + Send + 'static>,
script_to_compositor_port: Option<IpcReceiver<ScriptToCompositorMsg>>, script_to_compositor_port: IpcReceiver<ScriptToCompositorMsg>,
font_cache_task: FontCacheTask, font_cache_task: FontCacheTask,
time_profiler_chan: time::ProfilerChan, time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: profile_mem::ProfilerChan, mem_profiler_chan: profile_mem::ProfilerChan,
load_data: LoadData, load_data: LoadData,
failure: Failure, failure: Failure,
layout_to_paint_port: Option<Receiver<LayoutToPaintMsg>>, layout_to_paint_port: Receiver<LayoutToPaintMsg>,
chrome_to_paint_chan: Sender<ChromeToPaintMsg>, chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
chrome_to_paint_port: Option<Receiver<ChromeToPaintMsg>>, chrome_to_paint_port: Receiver<ChromeToPaintMsg>,
paint_shutdown_chan: IpcSender<()>, paint_shutdown_chan: IpcSender<()>,
} }
impl PrivilegedPipelineContent { impl PrivilegedPipelineContent {
pub fn start_all(&mut self) { pub fn start_all(self) {
self.start_paint_task(); PaintTask::create(self.id,
self.load_data.url,
self.chrome_to_paint_chan,
self.layout_to_paint_port,
self.chrome_to_paint_port,
self.compositor_proxy.clone_compositor_proxy(),
self.painter_chan,
self.font_cache_task,
self.failure,
self.time_profiler_chan,
self.mem_profiler_chan,
self.paint_shutdown_chan);
let compositor_proxy_for_script_listener_thread = let compositor_proxy_for_script_listener_thread =
self.compositor_proxy.clone_compositor_proxy(); self.compositor_proxy.clone_compositor_proxy();
let script_to_compositor_port = let script_to_compositor_port = self.script_to_compositor_port;
mem::replace(&mut self.script_to_compositor_port, None).unwrap();
thread::spawn(move || { thread::spawn(move || {
compositor_task::run_script_listener_thread( compositor_task::run_script_listener_thread(
compositor_proxy_for_script_listener_thread, compositor_proxy_for_script_listener_thread,
@ -462,19 +470,19 @@ impl PrivilegedPipelineContent {
}); });
} }
pub fn start_paint_task(&mut self) { pub fn start_paint_task(self) {
PaintTask::create(self.id, PaintTask::create(self.id,
self.load_data.url.clone(), self.load_data.url,
self.chrome_to_paint_chan.clone(), self.chrome_to_paint_chan,
mem::replace(&mut self.layout_to_paint_port, None).unwrap(), self.layout_to_paint_port,
mem::replace(&mut self.chrome_to_paint_port, None).unwrap(), self.chrome_to_paint_port,
self.compositor_proxy.clone_compositor_proxy(), self.compositor_proxy,
self.painter_chan.clone(), self.painter_chan,
self.font_cache_task.clone(), self.font_cache_task,
self.failure.clone(), self.failure,
self.time_profiler_chan.clone(), self.time_profiler_chan,
self.mem_profiler_chan.clone(), self.mem_profiler_chan,
self.paint_shutdown_chan.clone()); self.paint_shutdown_chan);
} }
} }