mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
fonts: Clean up WebRender web fonts when they are no longer used (#32545)
This is the first part of cleaning up unused WebRender resources. Currently this only cleans up web font resources, but a more full-featured implementation in the future could also clean up unused system fonts. Fixes #32345. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
bd15a4fbd8
commit
fef1337da0
6 changed files with 181 additions and 7 deletions
|
@ -242,6 +242,16 @@ impl Drop for ScriptReflowResult {
|
|||
}
|
||||
}
|
||||
|
||||
impl Drop for LayoutThread {
|
||||
fn drop(&mut self) {
|
||||
let (keys, instance_keys) = self
|
||||
.font_context
|
||||
.collect_unused_webrender_resources(true /* all */);
|
||||
self.webrender_api
|
||||
.remove_unused_font_resources(keys, instance_keys)
|
||||
}
|
||||
}
|
||||
|
||||
impl Layout for LayoutThread {
|
||||
fn device(&self) -> &Device {
|
||||
self.stylist.device()
|
||||
|
@ -921,6 +931,12 @@ impl LayoutThread {
|
|||
|
||||
self.webrender_api
|
||||
.send_display_list(compositor_info, builder.end().1);
|
||||
|
||||
let (keys, instance_keys) = self
|
||||
.font_context
|
||||
.collect_unused_webrender_resources(false /* all */);
|
||||
self.webrender_api
|
||||
.remove_unused_font_resources(keys, instance_keys)
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue