diff options
author | Mukilan Thiyagarajan <mukilan@igalia.com> | 2024-11-21 17:53:14 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-21 12:23:14 +0000 |
commit | a731b25f0cc245bf949e86aa134ee0163cc76c54 (patch) | |
tree | 3690d8f5cddc0fe96bdc7532c4ec73cc8ffb506a /components/fonts/system_font_service.rs | |
parent | c05612fc9ad1dc1f6852ea0ee61dcc5a0edc3f42 (diff) | |
download | servo-a731b25f0cc245bf949e86aa134ee0163cc76c54.tar.gz servo-a731b25f0cc245bf949e86aa134ee0163cc76c54.zip |
fonts: fix broken caching of font template matches (#34325)
After a cache miss, `find_matching_font_template` never updates the
cache entry with the response from the `SystemFontService` leading to
several unnecessary IPC calls during layout.
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/fonts/system_font_service.rs')
-rw-r--r-- | components/fonts/system_font_service.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/components/fonts/system_font_service.rs b/components/fonts/system_font_service.rs index 69244d12410..8bf34f76e54 100644 --- a/components/fonts/system_font_service.rs +++ b/components/fonts/system_font_service.rs @@ -533,11 +533,15 @@ impl SystemFontServiceProxy { ); panic!("SystemFontService has already exited."); }; - templates + + let templates: Vec<_> = templates .into_iter() .map(AtomicRefCell::new) .map(Arc::new) - .collect() + .collect(); + self.templates.write().insert(cache_key, templates.clone()); + + templates } pub(crate) fn generate_font_key(&self) -> FontKey { |