diff options
author | Martin Robinson <mrobinson@igalia.com> | 2015-01-02 09:34:52 -0800 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2015-01-02 15:20:32 -0800 |
commit | c0b397322f3917a616db22798918df42b5a5c2e2 (patch) | |
tree | 16525425f70a8460498376930e31878b30aa7520 /components/layout/layout_task.rs | |
parent | 141b5d038fad3c0c44a6f1b309b8ca9edea54580 (diff) | |
download | servo-c0b397322f3917a616db22798918df42b5a5c2e2.tar.gz servo-c0b397322f3917a616db22798918df42b5a5c2e2.zip |
Stall PaintTask exit until it can release all buffers
It is possible for a PaintTask to start exiting soon after sending new
buffers to the compositor. In that case, the compositor should return
the now unnecessary buffers to the PaintTask so that it can properly
free them.
To accomplish this, the compositor now keeps a hash map of paint task
channels per pipeline id. When a PaintTask exists, the constellation
informs the compositor that it can forget about it. Additionally, the
PaintTask should not wait for any buffers when the engine is doing a
complete shutdown. In that case, the compositor is already halted and
has simply let all buffers leak. We pipe through the shutdown type when
destroying the pipeline to make this decision.
Fixes #2641.
Diffstat (limited to 'components/layout/layout_task.rs')
-rw-r--r-- | components/layout/layout_task.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 2eeeb31409f..fae8dbb070a 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -42,8 +42,8 @@ use script::layout_interface::{Reflow, ReflowGoal, ScriptLayoutChan, TrustedNode use script_traits::{SendEventMsg, ReflowEvent, ReflowCompleteMsg, OpaqueScriptLayoutChannel}; use script_traits::{ScriptControlChan, UntrustedNodeAddress}; use servo_msg::compositor_msg::Scrollable; -use servo_msg::constellation_msg::{ConstellationChan, PipelineId, Failure, FailureMsg}; -use servo_msg::constellation_msg::{SetCursorMsg}; +use servo_msg::constellation_msg::{ConstellationChan, Failure, FailureMsg, PipelineExitType}; +use servo_msg::constellation_msg::{PipelineId, SetCursorMsg}; use servo_net::image_cache_task::{ImageCacheTask, ImageResponseMsg}; use servo_net::local_image_cache::{ImageResponder, LocalImageCache}; use servo_net::resource_task::{ResourceTask, load_bytes_iter}; @@ -343,8 +343,8 @@ impl LayoutTask { match port_to_read { PortToRead::Pipeline => { match self.pipeline_port.recv() { - layout_traits::ExitNowMsg => { - self.handle_script_request(Msg::ExitNow, possibly_locked_rw_data) + layout_traits::ExitNowMsg(exit_type) => { + self.handle_script_request(Msg::ExitNow(exit_type), possibly_locked_rw_data) } } }, @@ -411,9 +411,9 @@ impl LayoutTask { self.prepare_to_exit(response_chan, possibly_locked_rw_data); return false }, - Msg::ExitNow => { + Msg::ExitNow(exit_type) => { debug!("layout: ExitNowMsg received"); - self.exit_now(possibly_locked_rw_data); + self.exit_now(possibly_locked_rw_data, exit_type); return false } } @@ -435,9 +435,9 @@ impl LayoutTask { LayoutTask::handle_reap_layout_data(dead_layout_data) } } - Msg::ExitNow => { + Msg::ExitNow(exit_type) => { debug!("layout task is exiting..."); - self.exit_now(possibly_locked_rw_data); + self.exit_now(possibly_locked_rw_data, exit_type); break } _ => { @@ -450,7 +450,9 @@ impl LayoutTask { /// Shuts down the layout task now. If there are any DOM nodes left, layout will now (safely) /// crash. - fn exit_now<'a>(&'a self, possibly_locked_rw_data: &mut Option<MutexGuard<'a, LayoutTaskData>>) { + fn exit_now<'a>(&'a self, + possibly_locked_rw_data: &mut Option<MutexGuard<'a, LayoutTaskData>>, + exit_type: PipelineExitType) { let (response_chan, response_port) = channel(); { @@ -462,7 +464,7 @@ impl LayoutTask { LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data); } - self.paint_chan.send(paint_task::ExitMsg(Some(response_chan))); + self.paint_chan.send(paint_task::ExitMsg(Some(response_chan), exit_type)); response_port.recv() } |