mirror of
https://github.com/servo/servo.git
synced 2025-06-08 08:33:26 +00: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
|
@ -48,7 +48,7 @@ use devtools_traits::{
|
|||
};
|
||||
use embedder_traits::EmbedderMsg;
|
||||
use euclid::default::{Point2D, Rect};
|
||||
use fonts::FontCacheThread;
|
||||
use fonts::SystemFontServiceProxy;
|
||||
use headers::{HeaderMapExt, LastModified, ReferrerPolicy as ReferrerPolicyHeader};
|
||||
use html5ever::{local_name, namespace_url, ns};
|
||||
use hyper_serde::Serde;
|
||||
|
@ -593,9 +593,9 @@ pub struct ScriptThread {
|
|||
#[no_trace]
|
||||
layout_to_constellation_chan: IpcSender<LayoutMsg>,
|
||||
|
||||
/// The font cache thread to use for layout that happens in this [`ScriptThread`].
|
||||
/// A proxy to the `SystemFontService` to use for accessing system font lists.
|
||||
#[no_trace]
|
||||
font_cache_thread: FontCacheThread,
|
||||
system_font_service: Arc<SystemFontServiceProxy>,
|
||||
|
||||
/// The port on which we receive messages from the image cache
|
||||
#[no_trace]
|
||||
|
@ -786,7 +786,7 @@ impl ScriptThreadFactory for ScriptThread {
|
|||
fn create(
|
||||
state: InitialScriptState,
|
||||
layout_factory: Arc<dyn LayoutFactory>,
|
||||
font_cache_thread: FontCacheThread,
|
||||
system_font_service: Arc<SystemFontServiceProxy>,
|
||||
load_data: LoadData,
|
||||
user_agent: Cow<'static, str>,
|
||||
) {
|
||||
|
@ -813,7 +813,7 @@ impl ScriptThreadFactory for ScriptThread {
|
|||
script_port,
|
||||
script_chan.clone(),
|
||||
layout_factory,
|
||||
font_cache_thread,
|
||||
system_font_service,
|
||||
user_agent,
|
||||
);
|
||||
|
||||
|
@ -1282,7 +1282,7 @@ impl ScriptThread {
|
|||
port: Receiver<MainThreadScriptMsg>,
|
||||
chan: Sender<MainThreadScriptMsg>,
|
||||
layout_factory: Arc<dyn LayoutFactory>,
|
||||
font_cache_thread: FontCacheThread,
|
||||
system_font_service: Arc<SystemFontServiceProxy>,
|
||||
user_agent: Cow<'static, str>,
|
||||
) -> ScriptThread {
|
||||
let opts = opts::get();
|
||||
|
@ -1387,7 +1387,7 @@ impl ScriptThread {
|
|||
mutation_observers: Default::default(),
|
||||
|
||||
layout_to_constellation_chan: state.layout_to_constellation_chan,
|
||||
font_cache_thread,
|
||||
system_font_service,
|
||||
|
||||
webgl_chan: state.webgl_chan,
|
||||
webxr_registry: state.webxr_registry,
|
||||
|
@ -3657,7 +3657,7 @@ impl ScriptThread {
|
|||
constellation_chan: self.layout_to_constellation_chan.clone(),
|
||||
script_chan: self.control_chan.clone(),
|
||||
image_cache: self.image_cache.clone(),
|
||||
font_cache_thread: self.font_cache_thread.clone(),
|
||||
system_font_service: self.system_font_service.clone(),
|
||||
resource_threads: self.resource_threads.clone(),
|
||||
time_profiler_chan: self.time_profiler_chan.clone(),
|
||||
webrender_api_sender: self.webrender_api_sender.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue