diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/main/compositing/compositor_task.rs | 3 | ||||
-rw-r--r-- | src/components/main/compositing/headless.rs | 17 | ||||
-rw-r--r-- | src/components/main/layout/layout_task.rs | 3 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/components/main/compositing/compositor_task.rs b/src/components/main/compositing/compositor_task.rs index 5cbcf45e8d3..6b5e6c9e347 100644 --- a/src/components/main/compositing/compositor_task.rs +++ b/src/components/main/compositing/compositor_task.rs @@ -209,7 +209,8 @@ impl CompositorTask { } Headless => { headless::NullCompositor::create(port, - constellation_chan.clone()) + constellation_chan.clone(), + profiler_chan) } }; } diff --git a/src/components/main/compositing/headless.rs b/src/components/main/compositing/headless.rs index 43455e0d0c4..c788de443d8 100644 --- a/src/components/main/compositing/headless.rs +++ b/src/components/main/compositing/headless.rs @@ -7,7 +7,8 @@ use compositing::*; use geom::size::Size2D; use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, ResizedWindowMsg}; use std::comm::Port; - +use servo_util::time::ProfilerChan; +use servo_util::time; /// Starts the compositor, which listens for messages on the specified port. /// @@ -19,20 +20,26 @@ pub struct NullCompositor { } impl NullCompositor { - fn new(port: Port<Msg>) -> NullCompositor { - NullCompositor { - port: port + port: port, } } - pub fn create(port: Port<Msg>, constellation_chan: ConstellationChan) { + pub fn create(port: Port<Msg>, + constellation_chan: ConstellationChan, + profiler_chan: ProfilerChan) { let compositor = NullCompositor::new(port); // Tell the constellation about the initial fake size. constellation_chan.send(ResizedWindowMsg(Size2D(640u, 480u))); compositor.handle_message(constellation_chan); + + // Drain compositor port, sometimes messages contain channels that are blocking + // another task from finishing (i.e. SetIds) + while compositor.port.try_recv().is_some() {} + + profiler_chan.send(time::ExitMsg); } fn handle_message(&self, constellation_chan: ConstellationChan) { diff --git a/src/components/main/layout/layout_task.rs b/src/components/main/layout/layout_task.rs index 64482cd9803..f9856724659 100644 --- a/src/components/main/layout/layout_task.rs +++ b/src/components/main/layout/layout_task.rs @@ -235,7 +235,7 @@ impl ImageResponder for LayoutImageResponder { let id = self.id.clone(); let script_chan = self.script_chan.clone(); let f: proc(ImageResponseMsg) = proc(_) { - script_chan.send(SendEventMsg(id.clone(), ReflowEvent)) + drop(script_chan.try_send(SendEventMsg(id.clone(), ReflowEvent))) }; f } @@ -392,6 +392,7 @@ impl LayoutTask { } } ExitNowMsg => { + debug!("layout task is exiting..."); self.exit_now(); break } |