mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
fonts: Use IpcSharedMemory
to send font data (#33530)
This changes modifes the way that font data is sent over IPC channels. Instead of serializing the data or sending it via IPC byte senders, font data is copied into shared memory and a copy of the handle is sent over the channel. There is also the idea of sending the file handle of the on disk data of system fonts. This could be implemented as a further followup once there is an abstraction in `ipc-channel` over file handles. To accomplish this, a `FontData` abstraction is added, which also allows caching an in-memory shared `Arc<Vec<u8>>` version of the data (neeeded by some APIs). This could also be a place for caching font tables in the future. Finally, the `FontCacheThread` is renamed to the `SystemFontService` while the proxy for this is now named `SystemFontServiceProxy`. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
2c6d9a190f
commit
ade902207f
26 changed files with 601 additions and 544 deletions
|
@ -23,8 +23,8 @@ use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect, Size2D as
|
|||
use euclid::{Point2D, Rect, Scale, Size2D};
|
||||
use fnv::FnvHashMap;
|
||||
use fonts::{
|
||||
get_and_reset_text_shaping_performance_counter, FontCacheThread, FontContext,
|
||||
FontContextWebFontMethods,
|
||||
get_and_reset_text_shaping_performance_counter, FontContext, FontContextWebFontMethods,
|
||||
SystemFontServiceProxy,
|
||||
};
|
||||
use fonts_traits::WebFontLoadFinishedCallback;
|
||||
use fxhash::{FxHashMap, FxHashSet};
|
||||
|
@ -133,10 +133,10 @@ pub struct LayoutThread {
|
|||
/// Reference to the script thread image cache.
|
||||
image_cache: Arc<dyn ImageCache>,
|
||||
|
||||
/// A FontContext tFontCacheThreadImplg layout.
|
||||
font_context: Arc<FontContext<FontCacheThread>>,
|
||||
/// A per-layout FontContext managing font access.
|
||||
font_context: Arc<FontContext<SystemFontServiceProxy>>,
|
||||
|
||||
/// Is this the first reflow iFontCacheThreadImplread?
|
||||
/// Is this the first reflow in this layout?
|
||||
first_reflow: Cell<bool>,
|
||||
|
||||
/// Flag to indicate whether to use parallel operations
|
||||
|
@ -199,7 +199,7 @@ impl LayoutFactory for LayoutFactoryImpl {
|
|||
config.script_chan,
|
||||
config.image_cache,
|
||||
config.resource_threads,
|
||||
config.font_cache_thread,
|
||||
config.system_font_service,
|
||||
config.time_profiler_chan,
|
||||
config.webrender_api_sender,
|
||||
config.paint_time_metrics,
|
||||
|
@ -560,7 +560,7 @@ impl LayoutThread {
|
|||
script_chan: IpcSender<ConstellationControlMsg>,
|
||||
image_cache: Arc<dyn ImageCache>,
|
||||
resource_threads: ResourceThreads,
|
||||
font_cache_thread: FontCacheThread,
|
||||
system_font_service: Arc<SystemFontServiceProxy>,
|
||||
time_profiler_chan: profile_time::ProfilerChan,
|
||||
webrender_api: WebRenderScriptApi,
|
||||
paint_time_metrics: PaintTimeMetrics,
|
||||
|
@ -577,7 +577,7 @@ impl LayoutThread {
|
|||
keyword_info: KeywordInfo::medium(),
|
||||
};
|
||||
|
||||
let font_context = Arc::new(FontContext::new(font_cache_thread, resource_threads));
|
||||
let font_context = Arc::new(FontContext::new(system_font_service, resource_threads));
|
||||
let device = Device::new(
|
||||
MediaType::screen(),
|
||||
QuirksMode::NoQuirks,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue