fonts: Remove web fonts when their stylsheet is removed (#32346)

This is the first part of ensuring that unused fonts do not leak. This
change makes it so that when a stylesheet is removed, the corresponding
web fonts are removed from the `FontContext`.

Note: WebRender assets are still leaked, which was the situation before
for all fonts. A followup change will fix this issue.

Fixes #15139.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Martin Robinson 2024-05-23 08:49:31 +02:00 committed by GitHub
parent a772ecf786
commit 14286d913d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 258 additions and 57 deletions

View file

@ -484,6 +484,7 @@ impl FontSource for FontCacheThread {
identifier: serialized_font_template.identifier,
descriptor: serialized_font_template.descriptor.clone(),
data: font_data.map(Arc::new),
stylesheet: None,
}))
})
.collect()