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>
This commit is contained in:
Mukilan Thiyagarajan 2024-11-21 17:53:14 +05:30 committed by GitHub
parent c05612fc9a
commit a731b25f0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 2 deletions

View file

@ -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 {