mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +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,7 +23,7 @@ use embedder_traits::resources::{self, Resource};
|
|||
use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect, Size2D as UntypedSize2D};
|
||||
use euclid::{Point2D, Scale, Size2D, Vector2D};
|
||||
use fnv::FnvHashMap;
|
||||
use fonts::{FontCacheThread, FontContext, FontContextWebFontMethods};
|
||||
use fonts::{FontContext, FontContextWebFontMethods, SystemFontServiceProxy};
|
||||
use fonts_traits::WebFontLoadFinishedCallback;
|
||||
use fxhash::FxHashMap;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
|
@ -121,7 +121,7 @@ pub struct LayoutThread {
|
|||
image_cache: Arc<dyn ImageCache>,
|
||||
|
||||
/// A FontContext to be used during layout.
|
||||
font_context: Arc<FontContext<FontCacheThread>>,
|
||||
font_context: Arc<FontContext<SystemFontServiceProxy>>,
|
||||
|
||||
/// Is this the first reflow in this LayoutThread?
|
||||
first_reflow: Cell<bool>,
|
||||
|
@ -177,7 +177,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,
|
||||
|
@ -502,7 +502,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_sender: WebRenderScriptApi,
|
||||
paint_time_metrics: PaintTimeMetrics,
|
||||
|
@ -521,7 +521,7 @@ impl LayoutThread {
|
|||
|
||||
// The device pixel ratio is incorrect (it does not have the hidpi value),
|
||||
// but it will be set correctly when the initial reflow takes place.
|
||||
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,
|
||||
|
@ -1227,7 +1227,7 @@ impl RegisteredSpeculativePainters for RegisteredPaintersImpl {
|
|||
}
|
||||
}
|
||||
|
||||
struct LayoutFontMetricsProvider(Arc<FontContext<FontCacheThread>>);
|
||||
struct LayoutFontMetricsProvider(Arc<FontContext<SystemFontServiceProxy>>);
|
||||
|
||||
impl FontMetricsProvider for LayoutFontMetricsProvider {
|
||||
fn query_font_metrics(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue