Auto merge of #11337 - Ms2ger:compositor-exit-wait, r=pcwalton

Don't block the script listener thread on window.close().

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy --faster` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

Either:
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because no tangible effect

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

This does not appear to have any effect. I believe this has been the case
since e841065351, when the helper thread was
introduced.

It was added in a7ef1cd35e, where it blocked the
script thread rather than this helper thread.

<!-- 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/11337)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-25 01:03:38 -05:00
commit 220bdfec2e
2 changed files with 5 additions and 8 deletions

View file

@ -528,9 +528,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
return false return false
} }
(Msg::Exit(channel), _) => { (Msg::Exit, _) => {
self.start_shutting_down(); self.start_shutting_down();
let _ = channel.send(());
} }
(Msg::ShutdownComplete, _) => { (Msg::ShutdownComplete, _) => {

View file

@ -9,7 +9,7 @@ use compositor::{self, CompositingReason};
use euclid::point::Point2D; use euclid::point::Point2D;
use euclid::size::Size2D; use euclid::size::Size2D;
use gfx_traits::{Epoch, FrameTreeId, LayerId, LayerProperties, PaintListener}; use gfx_traits::{Epoch, FrameTreeId, LayerId, LayerProperties, PaintListener};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{IpcReceiver, IpcSender};
use layers::layers::{BufferRequest, LayerBufferSet}; use layers::layers::{BufferRequest, LayerBufferSet};
use layers::platform::surface::{NativeDisplay, NativeSurface}; use layers::platform::surface::{NativeDisplay, NativeSurface};
use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState, PipelineId}; use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState, PipelineId};
@ -79,9 +79,7 @@ pub fn run_script_listener_thread(compositor_proxy: Box<CompositorProxy + 'stati
} }
ScriptToCompositorMsg::Exit => { ScriptToCompositorMsg::Exit => {
let (chan, port) = ipc::channel().unwrap(); compositor_proxy.send(Msg::Exit);
compositor_proxy.send(Msg::Exit(chan));
port.recv().unwrap();
} }
ScriptToCompositorMsg::SetTitle(pipeline_id, title) => { ScriptToCompositorMsg::SetTitle(pipeline_id, title) => {
@ -167,7 +165,7 @@ impl PaintListener for Box<CompositorProxy + 'static + Send> {
/// Messages from the painting thread and the constellation thread to the compositor thread. /// Messages from the painting thread and the constellation thread to the compositor thread.
pub enum Msg { pub enum Msg {
/// Requests that the compositor shut down. /// Requests that the compositor shut down.
Exit(IpcSender<()>), Exit,
/// Informs the compositor that the constellation has completed shutdown. /// Informs the compositor that the constellation has completed shutdown.
/// Required because the constellation can have pending calls to make /// Required because the constellation can have pending calls to make
@ -246,7 +244,7 @@ pub enum Msg {
impl Debug for Msg { impl Debug for Msg {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
match *self { match *self {
Msg::Exit(..) => write!(f, "Exit"), Msg::Exit => write!(f, "Exit"),
Msg::ShutdownComplete => write!(f, "ShutdownComplete"), Msg::ShutdownComplete => write!(f, "ShutdownComplete"),
Msg::GetNativeDisplay(..) => write!(f, "GetNativeDisplay"), Msg::GetNativeDisplay(..) => write!(f, "GetNativeDisplay"),
Msg::InitializeLayersForPipeline(..) => write!(f, "InitializeLayersForPipeline"), Msg::InitializeLayersForPipeline(..) => write!(f, "InitializeLayersForPipeline"),