mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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>
This commit is contained in:
parent
4849ba901e
commit
9c0561536d
44 changed files with 636 additions and 1253 deletions
|
@ -20,8 +20,8 @@ use msg::constellation_msg::{PipelineId, TopLevelBrowsingContextId};
|
|||
use net_traits::image::base::Image;
|
||||
use net_traits::NetToCompositorMsg;
|
||||
use script_traits::{
|
||||
AnimationState, ConstellationControlMsg, EventResult, LayoutControlMsg, MouseButton,
|
||||
MouseEventType, ScriptToCompositorMsg,
|
||||
AnimationState, ConstellationControlMsg, EventResult, MouseButton, MouseEventType,
|
||||
ScriptToCompositorMsg,
|
||||
};
|
||||
use style_traits::CSSPixel;
|
||||
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
|
||||
|
@ -132,7 +132,7 @@ pub enum CompositorMsg {
|
|||
/// Required to allow WGL GLContext sharing in Windows.
|
||||
Dispatch(Box<dyn Fn() + Send>),
|
||||
/// Indicates to the compositor that it needs to record the time when the frame with
|
||||
/// the given ID (epoch) is painted and report it to the layout thread of the given
|
||||
/// the given ID (epoch) is painted and report it to the layout of the given
|
||||
/// pipeline ID.
|
||||
PendingPaintMetric(PipelineId, Epoch),
|
||||
/// The load of a page has completed
|
||||
|
@ -165,7 +165,6 @@ pub struct CompositionPipeline {
|
|||
pub id: PipelineId,
|
||||
pub top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
pub script_chan: IpcSender<ConstellationControlMsg>,
|
||||
pub layout_chan: IpcSender<LayoutControlMsg>,
|
||||
}
|
||||
|
||||
pub enum FontToCompositorMsg {
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
[package]
|
||||
name = "layout_traits"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
license = "MPL-2.0"
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
name = "layout_traits"
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
crossbeam-channel = { workspace = true }
|
||||
gfx = { path = "../../gfx" }
|
||||
ipc-channel = { workspace = true }
|
||||
metrics = { path = "../../metrics" }
|
||||
msg = { workspace = true }
|
||||
net_traits = { workspace = true }
|
||||
profile_traits = { workspace = true }
|
||||
script_traits = { workspace = true }
|
||||
servo_url = { path = "../../url" }
|
|
@ -1,53 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
// This module contains traits in layout used generically
|
||||
// in the rest of Servo.
|
||||
// The traits are here instead of in layout so
|
||||
// that these modules won't have to depend on layout.
|
||||
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use metrics::PaintTimeMetrics;
|
||||
use msg::constellation_msg::{
|
||||
BackgroundHangMonitorRegister, PipelineId, TopLevelBrowsingContextId,
|
||||
};
|
||||
use net_traits::image_cache::ImageCache;
|
||||
use profile_traits::{mem, time};
|
||||
use script_traits::{
|
||||
ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg, WebrenderIpcSender,
|
||||
WindowSizeData,
|
||||
};
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
// A static method creating a layout thread
|
||||
// Here to remove the compositor -> layout dependency
|
||||
pub trait LayoutThreadFactory {
|
||||
type Message;
|
||||
fn create(
|
||||
id: PipelineId,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
url: ServoUrl,
|
||||
is_iframe: bool,
|
||||
chan: (Sender<Self::Message>, Receiver<Self::Message>),
|
||||
pipeline_port: IpcReceiver<LayoutControlMsg>,
|
||||
background_hang_monitor: Box<dyn BackgroundHangMonitorRegister>,
|
||||
constellation_chan: IpcSender<ConstellationMsg>,
|
||||
script_chan: IpcSender<ConstellationControlMsg>,
|
||||
image_cache: Arc<dyn ImageCache>,
|
||||
font_cache_thread: FontCacheThread,
|
||||
time_profiler_chan: time::ProfilerChan,
|
||||
mem_profiler_chan: mem::ProfilerChan,
|
||||
webrender_api_sender: WebrenderIpcSender,
|
||||
paint_time_metrics: PaintTimeMetrics,
|
||||
busy: Arc<AtomicBool>,
|
||||
window_size: WindowSizeData,
|
||||
);
|
||||
}
|
|
@ -459,7 +459,6 @@ pub enum LayoutHangAnnotation {
|
|||
Reflow,
|
||||
GetRPC,
|
||||
CollectReports,
|
||||
PrepareToExit,
|
||||
ExitNow,
|
||||
GetCurrentEpoch,
|
||||
GetWebFontLoadState,
|
||||
|
@ -468,7 +467,6 @@ pub enum LayoutHangAnnotation {
|
|||
SetScrollStates,
|
||||
UpdateScrollStateFromScript,
|
||||
RegisterPaint,
|
||||
SetNavigationStart,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||
|
@ -611,7 +609,6 @@ impl fmt::Debug for HangProfile {
|
|||
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub enum MonitoredComponentType {
|
||||
Layout,
|
||||
Script,
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,13 @@ pub mod webdriver_msg;
|
|||
use std::borrow::Cow;
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::fmt;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
|
||||
use bitflags::bitflags;
|
||||
use bluetooth_traits::BluetoothRequest;
|
||||
use canvas_traits::webgl::WebGLPipeline;
|
||||
use compositor::ScrollTreeNodeId;
|
||||
use crossbeam_channel::{Receiver, RecvTimeoutError, Sender};
|
||||
use crossbeam_channel::{RecvTimeoutError, Sender};
|
||||
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
|
||||
use embedder_traits::{CompositorEventVariant, Cursor};
|
||||
use euclid::default::Point2D;
|
||||
|
@ -110,19 +109,14 @@ impl UntrustedNodeAddress {
|
|||
}
|
||||
}
|
||||
|
||||
/// Messages sent to the layout thread from the constellation and/or compositor.
|
||||
/// Messages sent to layout from the constellation and/or compositor.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum LayoutControlMsg {
|
||||
/// Requests that this layout thread exit.
|
||||
/// Requests that this layout clean up before exit.
|
||||
ExitNow,
|
||||
/// Requests the current epoch (layout counter) from this layout.
|
||||
GetCurrentEpoch(IpcSender<Epoch>),
|
||||
/// Tells layout about the new scrolling offsets of each scrollable stacking context.
|
||||
SetScrollStates(Vec<ScrollState>),
|
||||
/// Requests the current load state of Web fonts. `true` is returned if fonts are still loading
|
||||
/// and `false` is returned if all fonts have loaded.
|
||||
GetWebFontLoadState(IpcSender<bool>),
|
||||
/// Send the paint time for a specific epoch to the layout thread.
|
||||
/// Send the paint time for a specific epoch to layout.
|
||||
PaintMetric(Epoch, u64),
|
||||
}
|
||||
|
||||
|
@ -233,8 +227,6 @@ pub struct NewLayoutInfo {
|
|||
pub load_data: LoadData,
|
||||
/// Information about the initial window size.
|
||||
pub window_size: WindowSizeData,
|
||||
/// A port on which layout can receive messages from the pipeline.
|
||||
pub pipeline_port: IpcReceiver<LayoutControlMsg>,
|
||||
}
|
||||
|
||||
/// When a pipeline is closed, should its browsing context be discarded too?
|
||||
|
@ -293,7 +285,7 @@ pub enum ConstellationControlMsg {
|
|||
/// Sends the final response to script thread for fetching after all redirections
|
||||
/// have been resolved
|
||||
NavigationResponse(PipelineId, FetchResponseMsg),
|
||||
/// Gives a channel and ID to a layout thread, as well as the ID of that layout's parent
|
||||
/// Gives a channel and ID to a layout, as well as the ID of that layout's parent
|
||||
AttachLayout(NewLayoutInfo),
|
||||
/// Window resized. Sends a DOM event eventually, but first we combine events.
|
||||
Resize(PipelineId, WindowSizeData, WindowSizeType),
|
||||
|
@ -401,6 +393,10 @@ pub enum ConstellationControlMsg {
|
|||
MediaSessionAction(PipelineId, MediaSessionActionType),
|
||||
/// Notifies script thread that WebGPU server has started
|
||||
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 {
|
||||
|
@ -439,6 +435,8 @@ impl fmt::Debug for ConstellationControlMsg {
|
|||
ExitFullScreen(..) => "ExitFullScreen",
|
||||
MediaSessionAction(..) => "MediaSessionAction",
|
||||
SetWebGPUPort(..) => "SetWebGPUPort",
|
||||
ForLayoutFromConstellation(..) => "ForLayoutFromConstellation",
|
||||
ForLayoutFromFontCache(..) => "ForLayoutFromFontCache",
|
||||
};
|
||||
write!(formatter, "ConstellationControlMsg::{}", variant)
|
||||
}
|
||||
|
@ -664,7 +662,7 @@ pub struct InitialScriptState {
|
|||
pub script_to_constellation_chan: ScriptToConstellationChan,
|
||||
/// A handle to register script-(and associated layout-)threads for hang monitoring.
|
||||
pub background_hang_monitor_register: Box<dyn BackgroundHangMonitorRegister>,
|
||||
/// A sender for the layout thread to communicate to the constellation.
|
||||
/// A sender layout to communicate to the constellation.
|
||||
pub layout_to_constellation_chan: IpcSender<LayoutMsg>,
|
||||
/// A channel to schedule timer events.
|
||||
pub scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||
|
@ -694,25 +692,10 @@ pub struct InitialScriptState {
|
|||
pub webrender_document: DocumentId,
|
||||
/// FIXME(victor): The Webrender API sender in this constellation's pipeline
|
||||
pub webrender_api_sender: WebrenderIpcSender,
|
||||
/// Flag to indicate if the layout thread is busy handling a request.
|
||||
pub layout_is_busy: Arc<AtomicBool>,
|
||||
/// Application window's GL Context for Media player
|
||||
pub player_context: WindowGLContext,
|
||||
}
|
||||
|
||||
/// This trait allows creating a `ScriptThread` without depending on the `script`
|
||||
/// crate.
|
||||
pub trait ScriptThreadFactory {
|
||||
/// Type of message sent from script to layout.
|
||||
type Message;
|
||||
/// Create a `ScriptThread`.
|
||||
fn create(
|
||||
state: InitialScriptState,
|
||||
load_data: LoadData,
|
||||
user_agent: Cow<'static, str>,
|
||||
) -> (Sender<Self::Message>, Receiver<Self::Message>);
|
||||
}
|
||||
|
||||
/// This trait allows creating a `ServiceWorkerManager` without depending on the `script`
|
||||
/// crate.
|
||||
pub trait ServiceWorkerManagerFactory {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -16,6 +16,7 @@ atomic_refcell = { workspace = true }
|
|||
canvas_traits = { workspace = true }
|
||||
crossbeam-channel = { workspace = true }
|
||||
euclid = { workspace = true }
|
||||
gfx = { path = "../../gfx" }
|
||||
gfx_traits = { workspace = true }
|
||||
html5ever = { workspace = true }
|
||||
ipc-channel = { workspace = true }
|
||||
|
|
|
@ -13,15 +13,25 @@ pub mod rpc;
|
|||
pub mod wrapper_traits;
|
||||
|
||||
use std::any::Any;
|
||||
use std::borrow::Cow;
|
||||
use std::sync::atomic::AtomicIsize;
|
||||
use std::sync::Arc;
|
||||
|
||||
use atomic_refcell::AtomicRefCell;
|
||||
use canvas_traits::canvas::{CanvasId, CanvasMsg};
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use gfx_traits::Epoch;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use libc::c_void;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use net_traits::image_cache::PendingImageId;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use metrics::PaintTimeMetrics;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use net_traits::image_cache::{ImageCache, PendingImageId};
|
||||
use profile_traits::time;
|
||||
use script_traits::{
|
||||
ConstellationControlMsg, InitialScriptState, LayoutControlMsg, LayoutMsg, LoadData,
|
||||
UntrustedNodeAddress, WebrenderIpcSender, WindowSizeData,
|
||||
};
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use style::data::ElementData;
|
||||
use webrender_api::ImageKey;
|
||||
|
@ -162,3 +172,57 @@ pub struct PendingImage {
|
|||
pub struct HTMLMediaData {
|
||||
pub current_frame: Option<(ImageKey, i32, i32)>,
|
||||
}
|
||||
|
||||
pub struct LayoutConfig {
|
||||
pub id: PipelineId,
|
||||
pub url: ServoUrl,
|
||||
pub is_iframe: bool,
|
||||
pub constellation_chan: IpcSender<LayoutMsg>,
|
||||
pub script_chan: IpcSender<ConstellationControlMsg>,
|
||||
pub image_cache: Arc<dyn ImageCache>,
|
||||
pub font_cache_thread: FontCacheThread,
|
||||
pub time_profiler_chan: time::ProfilerChan,
|
||||
pub webrender_api_sender: WebrenderIpcSender,
|
||||
pub paint_time_metrics: PaintTimeMetrics,
|
||||
pub window_size: WindowSizeData,
|
||||
}
|
||||
|
||||
pub trait LayoutFactory: Send + Sync {
|
||||
fn create(&self, config: LayoutConfig) -> Box<dyn Layout>;
|
||||
}
|
||||
|
||||
pub trait Layout {
|
||||
/// Process a single message from script.
|
||||
fn process(&mut self, msg: message::Msg);
|
||||
|
||||
/// 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);
|
||||
|
||||
/// Return the interface used for scipt queries.
|
||||
/// TODO: Make this part of the the Layout interface itself now that the
|
||||
/// layout thread has been removed.
|
||||
fn rpc(&self) -> Box<dyn rpc::LayoutRPC>;
|
||||
|
||||
/// Whether or not this layout is waiting for fonts from loaded stylesheets to finish loading.
|
||||
fn waiting_for_web_fonts_to_load(&self) -> bool;
|
||||
|
||||
/// The currently laid out Epoch that this Layout has finished.
|
||||
fn current_epoch(&self) -> Epoch;
|
||||
}
|
||||
|
||||
/// This trait is part of `layout_traits` because it depends on both `script_traits` and also
|
||||
/// `LayoutFactory` from this crate. If it was in `script_traits` there would be a circular
|
||||
/// dependency.
|
||||
pub trait ScriptThreadFactory {
|
||||
/// Create a `ScriptThread`.
|
||||
fn create(
|
||||
state: InitialScriptState,
|
||||
layout_factory: Arc<dyn LayoutFactory>,
|
||||
font_cache_thread: FontCacheThread,
|
||||
load_data: LoadData,
|
||||
user_agent: Cow<'static, str>,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2,26 +2,16 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
|
||||
use app_units::Au;
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use crossbeam_channel::Sender;
|
||||
use euclid::default::{Point2D, Rect};
|
||||
use gfx_traits::Epoch;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use metrics::PaintTimeMetrics;
|
||||
use msg::constellation_msg::{BackgroundHangMonitorRegister, BrowsingContextId, PipelineId};
|
||||
use net_traits::image_cache::ImageCache;
|
||||
use msg::constellation_msg::BrowsingContextId;
|
||||
use profile_traits::mem::ReportsChan;
|
||||
use script_traits::{
|
||||
ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg, Painter, ScrollState,
|
||||
WindowSizeData,
|
||||
};
|
||||
use script_traits::{Painter, ScrollState, WindowSizeData};
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_atoms::Atom;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use servo_url::ImmutableOrigin;
|
||||
use style::animation::DocumentAnimationSet;
|
||||
use style::context::QuirksMode;
|
||||
use style::dom::OpaqueNode;
|
||||
|
@ -52,42 +42,19 @@ pub enum Msg {
|
|||
/// Get an RPC interface.
|
||||
GetRPC(Sender<Box<dyn LayoutRPC + Send>>),
|
||||
|
||||
/// Requests that the layout thread measure its memory usage. The resulting reports are sent back
|
||||
/// Requests that layout measure its memory usage. The resulting reports are sent back
|
||||
/// via the supplied channel.
|
||||
CollectReports(ReportsChan),
|
||||
|
||||
/// Requests that the layout thread enter a quiescent state in which no more messages are
|
||||
/// accepted except `ExitMsg`. A response message will be sent on the supplied channel when
|
||||
/// this happens.
|
||||
PrepareToExit(Sender<()>),
|
||||
|
||||
/// Requests that the layout thread immediately shut down. There must be no more nodes left after
|
||||
/// Requests that layout immediately shut down. There must be no more nodes left after
|
||||
/// this, or layout will crash.
|
||||
ExitNow,
|
||||
|
||||
/// Get the last epoch counter for this layout thread.
|
||||
GetCurrentEpoch(IpcSender<Epoch>),
|
||||
|
||||
/// Asks the layout thread whether any Web fonts have yet to load (if true, loads are pending;
|
||||
/// false otherwise).
|
||||
GetWebFontLoadState(IpcSender<bool>),
|
||||
|
||||
/// Creates a new layout thread.
|
||||
///
|
||||
/// This basically exists to keep the script-layout dependency one-way.
|
||||
CreateLayoutThread(LayoutThreadInit),
|
||||
|
||||
/// Set the final Url.
|
||||
SetFinalUrl(ServoUrl),
|
||||
|
||||
/// Tells layout about the new scrolling offsets of each scrollable stacking context.
|
||||
SetScrollStates(Vec<ScrollState>),
|
||||
|
||||
/// Tells layout that script has added some paint worklet modules.
|
||||
RegisterPaint(Atom, Vec<Atom>, Box<dyn Painter>),
|
||||
|
||||
/// Send to layout the precise time when the navigation started.
|
||||
SetNavigationStart(u64),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
@ -218,21 +185,6 @@ pub struct ScriptReflow {
|
|||
pub animations: DocumentAnimationSet,
|
||||
}
|
||||
|
||||
pub struct LayoutThreadInit {
|
||||
pub id: PipelineId,
|
||||
pub url: ServoUrl,
|
||||
pub is_parent: bool,
|
||||
pub layout_pair: (Sender<Msg>, Receiver<Msg>),
|
||||
pub pipeline_port: IpcReceiver<LayoutControlMsg>,
|
||||
pub background_hang_monitor_register: Box<dyn BackgroundHangMonitorRegister>,
|
||||
pub constellation_chan: IpcSender<ConstellationMsg>,
|
||||
pub script_chan: IpcSender<ConstellationControlMsg>,
|
||||
pub image_cache: Arc<dyn ImageCache>,
|
||||
pub paint_time_metrics: PaintTimeMetrics,
|
||||
pub layout_is_busy: Arc<AtomicBool>,
|
||||
pub window_size: WindowSizeData,
|
||||
}
|
||||
|
||||
/// A pending restyle.
|
||||
#[derive(Debug, MallocSizeOf)]
|
||||
pub struct PendingRestyle {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue