aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-05-22 10:30:35 +0200
committerGitHub <noreply@github.com>2024-05-22 08:30:35 +0000
commit9f32809671c8c8e79d59c95194dcc466452299fc (patch)
treee813eb7d1e3971bba08ad119ff6ddf15ebca6d01 /components/shared
parentd47c8ff2aeebe5854a7c8484a33d285268347fee (diff)
downloadservo-9f32809671c8c8e79d59c95194dcc466452299fc.tar.gz
servo-9f32809671c8c8e79d59c95194dcc466452299fc.zip
fonts: Clean up messaging during web fonts loads (#32332)
Instead of sending a message to the script thread via IPC when a web font loads and then sending another, just give the `FontContext` a callback that send a single message to the script thread. This moves all the cache invalidation internally into `FontContext` as well. Additionally, the unused LayoutControlMessage::ExitNow enum variant is removed. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'components/shared')
-rw-r--r--components/shared/gfx/lib.rs4
-rw-r--r--components/shared/script/lib.rs5
-rw-r--r--components/shared/script_layout/lib.rs5
3 files changed, 5 insertions, 9 deletions
diff --git a/components/shared/gfx/lib.rs b/components/shared/gfx/lib.rs
index e5699f2504a..032dcfd19e0 100644
--- a/components/shared/gfx/lib.rs
+++ b/components/shared/gfx/lib.rs
@@ -4,6 +4,8 @@
#![deny(unsafe_code)]
+use std::sync::Arc;
+
use malloc_size_of_derive::MallocSizeOf;
use range::{int_range_index, RangeIndex};
use serde::{Deserialize, Serialize};
@@ -14,3 +16,5 @@ int_range_index! {
/// the middle of a glyph.
struct ByteIndex(isize)
}
+
+pub type WebFontLoadFinishedCallback = Arc<dyn Fn(bool) + Send + Sync + 'static>;
diff --git a/components/shared/script/lib.rs b/components/shared/script/lib.rs
index 16f1e07710d..931e34c2a2b 100644
--- a/components/shared/script/lib.rs
+++ b/components/shared/script/lib.rs
@@ -113,8 +113,6 @@ impl UntrustedNodeAddress {
/// Messages sent to layout from the constellation and/or compositor.
#[derive(Debug, Deserialize, Serialize)]
pub enum LayoutControlMsg {
- /// Requests that this layout clean up before exit.
- ExitNow,
/// Tells layout about the new scrolling offsets of each scrollable stacking context.
SetScrollStates(Vec<ScrollState>),
/// Send the paint time for a specific epoch to layout.
@@ -395,8 +393,6 @@ pub enum ConstellationControlMsg {
SetWebGPUPort(IpcReceiver<WebGPUMsg>),
/// A mesage for a layout from the constellation.
ForLayoutFromConstellation(LayoutControlMsg, PipelineId),
- /// A message for a layout from the font cache.
- ForLayoutFromFontCache(PipelineId),
}
impl fmt::Debug for ConstellationControlMsg {
@@ -436,7 +432,6 @@ impl fmt::Debug for ConstellationControlMsg {
MediaSessionAction(..) => "MediaSessionAction",
SetWebGPUPort(..) => "SetWebGPUPort",
ForLayoutFromConstellation(..) => "ForLayoutFromConstellation",
- ForLayoutFromFontCache(..) => "ForLayoutFromFontCache",
};
write!(formatter, "ConstellationControlMsg::{}", variant)
}
diff --git a/components/shared/script_layout/lib.rs b/components/shared/script_layout/lib.rs
index a15f0be9bde..b65d42d1731 100644
--- a/components/shared/script_layout/lib.rs
+++ b/components/shared/script_layout/lib.rs
@@ -179,10 +179,7 @@ pub trait LayoutFactory: Send + Sync {
pub trait Layout {
/// Handle a single message from the Constellation.
- fn handle_constellation_msg(&mut self, msg: LayoutControlMsg);
-
- /// Handle a a single mesasge from the FontCacheThread.
- fn handle_font_cache_msg(&mut self);
+ fn handle_constellation_message(&mut self, msg: LayoutControlMsg);
/// Get a reference to this Layout's Stylo `Device` used to handle media queries and
/// resolve font metrics.