Skip to content

Commit

Permalink
Auto merge of #11607 - Ms2ger:shutdown-channels, r=asajeffrey
Browse files Browse the repository at this point in the history
Remove the layout and paint shutdown channels

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11607)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Jun 4, 2016
2 parents a8c1cb3 + 32842d5 commit 80a58ca
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 63 deletions.
19 changes: 1 addition & 18 deletions components/constellation/pipeline.rs
Expand Up @@ -55,8 +55,6 @@ pub struct Pipeline {
/// A channel to the compositor.
pub compositor_proxy: Box<CompositorProxy + 'static + Send>,
pub chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
pub layout_shutdown_port: IpcReceiver<()>,
pub paint_shutdown_port: IpcReceiver<()>,
/// URL corresponding to the most recently-loaded page.
pub url: Url,
/// The title of the most recently-loaded page.
Expand Down Expand Up @@ -130,10 +128,6 @@ impl Pipeline {
// probably requires a general low-memory strategy.
let (layout_to_paint_chan, layout_to_paint_port) = util::ipc::optional_ipc_channel();
let (chrome_to_paint_chan, chrome_to_paint_port) = channel();
let (paint_shutdown_chan, paint_shutdown_port) = ipc::channel()
.expect("Pipeline paint shutdown chan");
let (layout_shutdown_chan, layout_shutdown_port) = ipc::channel()
.expect("Pipeline layout shutdown chan");
let (pipeline_chan, pipeline_port) = ipc::channel()
.expect("Pipeline main chan");;

Expand All @@ -153,7 +147,6 @@ impl Pipeline {
panic_chan: state.panic_chan.clone(),
pipeline_port: pipeline_port,
layout_to_constellation_chan: state.layout_to_constellation_chan.clone(),
layout_shutdown_chan: layout_shutdown_chan.clone(),
content_process_shutdown_chan: layout_content_process_shutdown_chan.clone(),
};

Expand All @@ -177,8 +170,7 @@ impl Pipeline {
state.panic_chan.clone(),
state.font_cache_thread.clone(),
state.time_profiler_chan.clone(),
state.mem_profiler_chan.clone(),
paint_shutdown_chan);
state.mem_profiler_chan.clone());

let mut child_process = None;
if let Some((script_port, pipeline_port)) = content_ports {
Expand Down Expand Up @@ -232,7 +224,6 @@ impl Pipeline {
prefs: prefs::get_cloned(),
layout_to_paint_chan: layout_to_paint_chan,
pipeline_port: pipeline_port,
layout_shutdown_chan: layout_shutdown_chan,
pipeline_namespace_id: state.pipeline_namespace_id,
layout_content_process_shutdown_chan: layout_content_process_shutdown_chan,
layout_content_process_shutdown_port: layout_content_process_shutdown_port,
Expand All @@ -257,8 +248,6 @@ impl Pipeline {
pipeline_chan,
state.compositor_proxy,
chrome_to_paint_chan,
layout_shutdown_port,
paint_shutdown_port,
state.load_data.url,
state.window_size);

Expand All @@ -271,8 +260,6 @@ impl Pipeline {
layout_chan: IpcSender<LayoutControlMsg>,
compositor_proxy: Box<CompositorProxy + 'static + Send>,
chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
layout_shutdown_port: IpcReceiver<()>,
paint_shutdown_port: IpcReceiver<()>,
url: Url,
size: Option<TypedSize2D<PagePx, f32>>)
-> Pipeline {
Expand All @@ -283,8 +270,6 @@ impl Pipeline {
layout_chan: layout_chan,
compositor_proxy: compositor_proxy,
chrome_to_paint_chan: chrome_to_paint_chan,
layout_shutdown_port: layout_shutdown_port,
paint_shutdown_port: paint_shutdown_port,
url: url,
title: None,
children: vec!(),
Expand Down Expand Up @@ -407,7 +392,6 @@ pub struct UnprivilegedPipelineContent {
prefs: HashMap<String, Pref>,
pipeline_port: IpcReceiver<LayoutControlMsg>,
pipeline_namespace_id: PipelineNamespaceId,
layout_shutdown_chan: IpcSender<()>,
layout_content_process_shutdown_chan: IpcSender<()>,
layout_content_process_shutdown_port: IpcReceiver<()>,
script_content_process_shutdown_chan: IpcSender<()>,
Expand Down Expand Up @@ -452,7 +436,6 @@ impl UnprivilegedPipelineContent {
self.font_cache_thread,
self.time_profiler_chan,
self.mem_profiler_chan,
self.layout_shutdown_chan,
self.layout_content_process_shutdown_chan,
self.webrender_api_sender);

Expand Down
64 changes: 28 additions & 36 deletions components/gfx/paint_thread.rs
Expand Up @@ -396,46 +396,38 @@ impl<C> PaintThread<C> where C: PaintListener + Send + 'static {
panic_chan: IpcSender<PanicMsg>,
font_cache_thread: FontCacheThread,
time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: mem::ProfilerChan,
shutdown_chan: IpcSender<()>) {
mem_profiler_chan: mem::ProfilerChan) {
thread::spawn_named_with_send_on_panic(format!("PaintThread {:?}", id),
thread_state::PAINT,
move || {
{
// Ensures that the paint thread and graphics context are destroyed before the
// shutdown message.
let native_display = compositor.native_display();
let worker_threads = WorkerThreadProxy::spawn(native_display,
font_cache_thread,
time_profiler_chan.clone());

let mut paint_thread = PaintThread {
id: id,
_url: url,
layout_to_paint_port: layout_to_paint_port,
chrome_to_paint_port: chrome_to_paint_port,
compositor: compositor,
time_profiler_chan: time_profiler_chan,
root_display_list: None,
layer_map: HashMap::new(),
paint_permission: false,
current_epoch: None,
worker_threads: worker_threads,
};

let reporter_name = format!("paint-reporter-{}", id);
mem_profiler_chan.run_with_memory_reporting(|| {
paint_thread.start();
}, reporter_name, chrome_to_paint_chan, ChromeToPaintMsg::CollectReports);

// Tell all the worker threads to shut down.
for worker_thread in &mut paint_thread.worker_threads {
worker_thread.exit()
}
}
let native_display = compositor.native_display();
let worker_threads = WorkerThreadProxy::spawn(native_display,
font_cache_thread,
time_profiler_chan.clone());

let mut paint_thread = PaintThread {
id: id,
_url: url,
layout_to_paint_port: layout_to_paint_port,
chrome_to_paint_port: chrome_to_paint_port,
compositor: compositor,
time_profiler_chan: time_profiler_chan,
root_display_list: None,
layer_map: HashMap::new(),
paint_permission: false,
current_epoch: None,
worker_threads: worker_threads,
};

let reporter_name = format!("paint-reporter-{}", id);
mem_profiler_chan.run_with_memory_reporting(|| {
paint_thread.start();
}, reporter_name, chrome_to_paint_chan, ChromeToPaintMsg::CollectReports);

debug!("paint_thread: shutdown_chan send");
let _ = shutdown_chan.send(());
// Tell all the worker threads to shut down.
for worker_thread in &mut paint_thread.worker_threads {
worker_thread.exit()
}
}, Some(id), panic_chan);
}

Expand Down
3 changes: 0 additions & 3 deletions components/layout/layout_thread.rs
Expand Up @@ -259,7 +259,6 @@ impl LayoutThreadFactory for LayoutThread {
font_cache_thread: FontCacheThread,
time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: mem::ProfilerChan,
shutdown_chan: IpcSender<()>,
content_process_shutdown_chan: IpcSender<()>,
webrender_api_sender: Option<webrender_traits::RenderApiSender>) {
thread::spawn_named_with_send_on_panic(format!("LayoutThread {:?}", id),
Expand All @@ -286,7 +285,6 @@ impl LayoutThreadFactory for LayoutThread {
layout.start();
}, reporter_name, sender, Msg::CollectReports);
}
let _ = shutdown_chan.send(());
let _ = content_process_shutdown_chan.send(());
}, Some(id), panic_chan);
}
Expand Down Expand Up @@ -748,7 +746,6 @@ impl LayoutThread {
self.font_cache_thread.clone(),
self.time_profiler_chan.clone(),
self.mem_profiler_chan.clone(),
info.layout_shutdown_chan,
info.content_process_shutdown_chan,
self.webrender_api.as_ref().map(|wr| wr.clone_sender()));
}
Expand Down
1 change: 0 additions & 1 deletion components/layout_traits/lib.rs
Expand Up @@ -48,7 +48,6 @@ pub trait LayoutThreadFactory {
font_cache_thread: FontCacheThread,
time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: mem::ProfilerChan,
shutdown_chan: IpcSender<()>,
content_process_shutdown_chan: IpcSender<()>,
webrender_api_sender: Option<webrender_traits::RenderApiSender>);
}
1 change: 0 additions & 1 deletion components/script/layout_interface.rs
Expand Up @@ -232,6 +232,5 @@ pub struct NewLayoutThreadInfo {
pub script_chan: IpcSender<ConstellationControlMsg>,
pub image_cache_thread: ImageCacheThread,
pub paint_chan: OptionalOpaqueIpcSender,
pub layout_shutdown_chan: IpcSender<()>,
pub content_process_shutdown_chan: IpcSender<()>,
}
2 changes: 0 additions & 2 deletions components/script/script_thread.rs
Expand Up @@ -1129,7 +1129,6 @@ impl ScriptThread {
panic_chan,
pipeline_port,
layout_to_constellation_chan,
layout_shutdown_chan,
content_process_shutdown_chan,
} = new_layout_info;

Expand All @@ -1147,7 +1146,6 @@ impl ScriptThread {
paint_chan: paint_chan,
script_chan: self.control_chan.clone(),
image_cache_thread: self.image_cache_thread.clone(),
layout_shutdown_chan: layout_shutdown_chan,
content_process_shutdown_chan: content_process_shutdown_chan,
};

Expand Down
2 changes: 0 additions & 2 deletions components/script_traits/lib.rs
Expand Up @@ -104,8 +104,6 @@ pub struct NewLayoutInfo {
pub panic_chan: IpcSender<PanicMsg>,
/// A sender for the layout thread to communicate to the constellation.
pub layout_to_constellation_chan: IpcSender<LayoutMsg>,
/// A shutdown channel so that layout can notify others when it's done.
pub layout_shutdown_chan: IpcSender<()>,
/// A shutdown channel so that layout can tell the content process to shut down when it's done.
pub content_process_shutdown_chan: IpcSender<()>,
}
Expand Down

0 comments on commit 80a58ca

Please sign in to comment.