Skip to content

Commit

Permalink
Make the layout content process shutdown sender optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Nov 30, 2016
1 parent 6778043 commit c044b66
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions components/constellation/pipeline.rs
Expand Up @@ -166,7 +166,7 @@ impl Pipeline {
window_size: window_size,
pipeline_port: pipeline_port,
layout_to_constellation_chan: state.layout_to_constellation_chan.clone(),
content_process_shutdown_chan: layout_content_process_shutdown_chan.clone(),
content_process_shutdown_chan: Some(layout_content_process_shutdown_chan.clone()),
layout_threads: PREFS.get("layout.threads").as_u64().expect("count") as usize,
};

Expand Down Expand Up @@ -448,7 +448,7 @@ impl UnprivilegedPipelineContent {
self.font_cache_thread,
self.time_profiler_chan,
self.mem_profiler_chan,
self.layout_content_process_shutdown_chan,
Some(self.layout_content_process_shutdown_chan),
self.webrender_api_sender,
self.prefs.get("layout.threads").expect("exists").value()
.as_u64().expect("count") as usize);
Expand Down
6 changes: 4 additions & 2 deletions components/layout_thread/lib.rs
Expand Up @@ -246,7 +246,7 @@ impl LayoutThreadFactory for LayoutThread {
font_cache_thread: FontCacheThread,
time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: mem::ProfilerChan,
content_process_shutdown_chan: IpcSender<()>,
content_process_shutdown_chan: Option<IpcSender<()>>,
webrender_api_sender: webrender_traits::RenderApiSender,
layout_threads: usize) {
thread::spawn_named(format!("LayoutThread {:?}", id),
Expand Down Expand Up @@ -278,7 +278,9 @@ impl LayoutThreadFactory for LayoutThread {
layout.start();
}, reporter_name, sender, Msg::CollectReports);
}
let _ = content_process_shutdown_chan.send(());
if let Some(content_process_shutdown_chan) = content_process_shutdown_chan {
let _ = content_process_shutdown_chan.send(());
}
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/layout_traits/lib.rs
Expand Up @@ -44,7 +44,7 @@ pub trait LayoutThreadFactory {
font_cache_thread: FontCacheThread,
time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: mem::ProfilerChan,
content_process_shutdown_chan: IpcSender<()>,
content_process_shutdown_chan: Option<IpcSender<()>>,
webrender_api_sender: webrender_traits::RenderApiSender,
layout_threads: usize);
}
2 changes: 1 addition & 1 deletion components/script_layout_interface/message.rs
Expand Up @@ -142,6 +142,6 @@ pub struct NewLayoutThreadInfo {
pub constellation_chan: IpcSender<ConstellationMsg>,
pub script_chan: IpcSender<ConstellationControlMsg>,
pub image_cache_thread: ImageCacheThread,
pub content_process_shutdown_chan: IpcSender<()>,
pub content_process_shutdown_chan: Option<IpcSender<()>>,
pub layout_threads: usize,
}
2 changes: 1 addition & 1 deletion components/script_traits/lib.rs
Expand Up @@ -180,7 +180,7 @@ pub struct NewLayoutInfo {
/// 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 tell the content process to shut down when it's done.
pub content_process_shutdown_chan: IpcSender<()>,
pub content_process_shutdown_chan: Option<IpcSender<()>>,
/// Number of threads to use for layout.
pub layout_threads: usize,
}
Expand Down

0 comments on commit c044b66

Please sign in to comment.