Auto merge of #22040 - paulrouget:shutdown_canvas_paint_thread, r=jdm

Exit Canvas paint thread on shutdown

<!-- Please describe your changes on the following line: -->

---
<!-- 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` does not report any errors
- [x] These changes fix #22038 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

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

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22040)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-10-29 07:28:25 -04:00 committed by GitHub
commit cbd81d2ad9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View file

@ -66,6 +66,7 @@ impl<'a> CanvasPaintThread <'a> {
}
}
},
CanvasMsg::Exit => break,
}
},
Err(e) => {

View file

@ -27,6 +27,7 @@ pub enum CanvasMsg {
FromScript(FromScriptMsg, CanvasId),
Recreate(Size2D<u32>, CanvasId),
Close(CanvasId),
Exit,
}
#[derive(Clone, Deserialize, Serialize)]

View file

@ -1441,6 +1441,11 @@ where
}
}
debug!("Exiting Canvas Paint thread.");
if let Err(e) = self.canvas_chan.send(CanvasMsg::Exit) {
warn!("Exit Canvas Paint thread failed ({})", e);
}
if let Some(webgl_threads) = self.webgl_threads.as_ref() {
debug!("Exiting WebGL thread.");
if let Err(e) = webgl_threads.exit() {