aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/script/script_msg.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-02-23 09:14:10 +0100
committerGitHub <noreply@github.com>2024-02-23 08:14:10 +0000
commit9c0561536d37f64c028d67648091a314b5b88f6f (patch)
treed9376aebb1970cb89adb76b610e7176a58e7c7da /components/shared/script/script_msg.rs
parent4849ba901efab9304d71b316ec9e0d7e98e1993b (diff)
downloadservo-9c0561536d37f64c028d67648091a314b5b88f6f.tar.gz
servo-9c0561536d37f64c028d67648091a314b5b88f6f.zip
script: Do not run layout in a thread (#31346)
* script: Do not run layout in a thread Instead of spawning a thread for layout that almost always runs synchronously with script, simply run layout in the script thread. This is a resurrection of #28708, taking just the bits that remove the layout thread. It's a complex change and thus is just a first step toward cleaning up the interface between script and layout. Messages are still passed from script to layout via a `process()` method and script proxies some messages to layout from other threads as well. Big changes: 1. Layout is created in the script thread on Document load, thus every live document is guaranteed to have a layout. This isn't completely hidden in the interface, but we can safely `unwrap()` on a Document's layout. 2. Layout configuration is abstracted away into a LayoutConfig struct and the LayoutFactory is a struct passed around by the Constellation. This is to avoid having to monomorphize the entire script thread for each layout. 3. Instead of having the Constellation block on the layout thread to figure out the current epoch and whether there are pending web fonts loading, updates are sent synchronously to the Constellation when rendering to a screenshot. This practically only used by the WPT. A couple tests start to fail, which is probably inevitable since removing the layout thread has introduced timing changes in "exit after load" and screenshot behavior. Co-authored-by: Josh Matthews <josh@joshmatthews.net> * Update test expectations * Fix some issues found during review * Clarify some comments * Address review comments --------- Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/shared/script/script_msg.rs')
-rw-r--r--components/shared/script/script_msg.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/components/shared/script/script_msg.rs b/components/shared/script/script_msg.rs
index 5abef781743..8f55db70a12 100644
--- a/components/shared/script/script_msg.rs
+++ b/components/shared/script/script_msg.rs
@@ -29,8 +29,8 @@ use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
use crate::{
AnimationState, AuxiliaryBrowsingContextLoadInfo, BroadcastMsg, DocumentState,
- IFrameLoadInfoWithData, LayoutControlMsg, LoadData, MessagePortMsg, PortMessageTask,
- StructuredSerializedData, WindowSizeType, WorkerGlobalScopeInit, WorkerScriptLoadOrigin,
+ IFrameLoadInfoWithData, LoadData, MessagePortMsg, PortMessageTask, StructuredSerializedData,
+ WindowSizeType, WorkerGlobalScopeInit, WorkerScriptLoadOrigin,
};
/// An iframe sizing operation.
@@ -220,16 +220,15 @@ pub enum ScriptMsg {
/// A load has been requested in an IFrame.
ScriptLoadedURLInIFrame(IFrameLoadInfoWithData),
/// A load of the initial `about:blank` has been completed in an IFrame.
- ScriptNewIFrame(IFrameLoadInfoWithData, IpcSender<LayoutControlMsg>),
+ ScriptNewIFrame(IFrameLoadInfoWithData),
/// Script has opened a new auxiliary browsing context.
- ScriptNewAuxiliary(
- AuxiliaryBrowsingContextLoadInfo,
- IpcSender<LayoutControlMsg>,
- ),
+ ScriptNewAuxiliary(AuxiliaryBrowsingContextLoadInfo),
/// Mark a new document as active
ActivateDocument,
/// Set the document state for a pipeline (used by screenshot / reftests)
SetDocumentState(DocumentState),
+ /// Update the layout epoch in the constellation (used by screenshot / reftests).
+ SetLayoutEpoch(Epoch, IpcSender<bool>),
/// Update the pipeline Url, which can change after redirections.
SetFinalUrl(ServoUrl),
/// Script has handled a touch event, and either prevented or allowed default actions.
@@ -311,6 +310,7 @@ impl fmt::Debug for ScriptMsg {
ScriptNewAuxiliary(..) => "ScriptNewAuxiliary",
ActivateDocument => "ActivateDocument",
SetDocumentState(..) => "SetDocumentState",
+ SetLayoutEpoch(..) => "SetLayoutEpoch",
SetFinalUrl(..) => "SetFinalUrl",
TouchEventProcessed(..) => "TouchEventProcessed",
LogEntry(..) => "LogEntry",