mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
fonts: Make FontKey
and FontInstanceKey
generation asynchronous (#33600)
Instead of a blocking a layout thread on the generation of WebRender `FontKey`s and `FontInstanceKey`s, generate the keys ahead of time and send the font data to WebRender asynchronously. This has the benefit of allowing use of the font much more quickly in layout, though blocking display list sending itself on the font data upload. In order to make this work for web fonts, `FontContext` now asks the `SystemFontService` for a `FontKey`s and `FontInstanceKey`s for new web fonts. This should happen much more quickly as the `SystemFontService` is only blocking in order to load system fonts into memory now. In practice this still drops layout thread blocking to fractions of a millisecond instead of multiple milliseconds as before. In addition, ensure that we don't send font data or generate keys for fonts that are used in layout but never added to display lists. This should help to reduce memory usage and increase performance. Performance of this change was verified by putting a microbenchmark around `FontContext::create_font` which is what triggered font key generation. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
05ecb8eddb
commit
abad89a49c
12 changed files with 302 additions and 216 deletions
|
@ -378,8 +378,10 @@ impl TextRunScanner {
|
|||
},
|
||||
};
|
||||
|
||||
let font_instance_key = font.key(font_context);
|
||||
let (run, break_at_zero) = TextRun::new(
|
||||
font,
|
||||
font_instance_key,
|
||||
run_info.text,
|
||||
&options,
|
||||
run_info.bidi_level,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue