From c044b669794204d77925c5b09706d1242daa534a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 28 Nov 2016 10:03:09 +0100 Subject: [PATCH] Make the layout content process shutdown sender optional. --- components/constellation/pipeline.rs | 4 ++-- components/layout_thread/lib.rs | 6 ++++-- components/layout_traits/lib.rs | 2 +- components/script_layout_interface/message.rs | 2 +- components/script_traits/lib.rs | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index d77db028f2b3..1f352ae27e41 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -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, }; @@ -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); diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 72f1327620ed..5e919138d5c1 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -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>, webrender_api_sender: webrender_traits::RenderApiSender, layout_threads: usize) { thread::spawn_named(format!("LayoutThread {:?}", id), @@ -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(()); + } }); } } diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index 70d6eab10fff..632300aa61b3 100644 --- a/components/layout_traits/lib.rs +++ b/components/layout_traits/lib.rs @@ -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>, webrender_api_sender: webrender_traits::RenderApiSender, layout_threads: usize); } diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs index 3af9af32c799..a2ca0414e917 100644 --- a/components/script_layout_interface/message.rs +++ b/components/script_layout_interface/message.rs @@ -142,6 +142,6 @@ pub struct NewLayoutThreadInfo { pub constellation_chan: IpcSender, pub script_chan: IpcSender, pub image_cache_thread: ImageCacheThread, - pub content_process_shutdown_chan: IpcSender<()>, + pub content_process_shutdown_chan: Option>, pub layout_threads: usize, } diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 1f825e60783c..290d51ae4e0b 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -180,7 +180,7 @@ pub struct NewLayoutInfo { /// A sender for the layout thread to communicate to the constellation. pub layout_to_constellation_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<()>, + pub content_process_shutdown_chan: Option>, /// Number of threads to use for layout. pub layout_threads: usize, }