mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +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
|
@ -219,6 +219,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()
|
||||
|
@ -912,6 +922,12 @@ impl LayoutThread {
|
|||
if reflow_goal.needs_display() {
|
||||
self.webrender_api
|
||||
.send_display_list(display_list.compositor_info, display_list.wr.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)
|
||||
}
|
||||
|
||||
self.update_iframe_sizes(iframe_sizes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue