mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #11750 - emilio:canvas-leaks, r=glennw
canvas: Deallocate WebRender images on canvas <!-- 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 #11062. - [x] These changes do not require tests because it's wr-only. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> r? @glennw <!-- 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/11750) <!-- Reviewable:end -->
This commit is contained in:
commit
1ff8d875dd
2 changed files with 16 additions and 0 deletions
|
@ -706,6 +706,14 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Drop for CanvasPaintThread<'a> {
|
||||
fn drop(&mut self) {
|
||||
if let Some(ref mut wr) = self.webrender_api {
|
||||
wr.delete_image(self.webrender_image_key.unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Used by drawImage to get rid of the extra pixels of the image data that
|
||||
/// won't be copied to the canvas
|
||||
/// image_data: Color pixel data of the image
|
||||
|
|
|
@ -195,3 +195,11 @@ impl WebGLPaintThread {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for WebGLPaintThread {
|
||||
fn drop(&mut self) {
|
||||
if let WebGLPaintTaskData::Readback(_, Some((ref mut wr, image_key))) = self.data {
|
||||
wr.delete_image(image_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue