canvas: Deallocate WebRender images on canvas

Fixes #11062

Depends on: #11744, https://github.com/servo/webrender_traits/pull/57, and https://github.com/servo/webrender/pull/292
This commit is contained in:
Emilio Cobos Álvarez 2016-06-15 14:17:13 +02:00 committed by Emilio Cobos Álvarez
parent 68aca87e30
commit b7d45fe096
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 16 additions and 0 deletions

View file

@ -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 /// Used by drawImage to get rid of the extra pixels of the image data that
/// won't be copied to the canvas /// won't be copied to the canvas
/// image_data: Color pixel data of the image /// image_data: Color pixel data of the image

View file

@ -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);
}
}
}