Auto merge of #26922 - gterzian:shutdown_webrender, r=jdm

Blockingly shut-down webrender api

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

FIX https://github.com/servo/servo/issues/26876

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (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. -->
This commit is contained in:
bors-servo 2020-06-17 08:55:43 -04:00 committed by GitHub
commit d9b2cf53e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 47 additions and 49 deletions

View file

@ -333,6 +333,14 @@ impl WebGLThread {
Ok(msg) => {
let exit = self.handle_msg(msg, &webgl_chan);
if exit {
// Call remove_context functions in order to correctly delete WebRender image keys.
let context_ids: Vec<WebGLContextId> = self.contexts.keys().map(|id| *id).collect();
for id in context_ids {
self.remove_webgl_context(id);
}
// Block on shutting-down WebRender.
self.webrender_api.shut_down(true);
return;
}
}
@ -1101,16 +1109,6 @@ impl WebGLThread {
}
}
impl Drop for WebGLThread {
fn drop(&mut self) {
// Call remove_context functions in order to correctly delete WebRender image keys.
let context_ids: Vec<WebGLContextId> = self.contexts.keys().map(|id| *id).collect();
for id in context_ids {
self.remove_webgl_context(id);
}
}
}
/// Helper struct to store cached WebGLContext information.
struct WebGLContextInfo {
/// Currently used WebRender image key.