diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-05-17 14:28:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-17 12:28:58 +0000 |
commit | 3398fc017b994fff113342baab47718a44a37752 (patch) | |
tree | 9ec5881db059b0bda7d374ad4d0abe96319e5c25 | |
parent | 1017533297889beca40be5f121629347963fbf27 (diff) | |
download | servo-3398fc017b994fff113342baab47718a44a37752.tar.gz servo-3398fc017b994fff113342baab47718a44a37752.zip |
Move non-gfx things out of `gfx_traits` and create a `base` crate (#32296)
For a long time, `gfx_traits` has held a lot of things unrelated to graphics
and also unrelated to the `gfx` crate (which is mostly about fonts).
This is a cleanup which does a few things:
1. Move non `gfx` crate things out of `gfx_traits`. This is important in
order to prevent dependency cycles with a different integration between
layout, script, and fonts.
2. Rename the `msg` crate to `base`. It didn't really contain anything
to do with messages and instead mostly holds ids, which are used
across many different crates in Servo. This new crate will hold the
*rare* data types that are widely used.
Details:
- All BackgroundHangMonitor-related things from base to a new
`background_hang_monitor_api` crate.
- Moved `TraversalDirection` to `script_traits`
- Moved `Epoch`-related things from `gfx_traits` to `base`.
- Moved `PrintTree` to base. This should be widely useful in Servo.
- Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it
to `WebRenderFontApi`.
163 files changed, 709 insertions, 632 deletions
diff --git a/Cargo.lock b/Cargo.lock index e909acbbe0e..5fc58b78c20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -293,20 +293,36 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" name = "background_hang_monitor" version = "0.0.1" dependencies = [ + "background_hang_monitor_api", "backtrace", + "base", "crossbeam-channel", "ipc-channel", "lazy_static", "libc", "log", "mach2", - "msg", "nix 0.27.1", "serde_json", "unwind-sys", ] [[package]] +name = "background_hang_monitor_api" +version = "0.0.1" +dependencies = [ + "base", + "ipc-channel", + "lazy_static", + "malloc_size_of", + "malloc_size_of_derive", + "parking_lot", + "serde", + "size_of_test", + "webrender_api", +] + +[[package]] name = "backtrace" version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -322,6 +338,20 @@ dependencies = [ ] [[package]] +name = "base" +version = "0.0.1" +dependencies = [ + "ipc-channel", + "lazy_static", + "malloc_size_of", + "malloc_size_of_derive", + "parking_lot", + "serde", + "size_of_test", + "webrender_api", +] + +[[package]] name = "base64" version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -821,6 +851,7 @@ dependencies = [ name = "compositing" version = "0.0.1" dependencies = [ + "base", "canvas", "compositing_traits", "crossbeam-channel", @@ -835,7 +866,6 @@ dependencies = [ "keyboard-types", "libc", "log", - "msg", "net_traits", "pixels", "profile_traits", @@ -856,6 +886,7 @@ dependencies = [ name = "compositing_traits" version = "0.0.1" dependencies = [ + "base", "canvas", "crossbeam-channel", "embedder_traits", @@ -864,7 +895,6 @@ dependencies = [ "ipc-channel", "keyboard-types", "log", - "msg", "net_traits", "script_traits", "servo_url", @@ -886,7 +916,9 @@ name = "constellation" version = "0.0.1" dependencies = [ "background_hang_monitor", + "background_hang_monitor_api", "backtrace", + "base", "bluetooth_traits", "canvas_traits", "compositing_traits", @@ -903,7 +935,6 @@ dependencies = [ "log", "media", "metrics", - "msg", "net", "net_traits", "parking_lot", @@ -1252,6 +1283,7 @@ dependencies = [ name = "devtools" version = "0.0.1" dependencies = [ + "base", "chrono", "crossbeam-channel", "devtools_traits", @@ -1260,7 +1292,6 @@ dependencies = [ "http", "ipc-channel", "log", - "msg", "serde", "serde_json", "servo_config", @@ -1273,12 +1304,12 @@ dependencies = [ name = "devtools_traits" version = "0.0.1" dependencies = [ + "base", "bitflags 2.5.0", "http", "ipc-channel", "malloc_size_of", "malloc_size_of_derive", - "msg", "serde", "servo_url", "time 0.1.45", @@ -1481,13 +1512,13 @@ dependencies = [ name = "embedder_traits" version = "0.0.1" dependencies = [ + "base", "cfg-if", "crossbeam-channel", "ipc-channel", "keyboard-types", "lazy_static", "log", - "msg", "num-derive", "num-traits", "serde", @@ -2020,6 +2051,7 @@ dependencies = [ "unicode-properties", "unicode-script", "webrender_api", + "webrender_traits", "xi-unicode", "xml-rs", "yeslogic-fontconfig-sys", @@ -3191,6 +3223,7 @@ version = "0.0.1" dependencies = [ "app_units", "atomic_refcell", + "base", "bitflags 2.5.0", "canvas_traits", "embedder_traits", @@ -3203,7 +3236,7 @@ dependencies = [ "lazy_static", "log", "malloc_size_of", - "msg", + "malloc_size_of_derive", "net_traits", "parking_lot", "profile_traits", @@ -3234,6 +3267,7 @@ version = "0.0.1" dependencies = [ "app_units", "atomic_refcell", + "base", "bitflags 2.5.0", "canvas_traits", "cssparser", @@ -3248,7 +3282,6 @@ dependencies = [ "ipc-channel", "lazy_static", "log", - "msg", "net_traits", "parking_lot", "quickcheck", @@ -3276,6 +3309,7 @@ name = "layout_thread_2013" version = "0.0.1" dependencies = [ "app_units", + "base", "crossbeam-channel", "embedder_traits", "euclid", @@ -3290,7 +3324,6 @@ dependencies = [ "log", "malloc_size_of", "metrics", - "msg", "net_traits", "parking_lot", "profile_traits", @@ -3316,6 +3349,7 @@ name = "layout_thread_2020" version = "0.0.1" dependencies = [ "app_units", + "base", "crossbeam-channel", "embedder_traits", "euclid", @@ -3329,7 +3363,6 @@ dependencies = [ "log", "malloc_size_of", "metrics", - "msg", "net_traits", "parking_lot", "profile_traits", @@ -3461,6 +3494,7 @@ name = "libservo" version = "0.0.1" dependencies = [ "background_hang_monitor", + "base", "bluetooth", "bluetooth_traits", "canvas", @@ -3486,7 +3520,6 @@ dependencies = [ "log", "media", "mozangle", - "msg", "net", "net_traits", "profile", @@ -3747,12 +3780,12 @@ dependencies = [ name = "metrics" version = "0.0.1" dependencies = [ + "base", "gfx_traits", "ipc-channel", "log", "malloc_size_of", "malloc_size_of_derive", - "msg", "profile_traits", "script_traits", "servo_config", @@ -3763,10 +3796,10 @@ dependencies = [ name = "metrics_tests" version = "0.0.1" dependencies = [ + "base", "gfx_traits", "ipc-channel", "metrics", - "msg", "profile_traits", "servo_url", "time 0.1.45", @@ -3880,20 +3913,6 @@ dependencies = [ ] [[package]] -name = "msg" -version = "0.0.1" -dependencies = [ - "ipc-channel", - "lazy_static", - "malloc_size_of", - "malloc_size_of_derive", - "parking_lot", - "serde", - "size_of_test", - "webrender_api", -] - -[[package]] name = "muldiv" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3956,6 +3975,7 @@ version = "0.0.1" dependencies = [ "async-recursion", "async-tungstenite", + "base", "base64", "brotli", "bytes", @@ -3982,7 +4002,6 @@ dependencies = [ "malloc_size_of_derive", "mime", "mime_guess", - "msg", "net_traits", "percent-encoding", "pixels", @@ -4013,6 +4032,7 @@ dependencies = [ name = "net_traits" version = "0.0.1" dependencies = [ + "base", "content-security-policy", "cookie 0.12.0", "embedder_traits", @@ -4027,7 +4047,6 @@ dependencies = [ "malloc_size_of", "malloc_size_of_derive", "mime", - "msg", "num-traits", "percent-encoding", "pixels", @@ -5015,7 +5034,9 @@ dependencies = [ "app_units", "arrayvec", "atomic_refcell", + "background_hang_monitor_api", "backtrace", + "base", "base64", "bitflags 2.5.0", "bluetooth_traits", @@ -5059,7 +5080,6 @@ dependencies = [ "mime_guess", "mozangle", "mozjs", - "msg", "net_traits", "num-traits", "num_cpus", @@ -5113,6 +5133,7 @@ version = "0.0.1" dependencies = [ "app_units", "atomic_refcell", + "base", "canvas_traits", "crossbeam-channel", "euclid", @@ -5124,12 +5145,12 @@ dependencies = [ "malloc_size_of", "malloc_size_of_derive", "metrics", - "msg", "net_traits", "profile_traits", "range", "script_traits", "selectors", + "serde", "servo_arc", "servo_atoms", "servo_url", @@ -5152,6 +5173,8 @@ dependencies = [ name = "script_traits" version = "0.0.1" dependencies = [ + "background_hang_monitor_api", + "base", "bitflags 2.5.0", "bluetooth_traits", "canvas_traits", @@ -5170,7 +5193,6 @@ dependencies = [ "malloc_size_of", "malloc_size_of_derive", "media", - "msg", "net_traits", "pixels", "profile_traits", @@ -7048,6 +7070,7 @@ dependencies = [ name = "webdriver_server" version = "0.0.1" dependencies = [ + "base", "base64", "compositing_traits", "cookie 0.12.0", @@ -7058,7 +7081,6 @@ dependencies = [ "ipc-channel", "keyboard-types", "log", - "msg", "net_traits", "pixels", "script_traits", @@ -7076,11 +7098,11 @@ name = "webgpu" version = "0.0.1" dependencies = [ "arrayvec", + "base", "euclid", "ipc-channel", "log", "malloc_size_of", - "msg", "serde", "servo_config", "smallvec", diff --git a/Cargo.toml b/Cargo.toml index 0ea83dc0b7a..17e01a50b41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,9 @@ app_units = "0.7" arrayvec = "0.7" async-tungstenite = { version = "0.23", features = ["tokio-rustls-webpki-roots"] } atomic_refcell = "0.1.13" +background_hang_monitor_api = { path = "components/shared/background_hang_monitor" } backtrace = "0.3" +base = { path = "components/shared/base" } base64 = "0.21.7" bitflags = "2.5" bluetooth_traits = { path = "components/shared/bluetooth" } @@ -68,7 +70,6 @@ malloc_size_of_derive = "0.1" mime = "0.3.13" mime_guess = "2.0.3" mozangle = "0.5.1" -msg = { path = "components/shared/msg" } net_traits = { path = "components/shared/net" } num-traits = "0.2" num_cpus = "1.1.0" diff --git a/components/background_hang_monitor/Cargo.toml b/components/background_hang_monitor/Cargo.toml index 2e0a4630c98..d126fd3059a 100644 --- a/components/background_hang_monitor/Cargo.toml +++ b/components/background_hang_monitor/Cargo.toml @@ -13,12 +13,13 @@ test = false doctest = false [dependencies] +background_hang_monitor_api = { workspace = true } backtrace = { workspace = true } +base = { workspace = true } crossbeam-channel = { workspace = true } ipc-channel = { workspace = true } libc = { workspace = true } log = { workspace = true } -msg = { workspace = true } serde_json = { workspace = true } [dev-dependencies] diff --git a/components/background_hang_monitor/background_hang_monitor.rs b/components/background_hang_monitor/background_hang_monitor.rs index e57cf4b4f11..c0f0d22af14 100644 --- a/components/background_hang_monitor/background_hang_monitor.rs +++ b/components/background_hang_monitor/background_hang_monitor.rs @@ -8,15 +8,15 @@ use std::sync::{Arc, Weak}; use std::thread; use std::time::{Duration, Instant}; -use crossbeam_channel::{after, never, select, unbounded, Receiver, Sender}; -use ipc_channel::ipc::{IpcReceiver, IpcSender}; -use ipc_channel::router::ROUTER; -use log::warn; -use msg::constellation_msg::{ +use background_hang_monitor_api::{ BackgroundHangMonitor, BackgroundHangMonitorClone, BackgroundHangMonitorControlMsg, BackgroundHangMonitorExitSignal, BackgroundHangMonitorRegister, HangAlert, HangAnnotation, HangMonitorAlert, MonitoredComponentId, }; +use crossbeam_channel::{after, never, select, unbounded, Receiver, Sender}; +use ipc_channel::ipc::{IpcReceiver, IpcSender}; +use ipc_channel::router::ROUTER; +use log::warn; use crate::sampler::{NativeStack, Sampler}; diff --git a/components/background_hang_monitor/sampler.rs b/components/background_hang_monitor/sampler.rs index 82f6b7e0fde..9c67908c463 100644 --- a/components/background_hang_monitor/sampler.rs +++ b/components/background_hang_monitor/sampler.rs @@ -4,7 +4,7 @@ use std::ptr; -use msg::constellation_msg::{HangProfile, HangProfileSymbol}; +use background_hang_monitor_api::{HangProfile, HangProfileSymbol}; const MAX_NATIVE_FRAMES: usize = 1024; diff --git a/components/background_hang_monitor/tests/hang_monitor_tests.rs b/components/background_hang_monitor/tests/hang_monitor_tests.rs index f98978fea02..36a6b45eec3 100644 --- a/components/background_hang_monitor/tests/hang_monitor_tests.rs +++ b/components/background_hang_monitor/tests/hang_monitor_tests.rs @@ -10,12 +10,12 @@ use std::thread; use std::time::Duration; use background_hang_monitor::HangMonitorRegister; -use ipc_channel::ipc; -use msg::constellation_msg::{ +use background_hang_monitor_api::{ BackgroundHangMonitorControlMsg, BackgroundHangMonitorExitSignal, HangAlert, HangAnnotation, HangMonitorAlert, MonitoredComponentId, MonitoredComponentType, ScriptHangAnnotation, - TEST_PIPELINE_ID, }; +use base::id::TEST_PIPELINE_ID; +use ipc_channel::ipc; lazy_static::lazy_static! { static ref SERIAL: Mutex<()> = Mutex::new(()); diff --git a/components/compositing/Cargo.toml b/components/compositing/Cargo.toml index e1c0f0c7042..37c1b6b6a21 100644 --- a/components/compositing/Cargo.toml +++ b/components/compositing/Cargo.toml @@ -16,6 +16,7 @@ default = [] multiview = [] [dependencies] +base = { workspace = true } canvas = { path = "../canvas" } compositing_traits = { workspace = true } crossbeam-channel = { workspace = true } @@ -30,7 +31,6 @@ ipc-channel = { workspace = true } keyboard-types = { workspace = true } libc = { workspace = true } log = { workspace = true } -msg = { workspace = true } net_traits = { workspace = true } pixels = { path = "../pixels" } profile_traits = { workspace = true } diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 9e55648f5eb..d211a4c4783 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -11,6 +11,8 @@ use std::iter::once; use std::rc::Rc; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; +use base::id::{PipelineId, TopLevelBrowsingContextId, WebViewId}; +use base::{Epoch, WebRenderEpochToU16}; use canvas::canvas_paint_thread::ImageUpdate; use compositing_traits::{ CanvasToCompositorMsg, CompositionPipeline, CompositorMsg, CompositorReceiver, @@ -21,12 +23,10 @@ use embedder_traits::Cursor; use euclid::{Point2D, Rect, Scale, Transform3D, Vector2D}; use fnv::{FnvHashMap, FnvHashSet}; use gfx::rendering_context::RenderingContext; -use gfx_traits::{Epoch, WebRenderEpochToU16}; use image::{DynamicImage, ImageFormat}; use ipc_channel::ipc; use libc::c_void; use log::{debug, error, info, trace, warn}; -use msg::constellation_msg::{PipelineId, TopLevelBrowsingContextId, WebViewId}; use net_traits::image::base::Image; use net_traits::image_cache::CorsStatus; use pixels::PixelFormat; diff --git a/components/compositing/webview.rs b/components/compositing/webview.rs index b8698381520..1263f877012 100644 --- a/components/compositing/webview.rs +++ b/components/compositing/webview.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; -use msg::constellation_msg::{PipelineId, WebViewId}; +use base::id::{PipelineId, WebViewId}; use webrender_api::units::DeviceRect; #[derive(Debug, Default)] @@ -113,7 +113,7 @@ impl<WebView> WebViewManager<WebView> { mod test { use std::num::NonZeroU32; - use msg::constellation_msg::{ + use base::id::{ BrowsingContextId, BrowsingContextIndex, PipelineNamespace, PipelineNamespaceId, TopLevelBrowsingContextId, }; diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index fc7ef379be1..bb11457aa47 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -7,14 +7,15 @@ use std::fmt::{Debug, Error, Formatter}; use std::time::Duration; +use base::id::{PipelineId, TopLevelBrowsingContextId}; use embedder_traits::{EmbedderProxy, EventLoopWaker}; use euclid::Scale; use gfx::rendering_context::RenderingContext; use keyboard_types::KeyboardEvent; use libc::c_void; -use msg::constellation_msg::{PipelineId, TopLevelBrowsingContextId, TraversalDirection}; use script_traits::{ - GamepadEvent, MediaSessionActionType, MouseButton, TouchEventType, TouchId, WheelDelta, + GamepadEvent, MediaSessionActionType, MouseButton, TouchEventType, TouchId, TraversalDirection, + WheelDelta, }; use servo_geometry::DeviceIndependentPixel; use servo_url::ServoUrl; diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml index 0f10a5a23fb..851d207dfc2 100644 --- a/components/constellation/Cargo.toml +++ b/components/constellation/Cargo.toml @@ -15,8 +15,10 @@ default = [] multiview = [] [dependencies] +background_hang_monitor_api = { workspace = true } background_hang_monitor = { path = "../background_hang_monitor" } backtrace = { workspace = true } +base = { workspace = true } bluetooth_traits = { workspace = true } canvas_traits = { workspace = true } compositing_traits = { workspace = true } @@ -32,7 +34,6 @@ keyboard-types = { workspace = true } log = { workspace = true } media = { path = "../media" } metrics = { path = "../metrics" } -msg = { workspace = true } net = { path = "../net" } net_traits = { workspace = true } parking_lot = { workspace = true } diff --git a/components/constellation/browsingcontext.rs b/components/constellation/browsingcontext.rs index dbb956ad6c5..4f55c0fe3ac 100644 --- a/components/constellation/browsingcontext.rs +++ b/components/constellation/browsingcontext.rs @@ -4,11 +4,9 @@ use std::collections::{HashMap, HashSet}; +use base::id::{BrowsingContextGroupId, BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use euclid::Size2D; use log::warn; -use msg::constellation_msg::{ - BrowsingContextGroupId, BrowsingContextId, PipelineId, TopLevelBrowsingContextId, -}; use style_traits::CSSPixel; use crate::pipeline::Pipeline; diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 53b0ae8d412..14176fc0739 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -94,6 +94,15 @@ use std::sync::{Arc, Mutex}; use std::{process, thread}; use background_hang_monitor::HangMonitorRegister; +use background_hang_monitor_api::{ + BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, HangMonitorAlert, +}; +use base::id::{ + BroadcastChannelRouterId, BrowsingContextGroupId, BrowsingContextId, HistoryStateId, + MessagePortId, MessagePortRouterId, PipelineId, PipelineNamespace, PipelineNamespaceId, + PipelineNamespaceRequest, TopLevelBrowsingContextId, WebViewId, +}; +use base::Epoch; use bluetooth_traits::BluetoothRequest; use canvas_traits::canvas::{CanvasId, CanvasMsg}; use canvas_traits::webgl::WebGLThreads; @@ -113,7 +122,6 @@ use embedder_traits::{ use euclid::default::Size2D as UntypedSize2D; use euclid::Size2D; use gfx::font_cache_thread::FontCacheThread; -use gfx_traits::Epoch; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; use ipc_channel::Error as IpcError; @@ -121,12 +129,6 @@ use keyboard_types::webdriver::Event as WebDriverInputEvent; use keyboard_types::KeyboardEvent; use log::{debug, error, info, trace, warn}; use media::{GLPlayerThreads, WindowGLContext}; -use msg::constellation_msg::{ - BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, BroadcastChannelRouterId, - BrowsingContextGroupId, BrowsingContextId, HangMonitorAlert, HistoryStateId, MessagePortId, - MessagePortRouterId, PipelineId, PipelineNamespace, PipelineNamespaceId, - PipelineNamespaceRequest, TopLevelBrowsingContextId, TraversalDirection, WebViewId, -}; use net_traits::pub_domains::reg_host; use net_traits::request::{Referrer, RequestBuilder}; use net_traits::storage_thread::{StorageThreadMsg, StorageType}; @@ -142,8 +144,8 @@ use script_traits::{ LoadData, LoadOrigin, LogEntry, MediaSessionActionType, MessagePortMsg, MouseEventType, PortMessageTask, SWManagerMsg, SWManagerSenders, ScriptMsg as FromScriptMsg, ScriptToConstellationChan, ServiceWorkerManagerFactory, ServiceWorkerMsg, - StructuredSerializedData, TimerSchedulerMsg, UpdatePipelineIdReason, WebDriverCommandMsg, - WindowSizeData, WindowSizeType, + StructuredSerializedData, TimerSchedulerMsg, TraversalDirection, UpdatePipelineIdReason, + WebDriverCommandMsg, WindowSizeData, WindowSizeType, }; use serde::{Deserialize, Serialize}; use servo_config::{opts, pref}; diff --git a/components/constellation/logging.rs b/components/constellation/logging.rs index 672b63d1557..f2ca53d1f44 100644 --- a/components/constellation/logging.rs +++ b/components/constellation/logging.rs @@ -7,10 +7,10 @@ use std::sync::Arc; use std::thread; use backtrace::Backtrace; +use base::id::TopLevelBrowsingContextId; use compositing_traits::ConstellationMsg as FromCompositorMsg; use crossbeam_channel::Sender; use log::{Level, LevelFilter, Log, Metadata, Record}; -use msg::constellation_msg::TopLevelBrowsingContextId; use parking_lot::ReentrantMutex; use script_traits::{LogEntry, ScriptMsg as FromScriptMsg, ScriptToConstellationChan}; diff --git a/components/constellation/network_listener.rs b/components/constellation/network_listener.rs index a3dd8c11027..9ff19b32648 100644 --- a/components/constellation/network_listener.rs +++ b/components/constellation/network_listener.rs @@ -6,12 +6,12 @@ //! Any redirects that are encountered are followed. Whenever a non-redirect //! response is received, it is forwarded to the appropriate script thread. +use base::id::PipelineId; use crossbeam_channel::Sender; use http::HeaderMap; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use log::warn; -use msg::constellation_msg::PipelineId; use net::http_loader::{set_default_accept, set_default_accept_language}; use net_traits::request::{Destination, Referrer, RequestBuilder}; use net_traits::response::ResponseInit; diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index 551c41929ca..000a52768ac 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -8,6 +8,14 @@ use std::rc::Rc; use std::sync::Arc; use background_hang_monitor::HangMonitorRegister; +use background_hang_monitor_api::{ + BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, HangMonitorAlert, +}; +use base::id::{ + BrowsingContextId, HistoryStateId, PipelineId, PipelineNamespace, PipelineNamespaceId, + PipelineNamespaceRequest, TopLevelBrowsingContextId, +}; +use base::Epoch; use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLPipeline; use compositing_traits::{CompositionPipeline, CompositorMsg, CompositorProxy}; @@ -15,17 +23,11 @@ use crossbeam_channel::{unbounded, Sender}; use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg}; use embedder_traits::EventLoopWaker; use gfx::font_cache_thread::FontCacheThread; -use gfx_traits::Epoch; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; use ipc_channel::Error; use log::{debug, error, warn}; use media::WindowGLContext; -use msg::constellation_msg::{ - BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, BrowsingContextId, - HangMonitorAlert, HistoryStateId, PipelineId, PipelineNamespace, PipelineNamespaceId, - PipelineNamespaceRequest, TopLevelBrowsingContextId, -}; use net::image_cache::ImageCacheImpl; use net_traits::image_cache::ImageCache; use net_traits::ResourceThreads; diff --git a/components/constellation/session_history.rs b/components/constellation/session_history.rs index 9e6f765ee15..7bd4ef2c288 100644 --- a/components/constellation/session_history.rs +++ b/components/constellation/session_history.rs @@ -5,11 +5,9 @@ use std::cmp::PartialEq; use std::fmt; +use base::id::{BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId}; use euclid::Size2D; use log::debug; -use msg::constellation_msg::{ - BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId, -}; use script_traits::LoadData; use servo_url::ServoUrl; use style_traits::CSSPixel; diff --git a/components/constellation/webview.rs b/components/constellation/webview.rs index ddd51e31848..31d7937f9e2 100644 --- a/components/constellation/webview.rs +++ b/components/constellation/webview.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; -use msg::constellation_msg::TopLevelBrowsingContextId; +use base::id::TopLevelBrowsingContextId; #[derive(Debug)] pub struct WebViewManager<WebView> { @@ -99,7 +99,7 @@ impl<WebView> WebViewManager<WebView> { mod test { use std::num::NonZeroU32; - use msg::constellation_msg::{ + use base::id::{ BrowsingContextId, BrowsingContextIndex, PipelineNamespace, PipelineNamespaceId, TopLevelBrowsingContextId, WebViewId, }; diff --git a/components/devtools/Cargo.toml b/components/devtools/Cargo.toml index 12dc883e59f..20aaced297f 100644 --- a/components/devtools/Cargo.toml +++ b/components/devtools/Cargo.toml @@ -14,6 +14,7 @@ path = "lib.rs" chrono = "0.4" [dependencies] +base = { workspace = true } chrono = "0.4" crossbeam-channel = { workspace = true } devtools_traits = { workspace = true } @@ -22,7 +23,6 @@ headers = { workspace = true } http = { workspace = true } ipc-channel = { workspace = true } log = { workspace = true } -msg = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } servo_config = { path = "../config" } diff --git a/components/devtools/actors/browsing_context.rs b/components/devtools/actors/browsing_context.rs index af67814d127..0f0dd5a8b1e 100644 --- a/components/devtools/actors/browsing_context.rs +++ b/components/devtools/actors/browsing_context.rs @@ -10,10 +10,10 @@ use std::cell::{Cell, RefCell}; use std::collections::HashMap; use std::net::TcpStream; +use base::id::{BrowsingContextId, PipelineId}; use devtools_traits::DevtoolScriptControlMsg::{self, WantsLiveNotifications}; use devtools_traits::{DevtoolsPageInfo, NavigationState}; use ipc_channel::ipc::IpcSender; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use serde::Serialize; use serde_json::{Map, Value}; diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs index b60e506ba43..2587a501bc8 100644 --- a/components/devtools/actors/console.rs +++ b/components/devtools/actors/console.rs @@ -11,6 +11,7 @@ use std::collections::HashMap; use std::net::TcpStream; use std::time::{SystemTime, UNIX_EPOCH}; +use base::id::TEST_PIPELINE_ID; use devtools_traits::EvaluateJSReply::{ ActorValue, BooleanValue, NullValue, NumberValue, StringValue, VoidValue, }; @@ -20,7 +21,6 @@ use devtools_traits::{ }; use ipc_channel::ipc::{self, IpcSender}; use log::debug; -use msg::constellation_msg::TEST_PIPELINE_ID; use serde::Serialize; use serde_json::{self, Map, Number, Value}; use uuid::Uuid; diff --git a/components/devtools/actors/framerate.rs b/components/devtools/actors/framerate.rs index 5428a5cba67..6a1adaca016 100644 --- a/components/devtools/actors/framerate.rs +++ b/components/devtools/actors/framerate.rs @@ -5,9 +5,9 @@ use std::mem; use std::net::TcpStream; +use base::id::PipelineId; use devtools_traits::DevtoolScriptControlMsg; use ipc_channel::ipc::IpcSender; -use msg::constellation_msg::PipelineId; use serde_json::{Map, Value}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs index eae82683748..586d5c01c63 100644 --- a/components/devtools/actors/inspector.rs +++ b/components/devtools/actors/inspector.rs @@ -7,12 +7,12 @@ use std::cell::RefCell; use std::net::TcpStream; +use base::id::PipelineId; use devtools_traits::DevtoolScriptControlMsg::{ GetChildren, GetDocumentElement, GetLayout, GetRootNode, ModifyAttribute, }; use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg, NodeInfo}; use ipc_channel::ipc::{self, IpcSender}; -use msg::constellation_msg::PipelineId; use serde::Serialize; use serde_json::{self, Map, Value}; diff --git a/components/devtools/actors/timeline.rs b/components/devtools/actors/timeline.rs index 7931f083426..c54f55ee443 100644 --- a/components/devtools/actors/timeline.rs +++ b/components/devtools/actors/timeline.rs @@ -9,10 +9,10 @@ use std::sync::{Arc, Mutex}; use std::thread; use std::time::Duration; +use base::id::PipelineId; use devtools_traits::DevtoolScriptControlMsg::{DropTimelineMarkers, SetTimelineMarkers}; use devtools_traits::{DevtoolScriptControlMsg, PreciseTime, TimelineMarker, TimelineMarkerType}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; -use msg::constellation_msg::PipelineId; use serde::{Serialize, Serializer}; use serde_json::{Map, Value}; diff --git a/components/devtools/actors/worker.rs b/components/devtools/actors/worker.rs index 3daab6d74a1..0c7bbb24ff5 100644 --- a/components/devtools/actors/worker.rs +++ b/components/devtools/actors/worker.rs @@ -6,10 +6,10 @@ use std::cell::RefCell; use std::collections::HashMap; use std::net::TcpStream; +use base::id::TEST_PIPELINE_ID; use devtools_traits::DevtoolScriptControlMsg::WantsLiveNotifications; use devtools_traits::{DevtoolScriptControlMsg, WorkerId}; use ipc_channel::ipc::IpcSender; -use msg::constellation_msg::TEST_PIPELINE_ID; use serde::Serialize; use serde_json::{Map, Value}; use servo_url::ServoUrl; diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 30e37f10fd4..1dbc4cd1b76 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -20,6 +20,7 @@ use std::net::{Shutdown, TcpListener, TcpStream}; use std::sync::{Arc, Mutex}; use std::thread; +use base::id::{BrowsingContextId, PipelineId}; use crossbeam_channel::{unbounded, Receiver, Sender}; use devtools_traits::{ ChromeToDevtoolsControlMsg, ConsoleMessage, DevtoolScriptControlMsg, DevtoolsControlMsg, @@ -29,7 +30,6 @@ use devtools_traits::{ use embedder_traits::{EmbedderMsg, EmbedderProxy, PromptDefinition, PromptOrigin, PromptResult}; use ipc_channel::ipc::{self, IpcSender}; use log::{debug, warn}; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use serde::Serialize; use servo_rand::RngCore; diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index dd4ad758a6e..e9871643431 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -44,6 +44,7 @@ unicode-bidi = { workspace = true, features = ["with_serde"] } unicode-properties = { workspace = true } unicode-script = { workspace = true } webrender_api = { workspace = true } +webrender_traits = { workspace = true } xi-unicode = { workspace = true } [target.'cfg(target_os = "macos")'.dependencies] diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs index aea32225e24..12f72ab309d 100644 --- a/components/gfx/font_cache_thread.rs +++ b/components/gfx/font_cache_thread.rs @@ -10,7 +10,6 @@ use std::{f32, fmt, mem, thread}; use app_units::Au; use atomic_refcell::AtomicRefCell; -use gfx_traits::WebrenderApi; use ipc_channel::ipc::{self, IpcBytesSender, IpcReceiver, IpcSender}; use log::{debug, trace}; use malloc_size_of_derive::MallocSizeOf; @@ -30,6 +29,7 @@ use style::values::computed::font::{FixedPoint, FontStyleFixedPoint}; use style::values::computed::{FontStretch, FontWeight}; use style::values::specified::FontStretch as SpecifiedFontStretch; use webrender_api::{FontInstanceFlags, FontInstanceKey, FontKey}; +use webrender_traits::WebRenderFontApi; use crate::font::{FontDescriptor, FontFamilyDescriptor, FontFamilyName, FontSearchScope}; use crate::font_context::FontSource; @@ -160,7 +160,7 @@ struct FontCache { local_families: HashMap<LowercaseString, FontTemplates>, web_families: HashMap<LowercaseString, FontTemplates>, core_resource_thread: CoreResourceThread, - webrender_api: Box<dyn WebrenderApi>, + webrender_api: Box<dyn WebRenderFontApi>, webrender_fonts: HashMap<FontIdentifier, FontKey>, font_instances: HashMap<(FontKey, Au), FontInstanceKey>, } @@ -577,7 +577,7 @@ impl From<&FontFaceRuleData> for CSSFontFaceDescriptors { impl FontCacheThread { pub fn new( core_resource_thread: CoreResourceThread, - webrender_api: Box<dyn WebrenderApi + Send>, + webrender_api: Box<dyn WebRenderFontApi + Send>, ) -> FontCacheThread { let (chan, port) = ipc::channel().unwrap(); diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index 6df0d11c36f..f63002b5fe3 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -15,6 +15,7 @@ doctest = false [dependencies] app_units = { workspace = true } atomic_refcell = { workspace = true } +base = { workspace = true } bitflags = { workspace = true } canvas_traits = { workspace = true } embedder_traits = { workspace = true } @@ -27,7 +28,7 @@ ipc-channel = { workspace = true } lazy_static = { workspace = true } log = { workspace = true } malloc_size_of = { workspace = true } -msg = { workspace = true } +malloc_size_of_derive = { workspace = true } net_traits = { workspace = true } parking_lot = { workspace = true } profile_traits = { workspace = true } diff --git a/components/layout/block.rs b/components/layout/block.rs index 1aa32668e89..4ecdc44d2d1 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -30,9 +30,9 @@ use std::fmt; use std::sync::Arc; use app_units::{Au, MAX_AU}; +use base::print_tree::PrintTree; use bitflags::bitflags; use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D}; -use gfx_traits::print_tree::PrintTree; use log::{debug, trace}; use serde::{Serialize, Serializer}; use servo_geometry::MaxRect; diff --git a/components/layout/context.rs b/components/layout/context.rs index 5cedf5d38aa..5767717e371 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -9,10 +9,10 @@ use std::hash::BuildHasherDefault; use std::sync::{Arc, Mutex}; use std::thread; +use base::id::PipelineId; use fnv::FnvHasher; use gfx::font_cache_thread::FontCacheThread; use gfx::font_context::FontContext; -use msg::constellation_msg::PipelineId; use net_traits::image_cache::{ ImageCache, ImageCacheResult, ImageOrMetadataAvailable, UsePlaceholder, }; diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index 335a5a66823..0fba6875d2f 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -13,6 +13,7 @@ use std::sync::Arc; use std::{f32, mem}; use app_units::{Au, AU_PER_PX}; +use base::id::{BrowsingContextId, PipelineId}; use bitflags::bitflags; use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg}; use embedder_traits::Cursor; @@ -21,12 +22,11 @@ use euclid::{rect, SideOffsets2D}; use fnv::FnvHashMap; use gfx::text::glyph::ByteIndex; use gfx::text::TextRun; -use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId}; use ipc_channel::ipc; use log::{debug, warn}; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image_cache::UsePlaceholder; use range::Range; +use script_layout_interface::{combine_id_with_fragment_type, FragmentType}; use script_traits::compositor::ScrollSensitivity; use servo_config::opts; use servo_geometry::{self, MaxRect}; @@ -53,6 +53,7 @@ use webrender_api::{ NinePatchBorderSource, NormalBorder, PropertyBinding, StickyOffsetBounds, }; +use super::StackingContextId; use crate::block::BlockFlow; use crate::context::LayoutContext; use crate::display_list::background::{self, get_cyclic}; diff --git a/components/layout/display_list/items.rs b/components/layout/display_list/items.rs index 193a9f6c461..6fe14f03143 100644 --- a/components/layout/display_list/items.rs +++ b/components/layout/display_list/items.rs @@ -16,11 +16,10 @@ use std::cmp::Ordering; use std::collections::HashMap; use std::{f32, fmt}; +use base::id::PipelineId; +use base::print_tree::PrintTree; use embedder_traits::Cursor; use euclid::{SideOffsets2D, Vector2D}; -use gfx_traits::print_tree::PrintTree; -use gfx_traits::{self, StackingContextId}; -use msg::constellation_msg::PipelineId; use net_traits::image::base::Image; use script_traits::compositor::{ScrollSensitivity, ScrollTreeNodeId}; use serde::Serialize; @@ -35,6 +34,8 @@ use webrender_api::{ SpatialId, StickyOffsetBounds, TransformStyle, }; +use super::StackingContextId; + /// The factor that we multiply the blur radius by in order to inflate the boundaries of display /// items that involve a blur. This ensures that the display item boundaries include all the ink. pub static BLUR_INFLATION_FACTOR: i32 = 3; diff --git a/components/layout/display_list/mod.rs b/components/layout/display_list/mod.rs index aa6d3d2f500..ccd7763144f 100644 --- a/components/layout/display_list/mod.rs +++ b/components/layout/display_list/mod.rs @@ -2,6 +2,9 @@ * 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 malloc_size_of_derive::MallocSizeOf; +use serde::{Deserialize, Serialize}; + pub use self::builder::{ BorderPaintingMode, DisplayListBuildState, IndexableText, StackingContextCollectionFlags, StackingContextCollectionState, @@ -15,3 +18,24 @@ pub(crate) mod conversions; mod gradient; pub mod items; mod webrender_helpers; + +/// A unique ID for every stacking context. +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)] +pub struct StackingContextId( + /// The identifier for this StackingContext, derived from the Flow's memory address + /// and fragment type. As a space optimization, these are combined into a single word. + pub u64, +); + +impl StackingContextId { + /// Returns the stacking context ID for the outer document/layout root. + #[inline] + pub fn root() -> StackingContextId { + StackingContextId(0) + } + + pub fn next(&self) -> StackingContextId { + let StackingContextId(id) = *self; + StackingContextId(id + 1) + } +} diff --git a/components/layout/display_list/webrender_helpers.rs b/components/layout/display_list/webrender_helpers.rs index 85c3694b98d..0ac79b4d8ca 100644 --- a/components/layout/display_list/webrender_helpers.rs +++ b/components/layout/display_list/webrender_helpers.rs @@ -7,9 +7,9 @@ // This might be achieved by sharing types between WR and Servo display lists, or // completely converting layout to directly generate WebRender display lists, for example. -use gfx_traits::WebRenderEpochToU16; +use base::id::PipelineId; +use base::WebRenderEpochToU16; use log::trace; -use msg::constellation_msg::PipelineId; use script_traits::compositor::{ CompositorDisplayListInfo, ScrollSensitivity, ScrollTreeNodeId, ScrollableNodeInfo, }; diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 29152507c12..8cdaa6d521d 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -31,10 +31,9 @@ use std::sync::atomic::Ordering; use std::sync::Arc; use app_units::Au; +use base::print_tree::PrintTree; use bitflags::bitflags; use euclid::default::{Point2D, Rect, Size2D, Vector2D}; -use gfx_traits::print_tree::PrintTree; -use gfx_traits::StackingContextId; use log::debug; use serde::ser::{SerializeStruct, Serializer}; use serde::Serialize; @@ -54,7 +53,9 @@ use webrender_api::units::LayoutTransform; use crate::block::{BlockFlow, FormattingContextType}; use crate::context::LayoutContext; use crate::display_list::items::ClippingAndScrolling; -use crate::display_list::{DisplayListBuildState, StackingContextCollectionState}; +use crate::display_list::{ + DisplayListBuildState, StackingContextCollectionState, StackingContextId, +}; use crate::flex::FlexFlow; use crate::floats::{Floats, SpeculatedFloatPlacement}; use crate::flow_list::{FlowList, FlowListIterator, MutFlowListIterator}; diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 45843627493..171c529babc 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -11,16 +11,15 @@ use std::sync::{Arc, Mutex}; use std::{f32, fmt}; use app_units::Au; +use base::id::{BrowsingContextId, PipelineId}; use bitflags::bitflags; use canvas_traits::canvas::{CanvasId, CanvasMsg}; use euclid::default::{Point2D, Rect, Size2D, Vector2D}; use gfx::text::glyph::ByteIndex; use gfx::text::text_run::{TextRun, TextRunSlice}; -use gfx_traits::StackingContextId; use html5ever::{local_name, namespace_url, ns}; use ipc_channel::ipc::IpcSender; use log::debug; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder}; use range::*; @@ -59,7 +58,7 @@ use webrender_api::{self, ImageKey}; use crate::context::LayoutContext; use crate::display_list::items::{ClipScrollNodeIndex, OpaqueNode, BLUR_INFLATION_FACTOR}; -use crate::display_list::ToLayout; +use crate::display_list::{StackingContextId, ToLayout}; use crate::floats::ClearType; use crate::flow::{GetBaseFlow, ImmutableFlowUtils}; use crate::flow_ref::FlowRef; diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 5926e4b2e03..fa56f83979f 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -8,10 +8,10 @@ use std::sync::Arc; use std::{fmt, i32, isize, mem}; use app_units::{Au, MIN_AU}; +use base::print_tree::PrintTree; use bitflags::bitflags; use euclid::default::{Point2D, Rect, Size2D}; use gfx::font::FontMetrics; -use gfx_traits::print_tree::PrintTree; use log::debug; use range::{int_range_index, Range, RangeIndex}; use script_layout_interface::wrapper_traits::PseudoElementType; diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 9e12a991772..ed82b41fe1c 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -9,8 +9,8 @@ use std::fmt; use std::sync::Arc; use app_units::Au; +use base::print_tree::PrintTree; use euclid::default::{Point2D, Vector2D}; -use gfx_traits::print_tree::PrintTree; use log::{debug, trace}; use style::logical_geometry::LogicalSize; use style::properties::ComputedValues; diff --git a/components/layout/table.rs b/components/layout/table.rs index 1821769bc79..55f19c05867 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -7,8 +7,8 @@ use std::{cmp, fmt}; use app_units::Au; +use base::print_tree::PrintTree; use euclid::default::Point2D; -use gfx_traits::print_tree::PrintTree; use log::{debug, trace}; use serde::Serialize; use style::computed_values::{border_collapse, border_spacing, table_layout}; diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs index 398a43a7dbf..719d9a2309d 100644 --- a/components/layout/table_caption.rs +++ b/components/layout/table_caption.rs @@ -7,8 +7,8 @@ use std::fmt; use app_units::Au; +use base::print_tree::PrintTree; use euclid::default::Point2D; -use gfx_traits::print_tree::PrintTree; use log::{debug, trace}; use style::logical_geometry::LogicalSize; use style::properties::ComputedValues; diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index 013702e9401..a70ea183931 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -7,8 +7,8 @@ use std::fmt; use app_units::Au; +use base::print_tree::PrintTree; use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D}; -use gfx_traits::print_tree::PrintTree; use log::{debug, trace}; use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode; use serde::Serialize; diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 764386d9033..21aee72bba5 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -9,8 +9,8 @@ use std::fmt; use std::iter::{Enumerate, Peekable}; use app_units::Au; +use base::print_tree::PrintTree; use euclid::default::Point2D; -use gfx_traits::print_tree::PrintTree; use log::{debug, warn}; use serde::{Serialize, Serializer}; use style::computed_values::border_collapse::T as BorderCollapse; diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index 345bba4a588..4a21856b9f8 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -8,8 +8,8 @@ use std::fmt; use std::iter::{Iterator, Peekable}; use app_units::Au; +use base::print_tree::PrintTree; use euclid::default::Point2D; -use gfx_traits::print_tree::PrintTree; use log::{debug, trace}; use serde::{Serialize, Serializer}; use style::computed_values::{border_collapse, border_spacing}; diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 25832386566..3d5bc557561 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -16,8 +16,8 @@ use std::fmt; use std::ops::Add; use app_units::Au; +use base::print_tree::PrintTree; use euclid::default::Point2D; -use gfx_traits::print_tree::PrintTree; use log::{debug, trace}; use serde::Serialize; use style::computed_values::{position, table_layout}; diff --git a/components/layout_2020/Cargo.toml b/components/layout_2020/Cargo.toml index 5ed04e7b908..99446a0f59c 100644 --- a/components/layout_2020/Cargo.toml +++ b/components/layout_2020/Cargo.toml @@ -15,6 +15,7 @@ doctest = false [dependencies] app_units = { workspace = true } atomic_refcell = { workspace = true } +base = { workspace = true } canvas_traits = { workspace = true } bitflags = { workspace = true } cssparser = { workspace = true } @@ -27,7 +28,6 @@ gfx_traits = { workspace = true } html5ever = { workspace = true } ipc-channel = { workspace = true } log = { workspace = true } -msg = { workspace = true } net_traits = { workspace = true } parking_lot = { workspace = true } range = { path = "../range" } diff --git a/components/layout_2020/context.rs b/components/layout_2020/context.rs index 500f16093b1..145f2d6591e 100644 --- a/components/layout_2020/context.rs +++ b/components/layout_2020/context.rs @@ -4,10 +4,10 @@ use std::sync::{Arc, Mutex}; +use base::id::PipelineId; use fnv::FnvHashMap; use gfx::font_cache_thread::FontCacheThread; use gfx::font_context::FontContext; -use msg::constellation_msg::PipelineId; use net_traits::image_cache::{ ImageCache, ImageCacheResult, ImageOrMetadataAvailable, UsePlaceholder, }; diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs index bfa8e9c266f..d4be0e26b71 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/components/layout_2020/display_list/mod.rs @@ -5,12 +5,12 @@ use std::cell::{OnceCell, RefCell}; use std::sync::Arc; +use base::id::BrowsingContextId; +use base::WebRenderEpochToU16; use embedder_traits::Cursor; use euclid::{Point2D, SideOffsets2D, Size2D}; use fnv::FnvHashMap; use gfx::text::glyph::GlyphStore; -use gfx_traits::WebRenderEpochToU16; -use msg::constellation_msg::BrowsingContextId; use net_traits::image_cache::UsePlaceholder; use script_traits::compositor::{CompositorDisplayListInfo, ScrollSensitivity, ScrollTreeNodeId}; use servo_geometry::MaxRect; diff --git a/components/layout_2020/display_list/stacking_context.rs b/components/layout_2020/display_list/stacking_context.rs index 407d2fb4adc..0b37949b1b8 100644 --- a/components/layout_2020/display_list/stacking_context.rs +++ b/components/layout_2020/display_list/stacking_context.rs @@ -5,9 +5,9 @@ use std::cell::RefCell; use std::mem; +use base::print_tree::PrintTree; use euclid::default::Rect; use euclid::SideOffsets2D; -use gfx_traits::print_tree::PrintTree; use log::warn; use script_traits::compositor::{ScrollSensitivity, ScrollTreeNodeId, ScrollableNodeInfo}; use servo_arc::Arc as ServoArc; diff --git a/components/layout_2020/dom.rs b/components/layout_2020/dom.rs index 5d75317f75d..24d4647e0a5 100644 --- a/components/layout_2020/dom.rs +++ b/components/layout_2020/dom.rs @@ -6,8 +6,8 @@ use std::marker::PhantomData; use std::sync::{Arc, Mutex}; use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut}; +use base::id::{BrowsingContextId, PipelineId}; use html5ever::{local_name, namespace_url, ns}; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::Image as NetImage; use script_layout_interface::wrapper_traits::{ LayoutDataTrait, LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode, diff --git a/components/layout_2020/fragment_tree/base_fragment.rs b/components/layout_2020/fragment_tree/base_fragment.rs index 3acee7a7cfe..3dbb530a4c6 100644 --- a/components/layout_2020/fragment_tree/base_fragment.rs +++ b/components/layout_2020/fragment_tree/base_fragment.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use bitflags::bitflags; -use gfx_traits::{combine_id_with_fragment_type, FragmentType}; +use script_layout_interface::{combine_id_with_fragment_type, FragmentType}; use serde::Serialize; use style::dom::OpaqueNode; use style::selector_parser::PseudoElement; diff --git a/components/layout_2020/fragment_tree/box_fragment.rs b/components/layout_2020/fragment_tree/box_fragment.rs index ab75a2a6b6f..b44b2bc14b1 100644 --- a/components/layout_2020/fragment_tree/box_fragment.rs +++ b/components/layout_2020/fragment_tree/box_fragment.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use app_units::Au; -use gfx_traits::print_tree::PrintTree; +use base::print_tree::PrintTree; use serde::Serialize; use servo_arc::Arc as ServoArc; use style::computed_values::overflow_x::T as ComputedOverflow; diff --git a/components/layout_2020/fragment_tree/fragment.rs b/components/layout_2020/fragment_tree/fragment.rs index 2aaf4775499..a5dc9b0433c 100644 --- a/components/layout_2020/fragment_tree/fragment.rs +++ b/components/layout_2020/fragment_tree/fragment.rs @@ -5,10 +5,10 @@ use std::sync::Arc; use app_units::Au; +use base::id::{BrowsingContextId, PipelineId}; +use base::print_tree::PrintTree; use gfx::font::FontMetrics; use gfx::text::glyph::GlyphStore; -use gfx_traits::print_tree::PrintTree; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use serde::Serialize; use servo_arc::Arc as ServoArc; use style::properties::ComputedValues; diff --git a/components/layout_2020/fragment_tree/fragment_tree.rs b/components/layout_2020/fragment_tree/fragment_tree.rs index 6ea98204fb4..77d07a65847 100644 --- a/components/layout_2020/fragment_tree/fragment_tree.rs +++ b/components/layout_2020/fragment_tree/fragment_tree.rs @@ -3,9 +3,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use app_units::Au; +use base::print_tree::PrintTree; use euclid::default::{Point2D, Rect, Size2D}; use fxhash::FxHashSet; -use gfx_traits::print_tree::PrintTree; use script_traits::compositor::ScrollSensitivity; use serde::Serialize; use style::animation::AnimationSetKey; diff --git a/components/layout_2020/fragment_tree/positioning_fragment.rs b/components/layout_2020/fragment_tree/positioning_fragment.rs index 2865e58121e..7da428bf064 100644 --- a/components/layout_2020/fragment_tree/positioning_fragment.rs +++ b/components/layout_2020/fragment_tree/positioning_fragment.rs @@ -2,7 +2,7 @@ * 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 gfx_traits::print_tree::PrintTree; +use base::print_tree::PrintTree; use serde::Serialize; use servo_arc::Arc as ServoArc; use style::logical_geometry::WritingMode; diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs index 7f3f7743c1c..ac3f1621d85 100644 --- a/components/layout_2020/replaced.rs +++ b/components/layout_2020/replaced.rs @@ -6,10 +6,10 @@ use std::fmt; use std::sync::{Arc, Mutex}; use app_units::Au; +use base::id::{BrowsingContextId, PipelineId}; use canvas_traits::canvas::{CanvasId, CanvasMsg, FromLayoutMsg}; use data_url::DataUrl; use ipc_channel::ipc::{self, IpcSender}; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::Image; use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder}; use serde::Serialize; diff --git a/components/layout_thread/Cargo.toml b/components/layout_thread/Cargo.toml index 97fc689dd2d..978b597212b 100644 --- a/components/layout_thread/Cargo.toml +++ b/components/layout_thread/Cargo.toml @@ -12,6 +12,7 @@ path = "lib.rs" [dependencies] app_units = { workspace = true } +base = { workspace = true } crossbeam-channel = { workspace = true } embedder_traits = { workspace = true } euclid = { workspace = true } @@ -26,7 +27,6 @@ lazy_static = { workspace = true } log = { workspace = true } malloc_size_of = { workspace = true } metrics = { path = "../metrics" } -msg = { workspace = true } net_traits = { workspace = true } parking_lot = { workspace = true } profile_traits = { workspace = true } diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index c56d0ee1bd8..e279f10221d 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -17,6 +17,8 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, Mutex}; use app_units::Au; +use base::id::{BrowsingContextId, PipelineId}; +use base::Epoch; use embedder_traits::resources::{self, Resource}; use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect, Size2D as UntypedSize2D}; use euclid::{Point2D, Rect, Scale, Size2D}; @@ -25,7 +27,6 @@ use fxhash::{FxHashMap, FxHashSet}; use gfx::font; use gfx::font_cache_thread::FontCacheThread; use gfx::font_context::FontContext; -use gfx_traits::{node_id_from_scroll_id, Epoch}; use histogram::Histogram; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; @@ -52,7 +53,6 @@ use lazy_static::lazy_static; use log::{debug, error, trace, warn}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use metrics::{PaintTimeMetrics, ProfilerMetadataFactory}; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image_cache::{ImageCache, UsePlaceholder}; use parking_lot::RwLock; use profile_traits::mem::{Report, ReportKind}; @@ -63,8 +63,8 @@ use profile_traits::time::{ use script::layout_dom::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode}; use script_layout_interface::wrapper_traits::LayoutNode; use script_layout_interface::{ - Layout, LayoutConfig, LayoutFactory, NodesFromPointQueryType, OffsetParentResponse, Reflow, - ReflowComplete, ReflowGoal, ScriptReflow, TrustedNodeAddress, + node_id_from_scroll_id, Layout, LayoutConfig, LayoutFactory, NodesFromPointQueryType, + OffsetParentResponse, Reflow, ReflowComplete, ReflowGoal, ScriptReflow, TrustedNodeAddress, }; use script_traits::{ ConstellationControlMsg, DrawAPaintImageResult, IFrameSizeMsg, LayoutControlMsg, diff --git a/components/layout_thread_2020/Cargo.toml b/components/layout_thread_2020/Cargo.toml index c5010281ae8..633b903e509 100644 --- a/components/layout_thread_2020/Cargo.toml +++ b/components/layout_thread_2020/Cargo.toml @@ -12,6 +12,7 @@ path = "lib.rs" [dependencies] app_units = { workspace = true } +base = { workspace = true } crossbeam-channel = { workspace = true } embedder_traits = { workspace = true } euclid = { workspace = true } @@ -25,7 +26,6 @@ lazy_static = { workspace = true } log = { workspace = true } malloc_size_of = { workspace = true } metrics = { path = "../metrics" } -msg = { workspace = true } net_traits = { workspace = true } parking_lot = { workspace = true } profile_traits = { workspace = true } diff --git a/components/layout_thread_2020/lib.rs b/components/layout_thread_2020/lib.rs index a506a21859e..048a5d86216 100644 --- a/components/layout_thread_2020/lib.rs +++ b/components/layout_thread_2020/lib.rs @@ -16,6 +16,8 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, Mutex}; use app_units::Au; +use base::id::{BrowsingContextId, PipelineId}; +use base::Epoch; use embedder_traits::resources::{self, Resource}; use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect, Size2D as UntypedSize2D}; use euclid::{Point2D, Scale, Size2D, Vector2D}; @@ -23,7 +25,6 @@ use fnv::FnvHashMap; use fxhash::FxHashMap; use gfx::font_cache_thread::FontCacheThread; use gfx::font_context::FontContext; -use gfx_traits::{node_id_from_scroll_id, Epoch}; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; use layout::context::LayoutContext; @@ -39,7 +40,6 @@ use lazy_static::lazy_static; use log::{debug, error, warn}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use metrics::{PaintTimeMetrics, ProfilerMetadataFactory}; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image_cache::{ImageCache, UsePlaceholder}; use parking_lot::RwLock; use profile_traits::mem::{Report, ReportKind}; @@ -49,8 +49,8 @@ use profile_traits::time::{ }; use script::layout_dom::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode}; use script_layout_interface::{ - Layout, LayoutConfig, LayoutFactory, NodesFromPointQueryType, OffsetParentResponse, - ReflowComplete, ReflowGoal, ScriptReflow, TrustedNodeAddress, + node_id_from_scroll_id, Layout, LayoutConfig, LayoutFactory, NodesFromPointQueryType, + OffsetParentResponse, ReflowComplete, ReflowGoal, ScriptReflow, TrustedNodeAddress, }; use script_traits::{ ConstellationControlMsg, DrawAPaintImageResult, IFrameSizeMsg, LayoutControlMsg, diff --git a/components/metrics/Cargo.toml b/components/metrics/Cargo.toml index 08701edf372..888fabc2dd6 100644 --- a/components/metrics/Cargo.toml +++ b/components/metrics/Cargo.toml @@ -11,12 +11,12 @@ name = "metrics" path = "lib.rs" [dependencies] +base = { workspace = true } gfx_traits = { workspace = true } ipc-channel = { workspace = true } log = { workspace = true } malloc_size_of = { workspace = true } malloc_size_of_derive = { workspace = true } -msg = { workspace = true } profile_traits = { workspace = true } script_traits = { workspace = true } servo_config = { path = "../config" } diff --git a/components/metrics/lib.rs b/components/metrics/lib.rs index 7aa42f365ae..3effde8cac0 100644 --- a/components/metrics/lib.rs +++ b/components/metrics/lib.rs @@ -7,11 +7,11 @@ use std::cmp::Ordering; use std::collections::HashMap; use std::time::{Duration, SystemTime, UNIX_EPOCH}; -use gfx_traits::Epoch; +use base::id::PipelineId; +use base::Epoch; use ipc_channel::ipc::IpcSender; use log::warn; use malloc_size_of_derive::MallocSizeOf; -use msg::constellation_msg::PipelineId; use profile_traits::time::{send_profile_data, ProfilerCategory, ProfilerChan, TimerMetadata}; use script_traits::{ConstellationControlMsg, LayoutMsg, ProgressiveWebMetricType}; use servo_config::opts; diff --git a/components/net/Cargo.toml b/components/net/Cargo.toml index 01da269cd0b..bce568c034a 100644 --- a/components/net/Cargo.toml +++ b/components/net/Cargo.toml @@ -16,6 +16,7 @@ doctest = false [dependencies] async-recursion = "0.3.2" async-tungstenite = { workspace = true } +base = { workspace = true } base64 = { workspace = true } brotli = "3" bytes = "1" @@ -42,7 +43,6 @@ malloc_size_of = { workspace = true } malloc_size_of_derive = { workspace = true } mime = { workspace = true } mime_guess = { workspace = true } -msg = { workspace = true } net_traits = { workspace = true } percent-encoding = { workspace = true } pixels = { path = "../pixels" } diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 9332eca67b1..32b309d0f8c 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -9,6 +9,7 @@ use std::sync::{Arc as StdArc, Condvar, Mutex, RwLock}; use std::time::{Duration, SystemTime, UNIX_EPOCH}; use async_recursion::async_recursion; +use base::id::{HistoryStateId, PipelineId}; use crossbeam_channel::Sender; use devtools_traits::{ ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest, @@ -32,7 +33,6 @@ use hyper_serde::Serde; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; use log::{debug, error, info, log_enabled, warn}; -use msg::constellation_msg::{HistoryStateId, PipelineId}; use net_traits::pub_domains::reg_suffix; use net_traits::quality::{quality_to_value, Quality, QualityItem}; use net_traits::request::Origin::Origin as SpecificOrigin; diff --git a/components/net/tests/fetch.rs b/components/net/tests/fetch.rs index 6faf1d362e3..5f04f01cf46 100644 --- a/components/net/tests/fetch.rs +++ b/components/net/tests/fetch.rs @@ -11,6 +11,7 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, Mutex, Weak}; use std::time::{Duration, SystemTime}; +use base::id::TEST_PIPELINE_ID; use crossbeam_channel::{unbounded, Sender}; use devtools_traits::{HttpRequest as DevtoolsHttpRequest, HttpResponse as DevtoolsHttpResponse}; use headers::{ @@ -22,7 +23,6 @@ use http::header::{self, HeaderMap, HeaderName, HeaderValue}; use http::{Method, StatusCode}; use hyper::{Body, Request as HyperRequest, Response as HyperResponse}; use mime::{self, Mime}; -use msg::constellation_msg::TEST_PIPELINE_ID; use net::fetch::cors_cache::CorsCache; use net::fetch::methods::{self, CancellationListener, FetchContext}; use net::filemanager_thread::FileManager; diff --git a/components/net/tests/http_cache.rs b/components/net/tests/http_cache.rs index 4acdc402043..6d7848fad5e 100644 --- a/components/net/tests/http_cache.rs +++ b/components/net/tests/http_cache.rs @@ -2,9 +2,9 @@ * 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 base::id::TEST_PIPELINE_ID; use http::header::{HeaderValue, EXPIRES}; use http::StatusCode; -use msg::constellation_msg::TEST_PIPELINE_ID; use net::http_cache::HttpCache; use net_traits::request::{Origin, Referrer, Request}; use net_traits::response::{HttpsState, Response, ResponseBody}; diff --git a/components/net/tests/http_loader.rs b/components/net/tests/http_loader.rs index 324b75daa7f..1db85d44ecc 100644 --- a/components/net/tests/http_loader.rs +++ b/components/net/tests/http_loader.rs @@ -11,6 +11,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex, RwLock}; use std::time::Duration; +use base::id::TEST_PIPELINE_ID; use cookie_rs::Cookie as CookiePair; use crossbeam_channel::{unbounded, Receiver}; use devtools_traits::{ @@ -29,7 +30,6 @@ use http::{Method, StatusCode}; use hyper::{Body, Request as HyperRequest, Response as HyperResponse}; use ipc_channel::ipc; use ipc_channel::router::ROUTER; -use msg::constellation_msg::TEST_PIPELINE_ID; use net::cookie::Cookie; use net::cookie_storage::CookieStorage; use net::http_loader::determine_requests_referrer; diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 1fc2f1a69cc..45926d07f40 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -31,7 +31,9 @@ accountable-refcell = { workspace = true, optional = true } app_units = { workspace = true } arrayvec = { workspace = true } atomic_refcell = { workspace = true } +background_hang_monitor_api = { workspace = true } backtrace = { workspace = true } +base = { workspace = true } base64 = { workspace = true } bitflags = { workspace = true } bluetooth_traits = { workspace = true } @@ -74,7 +76,6 @@ media = { path = "../media" } metrics = { path = "../metrics" } mime = { workspace = true } mime_guess = { workspace = true } -msg = { workspace = true } net_traits = { workspace = true } num_cpus = { workspace = true } num-traits = { workspace = true } diff --git a/components/script/animations.rs b/components/script/animations.rs index 4edb20a92a8..45e88734e75 100644 --- a/components/script/animations.rs +++ b/components/script/animations.rs @@ -6,10 +6,10 @@ use std::cell::Cell; +use base::id::PipelineId; use cssparser::ToCss; use fxhash::{FxHashMap, FxHashSet}; use libc::c_void; -use msg::constellation_msg::PipelineId; use script_traits::{AnimationState as AnimationsPresentState, ScriptMsg, UntrustedNodeAddress}; use serde::{Deserialize, Serialize}; use style::animation::{ diff --git a/components/script/devtools.rs b/components/script/devtools.rs index d83e9fecdc6..1bb34ecdb7c 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -5,6 +5,7 @@ use std::rc::Rc; use std::str; +use base::id::PipelineId; use devtools_traits::{ AutoMargins, ComputedNodeLayout, EvaluateJSReply, Modification, NodeInfo, TimelineMarker, TimelineMarkerType, @@ -12,7 +13,6 @@ use devtools_traits::{ use ipc_channel::ipc::IpcSender; use js::jsval::UndefinedValue; use js::rust::ToString; -use msg::constellation_msg::PipelineId; use uuid::Uuid; use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods; diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index a82ff1e93a3..e3be006aced 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -4,9 +4,9 @@ use std::rc::Rc; +use base::id::PipelineId; use dom_struct::dom_struct; use js::rust::HandleObject; -use msg::constellation_msg::PipelineId; use servo_media::audio::context::{LatencyCategory, ProcessingState, RealTimeAudioContextOptions}; use crate::dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions}; diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index e47e2e02b95..e68534c5f76 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -8,10 +8,10 @@ use std::collections::{HashMap, VecDeque}; use std::rc::Rc; use std::sync::{Arc, Mutex}; +use base::id::PipelineId; use dom_struct::dom_struct; use js::rust::CustomAutoRooterGuard; use js::typedarray::ArrayBuffer; -use msg::constellation_msg::PipelineId; use servo_media::audio::context::{ AudioContext, AudioContextOptions, OfflineAudioContextOptions, ProcessingState, RealTimeAudioContextOptions, diff --git a/components/script/dom/bindings/structuredclone.rs b/components/script/dom/bindings/structuredclone.rs index 209a499ee59..d63299a5bab 100644 --- a/components/script/dom/bindings/structuredclone.rs +++ b/components/script/dom/bindings/structuredclone.rs @@ -8,6 +8,7 @@ use std::collections::HashMap; use std::os::raw; use std::ptr; +use base::id::{BlobId, MessagePortId}; use js::glue::{ CopyJSStructuredCloneData, DeleteJSAutoStructuredCloneBuffer, GetLengthOfJSStructuredCloneData, NewJSAutoStructuredCloneBuffer, WriteBytesToJSStructuredCloneData, @@ -22,7 +23,6 @@ use js::jsapi::{ use js::jsval::UndefinedValue; use js::rust::wrappers::{JS_ReadStructuredClone, JS_WriteStructuredClone}; use js::rust::{CustomAutoRooterGuard, HandleValue, MutableHandleValue}; -use msg::constellation_msg::{BlobId, MessagePortId}; use script_traits::serializable::BlobImpl; use script_traits::transferable::MessagePortImpl; use script_traits::StructuredSerializedData; diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 7cdb6384ed1..0cc13392f12 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -7,11 +7,11 @@ use std::num::NonZeroU32; use std::ptr::NonNull; use std::rc::Rc; +use base::id::{BlobId, BlobIndex, PipelineNamespaceId}; use dom_struct::dom_struct; use encoding_rs::UTF_8; use js::jsapi::JSObject; use js::rust::HandleObject; -use msg::constellation_msg::{BlobId, BlobIndex, PipelineNamespaceId}; use net_traits::filemanager_thread::RelativePos; use script_traits::serializable::BlobImpl; use uuid::Uuid; diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index b8647c305ce..e340621af71 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -7,6 +7,7 @@ use std::sync::atomic::AtomicBool; use std::sync::Arc; use std::thread::{self, JoinHandle}; +use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use crossbeam_channel::{unbounded, Receiver, Sender}; use devtools_traits::DevtoolScriptControlMsg; use dom_struct::dom_struct; @@ -15,7 +16,6 @@ use ipc_channel::router::ROUTER; use js::jsapi::{Heap, JSContext, JSObject, JS_AddInterruptCallback}; use js::jsval::UndefinedValue; use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue}; -use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use net_traits::image_cache::ImageCache; use net_traits::request::{ CredentialsMode, Destination, ParserMetadata, Referrer, RequestBuilder, RequestMode, diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs index ebe33bad95a..51cad369282 100644 --- a/components/script/dom/dissimilaroriginwindow.rs +++ b/components/script/dom/dissimilaroriginwindow.rs @@ -2,11 +2,11 @@ * 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 base::id::PipelineId; use dom_struct::dom_struct; use js::jsapi::{Heap, JSObject}; use js::jsval::{JSVal, UndefinedValue}; use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue}; -use msg::constellation_msg::PipelineId; use script_traits::{ScriptMsg, StructuredSerializedData}; use servo_url::ServoUrl; diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index dc55761b02f..f58f9472958 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -13,6 +13,7 @@ use std::rc::Rc; use std::slice::from_ref; use std::time::{Duration, Instant}; +use base::id::BrowsingContextId; use canvas_traits::webgl::{self, WebGLContextId, WebGLMsg}; use content_security_policy::{self as csp, CspList}; use cookie::Cookie; @@ -33,7 +34,6 @@ use metrics::{ ProgressiveWebMetric, }; use mime::{self, Mime}; -use msg::constellation_msg::BrowsingContextId; use net_traits::pub_domains::is_pub_domain; use net_traits::request::RequestBuilder; use net_traits::response::HttpsState; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 12dc2af872e..e91a24e2ddf 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -15,6 +15,7 @@ use std::{fmt, mem}; use cssparser::match_ignore_ascii_case; use devtools_traits::AttrInfo; use dom_struct::dom_struct; +use embedder_traits::InputMethodType; use euclid::default::{Rect, Size2D}; use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode}; use html5ever::serialize::{SerializeOpts, TraversalScope}; @@ -25,7 +26,6 @@ use html5ever::{ use js::jsapi::Heap; use js::jsval::JSVal; use js::rust::HandleObject; -use msg::constellation_msg::InputMethodType; use net_traits::request::CorsSettings; use net_traits::ReferrerPolicy; use script_layout_interface::ReflowGoal; diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 32febf8ab8e..7586a58793e 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -14,6 +14,10 @@ use std::thread::JoinHandle; use std::time::Instant; use std::{mem, ptr}; +use base::id::{ + BlobId, BroadcastChannelRouterId, MessagePortId, MessagePortRouterId, PipelineId, + ServiceWorkerId, ServiceWorkerRegistrationId, +}; use content_security_policy::CspList; use crossbeam_channel::Sender; use devtools_traits::{PageError, ScriptToDevtoolsControlMsg}; @@ -34,10 +38,6 @@ use js::rust::{ MutableHandleValue, ParentRuntime, Runtime, }; use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL}; -use msg::constellation_msg::{ - BlobId, BroadcastChannelRouterId, MessagePortId, MessagePortRouterId, PipelineId, - ServiceWorkerId, ServiceWorkerRegistrationId, -}; use net_traits::blob_url_store::{get_blob_origin, BlobBuf}; use net_traits::filemanager_thread::{ FileManagerResult, FileManagerThreadMsg, ReadFileProgress, RelativePos, diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs index 15a02fa64c1..f0be9b8ceac 100644 --- a/components/script/dom/history.rs +++ b/components/script/dom/history.rs @@ -5,15 +5,15 @@ use std::cell::Cell; use std::cmp::Ordering; +use base::id::HistoryStateId; use dom_struct::dom_struct; use js::jsapi::Heap; use js::jsval::{JSVal, NullValue, UndefinedValue}; use js::rust::HandleValue; -use msg::constellation_msg::{HistoryStateId, TraversalDirection}; use net_traits::{CoreResourceMsg, IpcSend}; use profile_traits::ipc; use profile_traits::ipc::channel; -use script_traits::{ScriptMsg, StructuredSerializedData}; +use script_traits::{ScriptMsg, StructuredSerializedData, TraversalDirection}; use servo_url::ServoUrl; use crate::dom::bindings::codegen::Bindings::HistoryBinding::HistoryMethods; diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index cb84aa7bb52..0ccf0fa7661 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -4,11 +4,11 @@ use std::cell::Cell; +use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use bitflags::bitflags; use dom_struct::dom_struct; use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; use js::rust::HandleObject; -use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use profile_traits::ipc as ProfiledIpc; use script_layout_interface::ReflowGoal; use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed}; diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index d2bb0d57408..96d4b1183cd 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -9,6 +9,7 @@ use std::sync::{Arc, Mutex}; use std::{char, i32, mem}; use app_units::{Au, AU_PER_PX}; +use base::id::PipelineId; use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; use euclid::Point2D; @@ -19,7 +20,6 @@ use ipc_channel::router::ROUTER; use js::jsapi::JSAutoRealm; use js::rust::HandleObject; use mime::{self, Mime}; -use msg::constellation_msg::PipelineId; use net_traits::image::base::{Image, ImageMetadata}; use net_traits::image_cache::{ CorsStatus, ImageCache, ImageCacheResult, ImageOrMetadataAvailable, ImageResponse, diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 40315c3ecdf..eec9ae0684a 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -11,7 +11,7 @@ use std::{f64, ptr}; use chrono::naive::{NaiveDate, NaiveDateTime}; use chrono::{DateTime, Datelike, Weekday}; use dom_struct::dom_struct; -use embedder_traits::FilterPattern; +use embedder_traits::{FilterPattern, InputMethodType}; use encoding_rs::Encoding; use html5ever::{local_name, namespace_url, ns, LocalName, Prefix}; use js::jsapi::{ @@ -21,7 +21,6 @@ use js::jsapi::{ use js::jsval::UndefinedValue; use js::rust::jsapi_wrapped::{ExecuteRegExpNoStatics, ObjectIsRegExp}; use js::rust::{HandleObject, MutableHandleObject}; -use msg::constellation_msg::InputMethodType; use net_traits::blob_url_store::get_blob_origin; use net_traits::filemanager_thread::FileManagerThreadMsg; use net_traits::{CoreResourceMsg, IpcSend}; diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index d0a59070cb6..e0563f91bf3 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -12,6 +12,7 @@ use std::ptr; use std::rc::Rc; use std::sync::{Arc, Mutex}; +use base::id::PipelineId; use content_security_policy as csp; use dom_struct::dom_struct; use encoding_rs::Encoding; @@ -24,7 +25,6 @@ use js::rust::{ transform_str_to_source_text, CompileOptionsWrapper, FinishOffThreadStencil, HandleObject, Stencil, }; -use msg::constellation_msg::PipelineId; use net_traits::request::{ CorsSettings, CredentialsMode, Destination, ParserMetadata, RequestBuilder, }; diff --git a/components/script/dom/messageport.rs b/components/script/dom/messageport.rs index 02ecae8e2b1..c7086c9403c 100644 --- a/components/script/dom/messageport.rs +++ b/components/script/dom/messageport.rs @@ -8,10 +8,10 @@ use std::convert::TryInto; use std::num::NonZeroU32; use std::rc::Rc; +use base::id::{MessagePortId, MessagePortIndex, PipelineNamespaceId}; use dom_struct::dom_struct; use js::jsapi::{Heap, JSObject, MutableHandleObject}; use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue}; -use msg::constellation_msg::{MessagePortId, MessagePortIndex, PipelineNamespaceId}; use script_traits::PortMessageTask; use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 19178806944..3531fb1b9f3 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -13,6 +13,7 @@ use std::sync::Arc as StdArc; use std::{cmp, iter}; use app_units::Au; +use base::id::{BrowsingContextId, PipelineId}; use bitflags::bitflags; use devtools_traits::NodeInfo; use dom_struct::dom_struct; @@ -22,7 +23,6 @@ use js::jsapi::JSObject; use js::rust::HandleObject; use libc::{self, c_void, uintptr_t}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; use script_layout_interface::{ GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType, QueryMsg, diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs index fcdffddb449..0d47380ab61 100644 --- a/components/script/dom/offlineaudiocontext.rs +++ b/components/script/dom/offlineaudiocontext.rs @@ -7,9 +7,9 @@ use std::rc::Rc; use std::sync::{mpsc, Arc, Mutex}; use std::thread::Builder; +use base::id::PipelineId; use dom_struct::dom_struct; use js::rust::HandleObject; -use msg::constellation_msg::PipelineId; use servo_media::audio::context::OfflineAudioContextOptions as ServoMediaOfflineAudioContextOptions; use crate::dom::audiobuffer::{AudioBuffer, MAX_SAMPLE_RATE, MIN_SAMPLE_RATE}; diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs index daee955baab..4287b347a83 100644 --- a/components/script/dom/paintworkletglobalscope.rs +++ b/components/script/dom/paintworkletglobalscope.rs @@ -10,6 +10,7 @@ use std::sync::{Arc, Mutex}; use std::thread; use std::time::Duration; +use base::id::PipelineId; use crossbeam_channel::{unbounded, Sender}; use dom_struct::dom_struct; use euclid::{Scale, Size2D}; @@ -20,7 +21,6 @@ use js::jsapi::{ use js::jsval::{JSVal, ObjectValue, UndefinedValue}; use js::rust::wrappers::{Call, Construct1}; use js::rust::{HandleValue, Runtime}; -use msg::constellation_msg::PipelineId; use net_traits::image_cache::ImageCache; use pixels::PixelFormat; use profile_traits::ipc; diff --git a/components/script/dom/serviceworker.rs b/components/script/dom/serviceworker.rs index ee318f9a111..02f7b60f4c0 100644 --- a/components/script/dom/serviceworker.rs +++ b/components/script/dom/serviceworker.rs @@ -4,10 +4,10 @@ use std::cell::Cell; +use base::id::ServiceWorkerId; use dom_struct::dom_struct; use js::jsapi::{Heap, JSObject}; use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue}; -use msg::constellation_msg::ServiceWorkerId; use script_traits::{DOMMessage, ScriptMsg}; use servo_url::ServoUrl; diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs index 8bede70297e..bd2c6dc79d0 100644 --- a/components/script/dom/serviceworkerglobalscope.rs +++ b/components/script/dom/serviceworkerglobalscope.rs @@ -7,6 +7,7 @@ use std::sync::Arc; use std::thread::{self, JoinHandle}; use std::time::{Duration, Instant}; +use base::id::PipelineId; use crossbeam_channel::{after, unbounded, Receiver, Sender}; use devtools_traits::DevtoolScriptControlMsg; use dom_struct::dom_struct; @@ -14,7 +15,6 @@ use ipc_channel::ipc::{IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; use js::jsapi::{JSContext, JS_AddInterruptCallback}; use js::jsval::UndefinedValue; -use msg::constellation_msg::PipelineId; use net_traits::request::{CredentialsMode, Destination, ParserMetadata, Referrer, RequestBuilder}; use net_traits::{CustomResponseMediator, IpcSend}; use parking_lot::Mutex; diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs index 481ff3aa965..c1eb63fa648 100644 --- a/components/script/dom/serviceworkerregistration.rs +++ b/components/script/dom/serviceworkerregistration.rs @@ -4,9 +4,9 @@ use std::cell::Cell; +use base::id::ServiceWorkerRegistrationId; use devtools_traits::WorkerId; use dom_struct::dom_struct; -use msg::constellation_msg::ServiceWorkerRegistrationId; use script_traits::{ScopeThings, WorkerScriptLoadOrigin}; use servo_url::ServoUrl; use uuid::Uuid; diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 507e2a2cb99..138aa8d4546 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -6,6 +6,7 @@ use std::borrow::Cow; use std::cell::Cell; use std::mem; +use base::id::PipelineId; use base64::engine::general_purpose; use base64::Engine as _; use content_security_policy::{self as csp, CspList}; @@ -20,7 +21,6 @@ use html5ever::tree_builder::{ElementFlags, NextParserState, NodeOrText, QuirksM use html5ever::{local_name, namespace_url, ns, Attribute, ExpandedName, LocalName, QualName}; use hyper_serde::Serde; use mime::{self, Mime}; -use msg::constellation_msg::PipelineId; use net_traits::{ FetchMetadata, FetchResponseListener, Metadata, NetworkError, ResourceFetchTiming, ResourceTimingType, diff --git a/components/script/dom/servoparser/prefetch.rs b/components/script/dom/servoparser/prefetch.rs index d11da362149..1f57ccc0a94 100644 --- a/components/script/dom/servoparser/prefetch.rs +++ b/components/script/dom/servoparser/prefetch.rs @@ -2,6 +2,7 @@ * 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 base::id::PipelineId; use html5ever::buffer_queue::BufferQueue; use html5ever::tokenizer::states::RawKind; use html5ever::tokenizer::{ @@ -9,7 +10,6 @@ use html5ever::tokenizer::{ }; use html5ever::{local_name, Attribute, LocalName}; use js::jsapi::JSTracer; -use msg::constellation_msg::PipelineId; use net_traits::request::{CorsSettings, CredentialsMode, ParserMetadata, Referrer}; use net_traits::{CoreResourceMsg, FetchChannels, IpcSend, ReferrerPolicy, ResourceThreads}; use servo_url::{ImmutableOrigin, ServoUrl}; diff --git a/components/script/dom/testworkletglobalscope.rs b/components/script/dom/testworkletglobalscope.rs index 71c20ad9966..2540bc31415 100644 --- a/components/script/dom/testworkletglobalscope.rs +++ b/components/script/dom/testworkletglobalscope.rs @@ -4,10 +4,10 @@ use std::collections::HashMap; +use base::id::PipelineId; use crossbeam_channel::Sender; use dom_struct::dom_struct; use js::rust::Runtime; -use msg::constellation_msg::PipelineId; use servo_url::ServoUrl; use crate::dom::bindings::cell::DomRefCell; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index ae50518c2c8..b034c9c5d29 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -16,6 +16,7 @@ use std::{cmp, env, mem}; use app_units::Au; use backtrace::Backtrace; +use base::id::{BrowsingContextId, PipelineId}; use base64::Engine; use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLChan; @@ -26,7 +27,6 @@ use dom_struct::dom_struct; use embedder_traits::{EmbedderMsg, PromptDefinition, PromptOrigin, PromptResult}; use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect}; use euclid::{Point2D, Rect, Scale, Size2D, Vector2D}; -use gfx_traits::combine_id_with_fragment_type; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; use js::conversions::ToJSValConvertible; @@ -38,7 +38,6 @@ use js::rust::{ }; use malloc_size_of::MallocSizeOf; use media::WindowGLContext; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image_cache::{ ImageCache, ImageResponder, ImageResponse, PendingImageId, PendingImageResponse, }; @@ -50,7 +49,8 @@ use profile_traits::ipc as ProfiledIpc; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; use script_layout_interface::{ - Layout, PendingImageState, QueryMsg, Reflow, ReflowGoal, ScriptReflow, TrustedNodeAddress, + combine_id_with_fragment_type, FragmentType, Layout, PendingImageState, QueryMsg, Reflow, + ReflowGoal, ScriptReflow, TrustedNodeAddress, }; use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use script_traits::{ @@ -2110,10 +2110,7 @@ impl Window { .borrow_mut() .insert(node.to_opaque(), Vector2D::new(x_ as f32, y_ as f32)); let scroll_id = ExternalScrollId( - combine_id_with_fragment_type( - node.to_opaque().id(), - gfx_traits::FragmentType::FragmentBody, - ), + combine_id_with_fragment_type(node.to_opaque().id(), FragmentType::FragmentBody), self.pipeline_id().into(), ); diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index 24a7afe7672..92ecd52968d 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -5,6 +5,7 @@ use std::cell::Cell; use std::ptr; +use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; use html5ever::local_name; @@ -27,7 +28,6 @@ use js::jsval::{JSVal, NullValue, PrivateValue, UndefinedValue}; use js::rust::wrappers::{JS_TransplantObject, NewWindowProxy, SetWindowProxy}; use js::rust::{get_object_class, Handle, MutableHandle}; use js::JSCLASS_IS_GLOBAL; -use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use net_traits::request::Referrer; use script_traits::{ AuxiliaryBrowsingContextLoadInfo, HistoryEntryReplacement, LoadData, LoadOrigin, NewLayoutInfo, diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 7c10b459c93..61c5a4a59a7 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -7,6 +7,7 @@ use std::rc::Rc; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use base::id::{PipelineId, PipelineNamespace}; use crossbeam_channel::Receiver; use devtools_traits::{DevtoolScriptControlMsg, WorkerId}; use dom_struct::dom_struct; @@ -14,7 +15,6 @@ use ipc_channel::ipc::IpcSender; use js::jsval::UndefinedValue; use js::panic::maybe_resume_unwind; use js::rust::{HandleValue, ParentRuntime}; -use msg::constellation_msg::{PipelineId, PipelineNamespace}; use net_traits::request::{ CredentialsMode, Destination, ParserMetadata, RequestBuilder as NetRequestInit, }; diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs index 318e4fc533b..697bba659e7 100644 --- a/components/script/dom/worklet.rs +++ b/components/script/dom/worklet.rs @@ -18,11 +18,11 @@ use std::sync::atomic::{AtomicIsize, Ordering}; use std::sync::Arc; use std::thread; +use base::id::PipelineId; use crossbeam_channel::{unbounded, Receiver, Sender}; use dom_struct::dom_struct; use js::jsapi::{GCReason, JSGCParamKey, JSTracer, JS_GetGCParameter, JS_GC}; use malloc_size_of::malloc_size_of_is_0; -use msg::constellation_msg::PipelineId; use net_traits::request::{Destination, RequestBuilder, RequestMode}; use net_traits::IpcSend; use servo_url::{ImmutableOrigin, ServoUrl}; diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs index f364926f71c..6357a896942 100644 --- a/components/script/dom/workletglobalscope.rs +++ b/components/script/dom/workletglobalscope.rs @@ -5,13 +5,13 @@ use std::borrow::Cow; use std::sync::Arc; +use base::id::PipelineId; use crossbeam_channel::Sender; use devtools_traits::ScriptToDevtoolsControlMsg; use dom_struct::dom_struct; use ipc_channel::ipc::IpcSender; use js::jsval::UndefinedValue; use js::rust::Runtime; -use msg::constellation_msg::PipelineId; use net_traits::image_cache::ImageCache; use net_traits::ResourceThreads; use parking_lot::Mutex; diff --git a/components/script/dom/xrsystem.rs b/components/script/dom/xrsystem.rs index e7118d3544a..fdeb931b1d7 100644 --- a/components/script/dom/xrsystem.rs +++ b/components/script/dom/xrsystem.rs @@ -5,10 +5,10 @@ use std::cell::Cell; use std::rc::Rc; +use base::id::PipelineId; use dom_struct::dom_struct; use ipc_channel::ipc::{self as ipc_crate, IpcReceiver}; use ipc_channel::router::ROUTER; -use msg::constellation_msg::PipelineId; use profile_traits::ipc; use servo_config::pref; use webxr_api::{Error as XRError, Frame, Session, SessionInit, SessionMode}; diff --git a/components/script/layout_dom/node.rs b/components/script/layout_dom/node.rs index 0cbdba64573..7a521d36220 100644 --- a/components/script/layout_dom/node.rs +++ b/components/script/layout_dom/node.rs @@ -8,9 +8,9 @@ use std::borrow::Cow; use std::fmt; use std::sync::Arc as StdArc; +use base::id::{BrowsingContextId, PipelineId}; use gfx_traits::ByteIndex; use html5ever::{local_name, namespace_url, ns}; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; use range::Range; use script_layout_interface::wrapper_traits::{ diff --git a/components/script/microtask.rs b/components/script/microtask.rs index 904925fc9db..820afcc5f97 100644 --- a/components/script/microtask.rs +++ b/components/script/microtask.rs @@ -10,8 +10,8 @@ use std::cell::Cell; use std::mem; use std::rc::Rc; +use base::id::PipelineId; use js::jsapi::{JSAutoRealm, JobQueueIsEmpty, JobQueueMayNotBeEmpty}; -use msg::constellation_msg::PipelineId; use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::cell::DomRefCell; diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index 9aac9fb9baa..f635bd0b1a7 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -18,6 +18,7 @@ use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant}; use std::{fmt, os, ptr, thread}; +use base::id::PipelineId; use js::glue::{ CollectServoSizes, CreateJobQueue, DeleteJobQueue, DispatchableRun, JobQueueTraps, RUST_js_GetErrorMessage, SetBuildId, StreamConsumerConsumeChunk, @@ -45,7 +46,6 @@ use js::rust::{ }; use lazy_static::lazy_static; use malloc_size_of::MallocSizeOfOps; -use msg::constellation_msg::PipelineId; use profile_traits::mem::{Report, ReportKind, ReportsChan}; use profile_traits::path; use servo_config::{opts, pref}; diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 1259d7f703e..7231dfc54dd 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -29,6 +29,13 @@ use std::sync::Arc; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; use std::{ptr, thread}; +use background_hang_monitor_api::{ + BackgroundHangMonitor, BackgroundHangMonitorExitSignal, HangAnnotation, MonitoredComponentId, + MonitoredComponentType, ScriptHangAnnotation, +}; +use base::id::{ + BrowsingContextId, HistoryStateId, PipelineId, PipelineNamespace, TopLevelBrowsingContextId, +}; use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLPipeline; use chrono::{DateTime, Local}; @@ -55,11 +62,6 @@ use js::rust::ParentRuntime; use media::WindowGLContext; use metrics::{PaintTimeMetrics, MAX_TASK_NS}; use mime::{self, Mime}; -use msg::constellation_msg::{ - BackgroundHangMonitor, BackgroundHangMonitorExitSignal, BrowsingContextId, HangAnnotation, - HistoryStateId, MonitoredComponentId, MonitoredComponentType, PipelineId, PipelineNamespace, - ScriptHangAnnotation, TopLevelBrowsingContextId, -}; use net_traits::image_cache::{ImageCache, PendingImageResponse}; use net_traits::request::{CredentialsMode, Destination, RedirectMode, RequestBuilder}; use net_traits::storage_thread::StorageType; diff --git a/components/script/serviceworker_manager.rs b/components/script/serviceworker_manager.rs index c16c5597b90..8059e4ee41b 100644 --- a/components/script/serviceworker_manager.rs +++ b/components/script/serviceworker_manager.rs @@ -12,10 +12,10 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread::{self, JoinHandle}; +use base::id::{PipelineNamespace, ServiceWorkerId, ServiceWorkerRegistrationId}; use crossbeam_channel::{select, unbounded, Receiver, RecvError, Sender}; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; -use msg::constellation_msg::{PipelineNamespace, ServiceWorkerId, ServiceWorkerRegistrationId}; use net_traits::{CoreResourceMsg, CustomResponseMediator}; use script_traits::{ DOMMessage, Job, JobError, JobResult, JobResultValue, JobType, SWManagerMsg, SWManagerSenders, diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index d9c2d789119..90aeb8754f1 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -5,12 +5,12 @@ use std::sync::atomic::AtomicBool; use std::sync::Mutex; +use base::id::PipelineId; use cssparser::SourceLocation; use encoding_rs::UTF_8; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use mime::{self, Mime}; -use msg::constellation_msg::PipelineId; use net_traits::request::{CorsSettings, Destination, Referrer, RequestBuilder}; use net_traits::{ FetchMetadata, FetchResponseListener, FilteredMetadata, Metadata, NetworkError, ReferrerPolicy, diff --git a/components/script/task_queue.rs b/components/script/task_queue.rs index 0a84feae7b8..96fc49c81af 100644 --- a/components/script/task_queue.rs +++ b/components/script/task_queue.rs @@ -8,8 +8,8 @@ use std::cell::Cell; use std::collections::{HashMap, HashSet, VecDeque}; use std::default::Default; +use base::id::PipelineId; use crossbeam_channel::{self, Receiver, Sender}; -use msg::constellation_msg::PipelineId; use crate::dom::bindings::cell::DomRefCell; use crate::dom::worker::TrustedWorkerAddress; diff --git a/components/script/task_source/dom_manipulation.rs b/components/script/task_source/dom_manipulation.rs index eaff254a5cf..1469db66155 100644 --- a/components/script/task_source/dom_manipulation.rs +++ b/components/script/task_source/dom_manipulation.rs @@ -5,7 +5,7 @@ use std::fmt; use std::result::Result; -use msg::constellation_msg::PipelineId; +use base::id::PipelineId; use servo_atoms::Atom; use crate::dom::bindings::inheritance::Castable; diff --git a/components/script/task_source/file_reading.rs b/components/script/task_source/file_reading.rs index 77e566dbf63..afb1f5c104a 100644 --- a/components/script/task_source/file_reading.rs +++ b/components/script/task_source/file_reading.rs @@ -2,7 +2,7 @@ * 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 msg::constellation_msg::PipelineId; +use base::id::PipelineId; use crate::dom::domexception::DOMErrorName; use crate::dom::filereader::{FileReader, GenerationId, ReadMetaData, TrustedFileReader}; diff --git a/components/script/task_source/gamepad.rs b/components/script/task_source/gamepad.rs index e6694f3daea..9d38257bace 100644 --- a/components/script/task_source/gamepad.rs +++ b/components/script/task_source/gamepad.rs @@ -5,7 +5,7 @@ use std::fmt; use std::result::Result; -use msg::constellation_msg::PipelineId; +use base::id::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; diff --git a/components/script/task_source/history_traversal.rs b/components/script/task_source/history_traversal.rs index 1676461fa99..4bb90a1ffcb 100644 --- a/components/script/task_source/history_traversal.rs +++ b/components/script/task_source/history_traversal.rs @@ -2,8 +2,8 @@ * 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 base::id::PipelineId; use crossbeam_channel::Sender; -use msg::constellation_msg::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptThreadEventCategory}; use crate::script_thread::MainThreadScriptMsg; diff --git a/components/script/task_source/media_element.rs b/components/script/task_source/media_element.rs index 64d2f6c2764..944ffc4f5bf 100644 --- a/components/script/task_source/media_element.rs +++ b/components/script/task_source/media_element.rs @@ -5,8 +5,8 @@ use std::fmt; use std::result::Result; +use base::id::PipelineId; use crossbeam_channel::Sender; -use msg::constellation_msg::PipelineId; use servo_atoms::Atom; use crate::dom::bindings::inheritance::Castable; diff --git a/components/script/task_source/networking.rs b/components/script/task_source/networking.rs index b55331af526..f142c1f6ae0 100644 --- a/components/script/task_source/networking.rs +++ b/components/script/task_source/networking.rs @@ -2,7 +2,7 @@ * 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 msg::constellation_msg::PipelineId; +use base::id::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; diff --git a/components/script/task_source/performance_timeline.rs b/components/script/task_source/performance_timeline.rs index 9f6f56a2cf4..9bcfe4bc1d8 100644 --- a/components/script/task_source/performance_timeline.rs +++ b/components/script/task_source/performance_timeline.rs @@ -9,7 +9,7 @@ use std::fmt; use std::result::Result; -use msg::constellation_msg::PipelineId; +use base::id::PipelineId; use crate::dom::bindings::refcounted::Trusted; use crate::dom::globalscope::GlobalScope; diff --git a/components/script/task_source/port_message.rs b/components/script/task_source/port_message.rs index b9bca1e6194..0ca613c647c 100644 --- a/components/script/task_source/port_message.rs +++ b/components/script/task_source/port_message.rs @@ -4,7 +4,7 @@ use std::fmt; -use msg::constellation_msg::PipelineId; +use base::id::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; diff --git a/components/script/task_source/remote_event.rs b/components/script/task_source/remote_event.rs index cadba9b3016..9a70d2a0234 100644 --- a/components/script/task_source/remote_event.rs +++ b/components/script/task_source/remote_event.rs @@ -2,7 +2,7 @@ * 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 msg::constellation_msg::PipelineId; +use base::id::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; diff --git a/components/script/task_source/rendering.rs b/components/script/task_source/rendering.rs index 732eb2aef2b..43afa4abb68 100644 --- a/components/script/task_source/rendering.rs +++ b/components/script/task_source/rendering.rs @@ -5,7 +5,7 @@ use std::fmt; use std::result::Result; -use msg::constellation_msg::PipelineId; +use base::id::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; diff --git a/components/script/task_source/timer.rs b/components/script/task_source/timer.rs index e565a3aaa22..4f8ad10d811 100644 --- a/components/script/task_source/timer.rs +++ b/components/script/task_source/timer.rs @@ -4,7 +4,7 @@ use std::fmt; -use msg::constellation_msg::PipelineId; +use base::id::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; diff --git a/components/script/task_source/user_interaction.rs b/components/script/task_source/user_interaction.rs index a16277f2781..9ddc06d9185 100644 --- a/components/script/task_source/user_interaction.rs +++ b/components/script/task_source/user_interaction.rs @@ -5,8 +5,8 @@ use std::fmt; use std::result::Result; +use base::id::PipelineId; use crossbeam_channel::Sender; -use msg::constellation_msg::PipelineId; use servo_atoms::Atom; use crate::dom::bindings::inheritance::Castable; diff --git a/components/script/task_source/websocket.rs b/components/script/task_source/websocket.rs index 27ad5202373..2d05067e28b 100644 --- a/components/script/task_source/websocket.rs +++ b/components/script/task_source/websocket.rs @@ -2,7 +2,7 @@ * 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 msg::constellation_msg::PipelineId; +use base::id::PipelineId; use crate::script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use crate::task::{TaskCanceller, TaskOnce}; diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index ebc15484e92..11c43f40878 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -6,6 +6,7 @@ use std::cmp; use std::collections::HashMap; use std::ffi::CString; +use base::id::{BrowsingContextId, PipelineId}; use cookie::Cookie; use euclid::default::{Point2D, Rect, Size2D}; use hyper_serde::Serde; @@ -14,7 +15,6 @@ use js::jsapi::{HandleValueArray, JSAutoRealm, JSContext, JSType, JS_IsException use js::jsval::UndefinedValue; use js::rust::wrappers::{JS_CallFunctionName, JS_GetProperty, JS_HasOwnProperty, JS_TypeOfValue}; use js::rust::{HandleObject, HandleValue}; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::CookieSource::{NonHTTP, HTTP}; use net_traits::CoreResourceMsg::{DeleteCookies, GetCookiesDataForUrl, SetCookieForUrl}; use net_traits::IpcSend; diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index c0f3555b1c2..18181c40e30 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -34,6 +34,7 @@ xr-profile = ["canvas/xr-profile", "canvas_traits/xr-profile", "script/xr-profil [dependencies] background_hang_monitor = { path = "../background_hang_monitor" } +base = { workspace = true } bluetooth = { path = "../bluetooth" } bluetooth_traits = { workspace = true } canvas = { path = "../canvas", default-features = false } @@ -58,7 +59,6 @@ layout_thread_2020 = { path = "../layout_thread_2020" } log = { workspace = true } media = { path = "../media" } mozangle = { workspace = true } -msg = { workspace = true } net = { path = "../net" } net_traits = { workspace = true } profile = { path = "../profile" } diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 17b3541ee52..fc15c830100 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -25,6 +25,8 @@ use std::rc::Rc; use std::sync::{Arc, Mutex}; use std::vec::Drain; +pub use base::id::TopLevelBrowsingContextId; +use base::id::{PipelineNamespace, PipelineNamespaceId}; use bluetooth::BluetoothThreadFactory; use bluetooth_traits::BluetoothRequest; use canvas::canvas_paint_thread::{self, CanvasPaintThread}; @@ -70,8 +72,6 @@ pub use gleam::gl; use ipc_channel::ipc::{self, IpcSender}; use log::{error, trace, warn, Log, Metadata, Record}; use media::{GLPlayerThreads, GlApi, NativeDisplay, WindowGLContext}; -pub use msg::constellation_msg::TopLevelBrowsingContextId; -use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId}; use net::resource_thread::new_resource_threads; use net_traits::IpcSend; use profile::{mem as profile_mem, time as profile_time}; @@ -96,12 +96,13 @@ use webrender_api::{ NativeFontHandle, }; use webrender_traits::{ - WebrenderExternalImageHandlers, WebrenderExternalImageRegistry, WebrenderImageHandlerType, + WebRenderFontApi, WebrenderExternalImageHandlers, WebrenderExternalImageRegistry, + WebrenderImageHandlerType, }; pub use { - background_hang_monitor, bluetooth, bluetooth_traits, canvas, canvas_traits, compositing, + background_hang_monitor, base, bluetooth, bluetooth_traits, canvas, canvas_traits, compositing, constellation, devtools, devtools_traits, embedder_traits, euclid, gfx, ipc_channel, - keyboard_types, layout_thread_2013, layout_thread_2020, media, msg, net, net_traits, profile, + keyboard_types, layout_thread_2013, layout_thread_2020, media, net, net_traits, profile, profile_traits, script, script_layout_interface, script_traits, servo_config as config, servo_config, servo_geometry, servo_url as url, servo_url, style, style_traits, webgpu, webrender_api, webrender_traits, @@ -1051,7 +1052,7 @@ fn create_constellation( struct FontCacheWR(CompositorProxy); -impl gfx_traits::WebrenderApi for FontCacheWR { +impl WebRenderFontApi for FontCacheWR { fn add_font_instance( &self, font_key: FontKey, diff --git a/components/shared/background_hang_monitor/Cargo.toml b/components/shared/background_hang_monitor/Cargo.toml new file mode 100644 index 00000000000..c8d0685a377 --- /dev/null +++ b/components/shared/background_hang_monitor/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "background_hang_monitor_api" +version = "0.0.1" +authors = ["The Servo Project Developers"] +license = "MPL-2.0" +edition = "2018" +publish = false + +[lib] +name = "background_hang_monitor_api" +path = "lib.rs" +test = false +doctest = false + +[dependencies] +base = { workspace = true } +ipc-channel = { workspace = true } +lazy_static = { workspace = true } +malloc_size_of = { workspace = true } +malloc_size_of_derive = { workspace = true } +parking_lot = { workspace = true } +serde = { workspace = true } +size_of_test = { workspace = true } +webrender_api = { workspace = true } diff --git a/components/shared/background_hang_monitor/lib.rs b/components/shared/background_hang_monitor/lib.rs new file mode 100644 index 00000000000..8fbec70f041 --- /dev/null +++ b/components/shared/background_hang_monitor/lib.rs @@ -0,0 +1,212 @@ +/* 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)] + +//! An API interface to the BackgroundHangMonitor. + +use std::time::Duration; +use std::{fmt, mem}; + +use base::id::PipelineId; +use ipc_channel::ipc::IpcSender; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +/// The equivalent of script::script_runtime::ScriptEventCategory +pub enum ScriptHangAnnotation { + AttachLayout, + ConstellationMsg, + DevtoolsMsg, + DocumentEvent, + DomEvent, + FileRead, + FormPlannedNavigation, + ImageCacheMsg, + InputEvent, + HistoryEvent, + NetworkEvent, + Resize, + ScriptEvent, + SetScrollState, + SetViewport, + StylesheetLoad, + TimerEvent, + UpdateReplacedElement, + WebSocketEvent, + WorkerEvent, + WorkletEvent, + ServiceWorkerEvent, + EnterFullscreen, + ExitFullscreen, + WebVREvent, + PerformanceTimelineTask, + PortMessage, + WebGPUMsg, +} + +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub enum HangAnnotation { + Script(ScriptHangAnnotation), +} + +/// Hang-alerts are sent by the monitor to the constellation. +#[derive(Deserialize, Serialize)] +pub enum HangMonitorAlert { + /// A component hang has been detected. + Hang(HangAlert), + /// Report a completed sampled profile. + Profile(Vec<u8>), +} + +impl fmt::Debug for HangMonitorAlert { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + match *self { + HangMonitorAlert::Hang(..) => write!(fmt, "Hang"), + HangMonitorAlert::Profile(..) => write!(fmt, "Profile"), + } + } +} + +/// Hang-alerts are sent by the monitor to the constellation. +#[derive(Deserialize, Serialize)] +pub enum HangAlert { + /// Report a transient hang. + Transient(MonitoredComponentId, HangAnnotation), + /// Report a permanent hang. + Permanent(MonitoredComponentId, HangAnnotation, Option<HangProfile>), +} + +impl fmt::Debug for HangAlert { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + let (annotation, profile) = match self { + HangAlert::Transient(component_id, annotation) => { + write!( + fmt, + "\n The following component is experiencing a transient hang: \n {:?}", + component_id + )?; + (*annotation, None) + }, + HangAlert::Permanent(component_id, annotation, profile) => { + write!( + fmt, + "\n The following component is experiencing a permanent hang: \n {:?}", + component_id + )?; + (*annotation, profile.clone()) + }, + }; + + write!(fmt, "\n Annotation for the hang:\n{:?}", annotation)?; + if let Some(profile) = profile { + write!(fmt, "\n {:?}", profile)?; + } + + Ok(()) + } +} + +#[derive(Clone, Deserialize, Serialize)] +pub struct HangProfileSymbol { + pub name: Option<String>, + pub filename: Option<String>, + pub lineno: Option<u32>, +} + +#[derive(Clone, Deserialize, Serialize)] +/// Info related to the activity of an hanging component. +pub struct HangProfile { + pub backtrace: Vec<HangProfileSymbol>, +} + +impl fmt::Debug for HangProfile { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + let hex_width = mem::size_of::<usize>() * 2 + 2; + + write!(fmt, "HangProfile backtrace:")?; + + if self.backtrace.is_empty() { + write!(fmt, "backtrace failed to resolve")?; + return Ok(()); + } + + for symbol in self.backtrace.iter() { + write!(fmt, "\n {:1$}", "", hex_width)?; + + if let Some(ref name) = symbol.name { + write!(fmt, " - {}", name)?; + } else { + write!(fmt, " - <unknown>")?; + } + + if let (Some(ref file), Some(ref line)) = (symbol.filename.as_ref(), symbol.lineno) { + write!(fmt, "\n {:3$}at {}:{}", "", file, line, hex_width)?; + } + } + + Ok(()) + } +} + +#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum MonitoredComponentType { + Script, +} + +#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub struct MonitoredComponentId(pub PipelineId, pub MonitoredComponentType); + +/// A handle to register components for hang monitoring, +/// and to receive a means to communicate with the underlying hang monitor worker. +pub trait BackgroundHangMonitorRegister: BackgroundHangMonitorClone + Send { + /// Register a component for hang monitoring: + /// to be called from within the thread to be monitored for hangs. + fn register_component( + &self, + component: MonitoredComponentId, + transient_hang_timeout: Duration, + permanent_hang_timeout: Duration, + exit_signal: Option<Box<dyn BackgroundHangMonitorExitSignal>>, + ) -> Box<dyn BackgroundHangMonitor>; +} + +impl Clone for Box<dyn BackgroundHangMonitorRegister> { + fn clone(&self) -> Box<dyn BackgroundHangMonitorRegister> { + self.clone_box() + } +} + +pub trait BackgroundHangMonitorClone { + fn clone_box(&self) -> Box<dyn BackgroundHangMonitorRegister>; +} + +/// Proxy methods to communicate with the background hang monitor +pub trait BackgroundHangMonitor { + /// Notify the start of handling an event. + fn notify_activity(&self, annotation: HangAnnotation); + /// Notify the start of waiting for a new event to come in. + fn notify_wait(&self); + /// Unregister the component from monitor. + fn unregister(&self); +} + +/// A means for the BHM to signal a monitored component to exit. +/// Useful when the component is hanging, and cannot be notified via the usual way. +/// The component should implement this in a way allowing for the signal to be received when hanging, +/// if at all. +pub trait BackgroundHangMonitorExitSignal: Send { + /// Called by the BHM, to notify the monitored component to exit. + fn signal_to_exit(&self); +} + +/// Messages to control the sampling profiler. +#[derive(Deserialize, Serialize)] +pub enum BackgroundHangMonitorControlMsg { + /// Enable the sampler, with a given sampling rate and max total sampling duration. + EnableSampler(Duration, Duration), + DisableSampler, + /// Exit, and propagate the signal to monitored components. + Exit(IpcSender<()>), +} diff --git a/components/shared/msg/Cargo.toml b/components/shared/base/Cargo.toml index 97abd671eef..10cb0939d8c 100644 --- a/components/shared/msg/Cargo.toml +++ b/components/shared/base/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "msg" +name = "base" version = "0.0.1" authors = ["The Servo Project Developers"] license = "MPL-2.0" @@ -7,7 +7,7 @@ edition = "2018" publish = false [lib] -name = "msg" +name = "base" path = "lib.rs" test = false doctest = false diff --git a/components/shared/msg/constellation_msg.rs b/components/shared/base/id.rs index 93c18790255..06f69547bb7 100644 --- a/components/shared/msg/constellation_msg.rs +++ b/components/shared/base/id.rs @@ -2,16 +2,14 @@ * 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/. */ -//! The high-level interface from script to constellation. Using this abstract interface helps -//! reduce coupling between these two components. +//! Namespaces and ids shared by many crates in Servo. #![allow(clippy::new_without_default)] use std::cell::Cell; +use std::fmt; use std::num::NonZeroU32; use std::sync::Arc; -use std::time::Duration; -use std::{fmt, mem}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use lazy_static::lazy_static; @@ -65,12 +63,6 @@ macro_rules! namespace_id { }; } -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] -pub enum TraversalDirection { - Forward(usize), - Back(usize), -} - #[derive(Debug, Deserialize, Serialize)] /// Request a pipeline-namespace id from the constellation. pub struct PipelineNamespaceRequest(pub IpcSender<PipelineNamespaceId>); @@ -444,221 +436,3 @@ pub const TEST_BROWSING_CONTEXT_ID: BrowsingContextId = BrowsingContextId { namespace_id: TEST_NAMESPACE, index: TEST_BROWSING_CONTEXT_INDEX, }; - -// Used to specify the kind of input method editor appropriate to edit a field. -// This is a subset of htmlinputelement::InputType because some variants of InputType -// don't make sense in this context. -#[derive(Debug, Deserialize, Serialize)] -pub enum InputMethodType { - Color, - Date, - DatetimeLocal, - Email, - Month, - Number, - Password, - Search, - Tel, - Text, - Time, - Url, - Week, -} - -#[derive(Clone, Copy, Debug, Deserialize, Serialize)] -/// The equivalent of script::script_runtime::ScriptEventCategory -pub enum ScriptHangAnnotation { - AttachLayout, - ConstellationMsg, - DevtoolsMsg, - DocumentEvent, - DomEvent, - FileRead, - FormPlannedNavigation, - ImageCacheMsg, - InputEvent, - HistoryEvent, - NetworkEvent, - Resize, - ScriptEvent, - SetScrollState, - SetViewport, - StylesheetLoad, - TimerEvent, - UpdateReplacedElement, - WebSocketEvent, - WorkerEvent, - WorkletEvent, - ServiceWorkerEvent, - EnterFullscreen, - ExitFullscreen, - WebVREvent, - PerformanceTimelineTask, - PortMessage, - WebGPUMsg, -} - -#[derive(Clone, Copy, Debug, Deserialize, Serialize)] -pub enum HangAnnotation { - Script(ScriptHangAnnotation), -} - -/// Hang-alerts are sent by the monitor to the constellation. -#[derive(Deserialize, Serialize)] -pub enum HangMonitorAlert { - /// A component hang has been detected. - Hang(HangAlert), - /// Report a completed sampled profile. - Profile(Vec<u8>), -} - -impl fmt::Debug for HangMonitorAlert { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - match *self { - HangMonitorAlert::Hang(..) => write!(fmt, "Hang"), - HangMonitorAlert::Profile(..) => write!(fmt, "Profile"), - } - } -} - -/// Hang-alerts are sent by the monitor to the constellation. -#[derive(Deserialize, Serialize)] -pub enum HangAlert { - /// Report a transient hang. - Transient(MonitoredComponentId, HangAnnotation), - /// Report a permanent hang. - Permanent(MonitoredComponentId, HangAnnotation, Option<HangProfile>), -} - -impl fmt::Debug for HangAlert { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - let (annotation, profile) = match self { - HangAlert::Transient(component_id, annotation) => { - write!( - fmt, - "\n The following component is experiencing a transient hang: \n {:?}", - component_id - )?; - (*annotation, None) - }, - HangAlert::Permanent(component_id, annotation, profile) => { - write!( - fmt, - "\n The following component is experiencing a permanent hang: \n {:?}", - component_id - )?; - (*annotation, profile.clone()) - }, - }; - - write!(fmt, "\n Annotation for the hang:\n{:?}", annotation)?; - if let Some(profile) = profile { - write!(fmt, "\n {:?}", profile)?; - } - - Ok(()) - } -} - -#[derive(Clone, Deserialize, Serialize)] -pub struct HangProfileSymbol { - pub name: Option<String>, - pub filename: Option<String>, - pub lineno: Option<u32>, -} - -#[derive(Clone, Deserialize, Serialize)] -/// Info related to the activity of an hanging component. -pub struct HangProfile { - pub backtrace: Vec<HangProfileSymbol>, -} - -impl fmt::Debug for HangProfile { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - let hex_width = mem::size_of::<usize>() * 2 + 2; - - write!(fmt, "HangProfile backtrace:")?; - - if self.backtrace.is_empty() { - write!(fmt, "backtrace failed to resolve")?; - return Ok(()); - } - - for symbol in self.backtrace.iter() { - write!(fmt, "\n {:1$}", "", hex_width)?; - - if let Some(ref name) = symbol.name { - write!(fmt, " - {}", name)?; - } else { - write!(fmt, " - <unknown>")?; - } - - if let (Some(ref file), Some(ref line)) = (symbol.filename.as_ref(), symbol.lineno) { - write!(fmt, "\n {:3$}at {}:{}", "", file, line, hex_width)?; - } - } - - Ok(()) - } -} - -#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] -pub enum MonitoredComponentType { - Script, -} - -#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] -pub struct MonitoredComponentId(pub PipelineId, pub MonitoredComponentType); - -/// A handle to register components for hang monitoring, -/// and to receive a means to communicate with the underlying hang monitor worker. -pub trait BackgroundHangMonitorRegister: BackgroundHangMonitorClone + Send { - /// Register a component for hang monitoring: - /// to be called from within the thread to be monitored for hangs. - fn register_component( - &self, - component: MonitoredComponentId, - transient_hang_timeout: Duration, - permanent_hang_timeout: Duration, - exit_signal: Option<Box<dyn BackgroundHangMonitorExitSignal>>, - ) -> Box<dyn BackgroundHangMonitor>; -} - -impl Clone for Box<dyn BackgroundHangMonitorRegister> { - fn clone(&self) -> Box<dyn BackgroundHangMonitorRegister> { - self.clone_box() - } -} - -pub trait BackgroundHangMonitorClone { - fn clone_box(&self) -> Box<dyn BackgroundHangMonitorRegister>; -} - -/// Proxy methods to communicate with the background hang monitor -pub trait BackgroundHangMonitor { - /// Notify the start of handling an event. - fn notify_activity(&self, annotation: HangAnnotation); - /// Notify the start of waiting for a new event to come in. - fn notify_wait(&self); - /// Unregister the component from monitor. - fn unregister(&self); -} - -/// A means for the BHM to signal a monitored component to exit. -/// Useful when the component is hanging, and cannot be notified via the usual way. -/// The component should implement this in a way allowing for the signal to be received when hanging, -/// if at all. -pub trait BackgroundHangMonitorExitSignal: Send { - /// Called by the BHM, to notify the monitored component to exit. - fn signal_to_exit(&self); -} - -/// Messages to control the sampling profiler. -#[derive(Deserialize, Serialize)] -pub enum BackgroundHangMonitorControlMsg { - /// Enable the sampler, with a given sampling rate and max total sampling duration. - EnableSampler(Duration, Duration), - DisableSampler, - /// Exit, and propagate the signal to monitored components. - Exit(IpcSender<()>), -} diff --git a/components/shared/base/lib.rs b/components/shared/base/lib.rs new file mode 100644 index 00000000000..2057c9aa8c2 --- /dev/null +++ b/components/shared/base/lib.rs @@ -0,0 +1,45 @@ +/* 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)] + +//! A crate to hold very common types in Servo. +//! +//! You should almost never need to add a data type to this crate. Instead look for +//! a more shared crate that has fewer dependents. + +use serde::{Deserialize, Serialize}; + +pub mod id; +pub mod print_tree; +use webrender_api::Epoch as WebRenderEpoch; + +/// A struct for denoting the age of messages; prevents race conditions. +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub struct Epoch(pub u32); + +impl Epoch { + pub fn next(&mut self) { + self.0 += 1; + } +} + +impl From<Epoch> for WebRenderEpoch { + fn from(val: Epoch) -> Self { + WebRenderEpoch(val.0) + } +} + +pub trait WebRenderEpochToU16 { + fn as_u16(&self) -> u16; +} + +impl WebRenderEpochToU16 for WebRenderEpoch { + /// The value of this [`Epoch`] as a u16 value. Note that if this Epoch's + /// value is more than u16::MAX, then the return value will be modulo + /// u16::MAX. + fn as_u16(&self) -> u16 { + (self.0 % u16::MAX as u32) as u16 + } +} diff --git a/components/shared/gfx/print_tree.rs b/components/shared/base/print_tree.rs index 03e47b21317..03e47b21317 100644 --- a/components/shared/gfx/print_tree.rs +++ b/components/shared/base/print_tree.rs diff --git a/components/shared/compositing/Cargo.toml b/components/shared/compositing/Cargo.toml index b35e7560f3e..aed9a0e3565 100644 --- a/components/shared/compositing/Cargo.toml +++ b/components/shared/compositing/Cargo.toml @@ -11,6 +11,7 @@ name = "compositing_traits" path = "lib.rs" [dependencies] +base = { workspace = true } canvas = { path = "../../canvas" } crossbeam-channel = { workspace = true } embedder_traits = { workspace = true } @@ -19,7 +20,6 @@ gfx_traits = { workspace = true } ipc-channel = { workspace = true } keyboard-types = { workspace = true } log = { workspace = true } -msg = { workspace = true } net_traits = { workspace = true } script_traits = { workspace = true } servo_url = { path = "../../url" } diff --git a/components/shared/compositing/constellation_msg.rs b/components/shared/compositing/constellation_msg.rs index 2a64db84651..2536a6cfc05 100644 --- a/components/shared/compositing/constellation_msg.rs +++ b/components/shared/compositing/constellation_msg.rs @@ -6,16 +6,14 @@ use std::collections::HashMap; use std::fmt; use std::time::Duration; +use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId, WebViewId}; +use base::Epoch; use embedder_traits::Cursor; -use gfx_traits::Epoch; use ipc_channel::ipc::IpcSender; use keyboard_types::KeyboardEvent; -use msg::constellation_msg::{ - BrowsingContextId, PipelineId, TopLevelBrowsingContextId, TraversalDirection, WebViewId, -}; use script_traits::{ AnimationTickType, CompositorEvent, GamepadEvent, LogEntry, MediaSessionActionType, - WebDriverCommandMsg, WindowSizeData, WindowSizeType, + TraversalDirection, WebDriverCommandMsg, WindowSizeData, WindowSizeType, }; use servo_url::ServoUrl; diff --git a/components/shared/compositing/lib.rs b/components/shared/compositing/lib.rs index 21f77a4cae6..34c390cca85 100644 --- a/components/shared/compositing/lib.rs +++ b/components/shared/compositing/lib.rs @@ -8,15 +8,15 @@ mod constellation_msg; use std::fmt::{Debug, Error, Formatter}; +use base::id::{PipelineId, TopLevelBrowsingContextId}; +use base::Epoch; use canvas::canvas_paint_thread::ImageUpdate; pub use constellation_msg::ConstellationMsg; use crossbeam_channel::{Receiver, Sender}; use embedder_traits::EventLoopWaker; use euclid::Rect; -use gfx_traits::Epoch; use ipc_channel::ipc::IpcSender; use log::warn; -use msg::constellation_msg::{PipelineId, TopLevelBrowsingContextId}; use net_traits::image::base::Image; use net_traits::NetToCompositorMsg; use script_traits::{ diff --git a/components/shared/devtools/Cargo.toml b/components/shared/devtools/Cargo.toml index c3be3bcb01b..d68e3bbb612 100644 --- a/components/shared/devtools/Cargo.toml +++ b/components/shared/devtools/Cargo.toml @@ -11,12 +11,12 @@ name = "devtools_traits" path = "lib.rs" [dependencies] +base = { workspace = true } bitflags = { workspace = true } http = { workspace = true } ipc-channel = { workspace = true } malloc_size_of = { workspace = true } malloc_size_of_derive = { workspace = true } -msg = { workspace = true } serde = { workspace = true } servo_url = { path = "../../url" } time = { workspace = true } diff --git a/components/shared/devtools/lib.rs b/components/shared/devtools/lib.rs index 0726bb48541..f690fb59e0d 100644 --- a/components/shared/devtools/lib.rs +++ b/components/shared/devtools/lib.rs @@ -14,11 +14,11 @@ use std::net::TcpStream; use std::time::{Duration, SystemTime}; +use base::id::{BrowsingContextId, PipelineId}; use bitflags::bitflags; use http::{HeaderMap, Method}; use ipc_channel::ipc::IpcSender; use malloc_size_of_derive::MallocSizeOf; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use serde::{Deserialize, Serialize}; use servo_url::ServoUrl; use uuid::Uuid; diff --git a/components/shared/embedder/Cargo.toml b/components/shared/embedder/Cargo.toml index c1d7456a156..f68e3b47d2c 100644 --- a/components/shared/embedder/Cargo.toml +++ b/components/shared/embedder/Cargo.toml @@ -11,13 +11,13 @@ name = "embedder_traits" path = "lib.rs" [dependencies] +base = { workspace = true } cfg-if = { workspace = true } crossbeam-channel = { workspace = true } ipc-channel = { workspace = true } keyboard-types = { workspace = true } lazy_static = { workspace = true } log = { workspace = true } -msg = { workspace = true } num-derive = "0.4" num-traits = { workspace = true } serde = { workspace = true } diff --git a/components/shared/embedder/lib.rs b/components/shared/embedder/lib.rs index 0acf7d01ce5..0a5cfdbb479 100644 --- a/components/shared/embedder/lib.rs +++ b/components/shared/embedder/lib.rs @@ -6,11 +6,11 @@ pub mod resources; use std::fmt::{Debug, Error, Formatter}; +use base::id::{PipelineId, TopLevelBrowsingContextId, WebViewId}; use crossbeam_channel::{Receiver, Sender}; use ipc_channel::ipc::IpcSender; use keyboard_types::KeyboardEvent; use log::warn; -use msg::constellation_msg::{InputMethodType, PipelineId, TopLevelBrowsingContextId, WebViewId}; use num_derive::FromPrimitive; use serde::{Deserialize, Serialize}; use servo_url::ServoUrl; @@ -368,3 +368,23 @@ pub enum PermissionRequest { Granted, Denied, } + +/// Used to specify the kind of input method editor appropriate to edit a field. +/// This is a subset of htmlinputelement::InputType because some variants of InputType +/// don't make sense in this context. +#[derive(Debug, Deserialize, Serialize)] +pub enum InputMethodType { + Color, + Date, + DatetimeLocal, + Email, + Month, + Number, + Password, + Search, + Tel, + Text, + Time, + Url, + Week, +} diff --git a/components/shared/gfx/lib.rs b/components/shared/gfx/lib.rs index 2ae2d026fda..e5699f2504a 100644 --- a/components/shared/gfx/lib.rs +++ b/components/shared/gfx/lib.rs @@ -2,71 +2,11 @@ * 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/. */ -#![crate_name = "gfx_traits"] -#![crate_type = "rlib"] #![deny(unsafe_code)] -pub mod print_tree; - -use std::sync::atomic::{AtomicU64, Ordering}; -use std::sync::Arc; - use malloc_size_of_derive::MallocSizeOf; use range::{int_range_index, RangeIndex}; use serde::{Deserialize, Serialize}; -use webrender_api::{ - Epoch as WebRenderEpoch, FontInstanceFlags, FontInstanceKey, FontKey, NativeFontHandle, -}; - -/// A newtype struct for denoting the age of messages; prevents race conditions. -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub struct Epoch(pub u32); - -impl Epoch { - pub fn next(&mut self) { - self.0 += 1; - } -} - -impl From<Epoch> for WebRenderEpoch { - fn from(val: Epoch) -> Self { - WebRenderEpoch(val.0) - } -} - -pub trait WebRenderEpochToU16 { - fn as_u16(&self) -> u16; -} - -impl WebRenderEpochToU16 for WebRenderEpoch { - /// The value of this [`Epoch`] as a u16 value. Note that if this Epoch's - /// value is more than u16::MAX, then the return value will be modulo - /// u16::MAX. - fn as_u16(&self) -> u16 { - (self.0 % u16::MAX as u32) as u16 - } -} - -/// A unique ID for every stacking context. -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)] -pub struct StackingContextId( - /// The identifier for this StackingContext, derived from the Flow's memory address - /// and fragment type. As a space optimization, these are combined into a single word. - pub u64, -); - -impl StackingContextId { - /// Returns the stacking context ID for the outer document/layout root. - #[inline] - pub fn root() -> StackingContextId { - StackingContextId(0) - } - - pub fn next(&self) -> StackingContextId { - let StackingContextId(id) = *self; - StackingContextId(id + 1) - } -} int_range_index! { #[derive(Deserialize, MallocSizeOf, Serialize)] @@ -74,61 +14,3 @@ int_range_index! { /// the middle of a glyph. struct ByteIndex(isize) } - -/// The type of fragment that a scroll root is created for. -/// -/// This can only ever grow to maximum 4 entries. That's because we cram the value of this enum -/// into the lower 2 bits of the `ScrollRootId`, which otherwise contains a 32-bit-aligned -/// heap address. -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)] -pub enum FragmentType { - /// A StackingContext for the fragment body itself. - FragmentBody, - /// A StackingContext created to contain ::before pseudo-element content. - BeforePseudoContent, - /// A StackingContext created to contain ::after pseudo-element content. - AfterPseudoContent, -} - -/// The next ID that will be used for a special scroll root id. -/// -/// A special scroll root is a scroll root that is created for generated content. -static NEXT_SPECIAL_SCROLL_ROOT_ID: AtomicU64 = AtomicU64::new(0); - -/// If none of the bits outside this mask are set, the scroll root is a special scroll root. -/// Note that we assume that the top 16 bits of the address space are unused on the platform. -const SPECIAL_SCROLL_ROOT_ID_MASK: u64 = 0xffff; - -/// Returns a new scroll root ID for a scroll root. -fn next_special_id() -> u64 { - // We shift this left by 2 to make room for the fragment type ID. - ((NEXT_SPECIAL_SCROLL_ROOT_ID.fetch_add(1, Ordering::SeqCst) + 1) << 2) & - SPECIAL_SCROLL_ROOT_ID_MASK -} - -pub fn combine_id_with_fragment_type(id: usize, fragment_type: FragmentType) -> u64 { - debug_assert_eq!(id & (fragment_type as usize), 0); - if fragment_type == FragmentType::FragmentBody { - id as u64 - } else { - next_special_id() | (fragment_type as u64) - } -} - -pub fn node_id_from_scroll_id(id: usize) -> Option<usize> { - if (id as u64 & !SPECIAL_SCROLL_ROOT_ID_MASK) != 0 { - return Some(id & !3); - } - None -} - -pub trait WebrenderApi { - fn add_font_instance( - &self, - font_key: FontKey, - size: f32, - flags: FontInstanceFlags, - ) -> FontInstanceKey; - fn add_font(&self, data: Arc<Vec<u8>>, index: u32) -> FontKey; - fn add_system_font(&self, handle: NativeFontHandle) -> FontKey; -} diff --git a/components/shared/msg/lib.rs b/components/shared/msg/lib.rs deleted file mode 100644 index b2ce3a52c2c..00000000000 --- a/components/shared/msg/lib.rs +++ /dev/null @@ -1,7 +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)] - -pub mod constellation_msg; diff --git a/components/shared/net/Cargo.toml b/components/shared/net/Cargo.toml index 50e9d4eb21d..73db752aba6 100644 --- a/components/shared/net/Cargo.toml +++ b/components/shared/net/Cargo.toml @@ -13,6 +13,7 @@ test = false doctest = false [dependencies] +base = { workspace = true } content-security-policy = { workspace = true } cookie = { workspace = true } embedder_traits = { workspace = true } @@ -27,7 +28,6 @@ log = { workspace = true } malloc_size_of = { workspace = true } malloc_size_of_derive = { workspace = true } mime = { workspace = true } -msg = { workspace = true } num-traits = { workspace = true } percent-encoding = { workspace = true } pixels = { path = "../../pixels" } diff --git a/components/shared/net/lib.rs b/components/shared/net/lib.rs index 95f8856689d..436ccf5d645 100644 --- a/components/shared/net/lib.rs +++ b/components/shared/net/lib.rs @@ -6,6 +6,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; +use base::id::HistoryStateId; use cookie::Cookie; use headers::{ContentType, HeaderMapExt, ReferrerPolicy as ReferrerPolicyHeader}; use http::{Error as HttpError, HeaderMap, StatusCode}; @@ -19,7 +20,6 @@ use log::warn; use malloc_size_of::malloc_size_of_is_0; use malloc_size_of_derive::MallocSizeOf; use mime::Mime; -use msg::constellation_msg::HistoryStateId; use num_traits::Zero; use rustls::Certificate; use serde::{Deserialize, Serialize}; diff --git a/components/shared/net/request.rs b/components/shared/net/request.rs index 346614bc73e..77b37e17b75 100644 --- a/components/shared/net/request.rs +++ b/components/shared/net/request.rs @@ -4,13 +4,13 @@ use std::sync::{Arc, Mutex}; +use base::id::PipelineId; use content_security_policy::{self as csp, CspList}; use http::header::{HeaderName, AUTHORIZATION}; use http::{HeaderMap, Method}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use malloc_size_of_derive::MallocSizeOf; use mime::Mime; -use msg::constellation_msg::PipelineId; use serde::{Deserialize, Serialize}; use servo_url::{ImmutableOrigin, ServoUrl}; diff --git a/components/shared/script/Cargo.toml b/components/shared/script/Cargo.toml index 5cc2b1f8554..f95a0ffdcc9 100644 --- a/components/shared/script/Cargo.toml +++ b/components/shared/script/Cargo.toml @@ -11,6 +11,8 @@ name = "script_traits" path = "lib.rs" [dependencies] +background_hang_monitor_api = { workspace = true } +base = { workspace = true } bitflags = { workspace = true } bluetooth_traits = { workspace = true } canvas_traits = { workspace = true } @@ -29,7 +31,6 @@ log = { workspace = true } malloc_size_of = { workspace = true } malloc_size_of_derive = { workspace = true } media = { path = "../../media" } -msg = { workspace = true } net_traits = { workspace = true } pixels = { path = "../../pixels" } profile_traits = { workspace = true } diff --git a/components/shared/script/lib.rs b/components/shared/script/lib.rs index 35f7520684e..2f9822d2711 100644 --- a/components/shared/script/lib.rs +++ b/components/shared/script/lib.rs @@ -20,6 +20,12 @@ use std::collections::{HashMap, VecDeque}; use std::fmt; use std::sync::Arc; +use background_hang_monitor_api::BackgroundHangMonitorRegister; +use base::id::{ + BlobId, BrowsingContextId, HistoryStateId, MessagePortId, PipelineId, PipelineNamespaceId, + TopLevelBrowsingContextId, +}; +use base::Epoch; use bitflags::bitflags; use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLPipeline; @@ -29,7 +35,6 @@ use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, Worke use embedder_traits::{CompositorEventVariant, Cursor}; use euclid::default::Point2D; use euclid::{Length, Rect, Scale, Size2D, UnknownUnit, Vector2D}; -use gfx_traits::Epoch; use http::{HeaderMap, Method}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::Error as IpcError; @@ -40,10 +45,6 @@ use log::warn; use malloc_size_of::malloc_size_of_is_0; use malloc_size_of_derive::MallocSizeOf; use media::WindowGLContext; -use msg::constellation_msg::{ - BackgroundHangMonitorRegister, BlobId, BrowsingContextId, HistoryStateId, MessagePortId, - PipelineId, PipelineNamespaceId, TopLevelBrowsingContextId, -}; use net_traits::image::base::Image; use net_traits::image_cache::ImageCache; use net_traits::request::{Referrer, RequestBody}; @@ -66,7 +67,7 @@ use crate::compositor::CompositorDisplayListInfo; pub use crate::script_msg::{ DOMMessage, EventResult, HistoryEntryReplacement, IFrameSizeMsg, Job, JobError, JobResult, JobResultValue, JobType, LayoutMsg, LogEntry, SWManagerMsg, SWManagerSenders, ScopeThings, - ScriptMsg, ServiceWorkerMsg, + ScriptMsg, ServiceWorkerMsg, TraversalDirection, }; use crate::serializable::{BlobData, BlobImpl}; use crate::transferable::MessagePortImpl; diff --git a/components/shared/script/script_msg.rs b/components/shared/script/script_msg.rs index a51859231ba..d750d33340d 100644 --- a/components/shared/script/script_msg.rs +++ b/components/shared/script/script_msg.rs @@ -5,18 +5,18 @@ use std::collections::{HashMap, VecDeque}; use std::fmt; +use base::id::{ + BroadcastChannelRouterId, BrowsingContextId, HistoryStateId, MessagePortId, + MessagePortRouterId, PipelineId, ServiceWorkerId, ServiceWorkerRegistrationId, + TopLevelBrowsingContextId, +}; +use base::Epoch; use canvas_traits::canvas::{CanvasId, CanvasMsg}; use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use embedder_traits::{EmbedderMsg, MediaSessionEvent}; use euclid::default::Size2D as UntypedSize2D; use euclid::Size2D; -use gfx_traits::Epoch; use ipc_channel::ipc::{IpcReceiver, IpcSender}; -use msg::constellation_msg::{ - BroadcastChannelRouterId, BrowsingContextId, HistoryStateId, MessagePortId, - MessagePortRouterId, PipelineId, ServiceWorkerId, ServiceWorkerRegistrationId, - TopLevelBrowsingContextId, TraversalDirection, -}; use net_traits::request::RequestBuilder; use net_traits::storage_thread::StorageType; use net_traits::CoreResourceMsg; @@ -492,3 +492,12 @@ pub enum SWManagerMsg { /// <https://github.com/servo/servo/issues/24660> PostMessageToClient, } + +/// The direction of a history traversal +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +pub enum TraversalDirection { + /// Travel forward the given number of documents. + Forward(usize), + /// Travel backward the given number of documents. + Back(usize), +} diff --git a/components/shared/script/serializable.rs b/components/shared/script/serializable.rs index d186cad621a..d168736f961 100644 --- a/components/shared/script/serializable.rs +++ b/components/shared/script/serializable.rs @@ -11,8 +11,8 @@ use std::cell::RefCell; use std::path::PathBuf; +use base::id::BlobId; use malloc_size_of_derive::MallocSizeOf; -use msg::constellation_msg::BlobId; use net_traits::filemanager_thread::RelativePos; use serde::{Deserialize, Serialize}; use uuid::Uuid; diff --git a/components/shared/script/transferable.rs b/components/shared/script/transferable.rs index 2daf4a8d3fd..8344dd493b0 100644 --- a/components/shared/script/transferable.rs +++ b/components/shared/script/transferable.rs @@ -9,8 +9,8 @@ use std::collections::VecDeque; +use base::id::MessagePortId; use malloc_size_of_derive::MallocSizeOf; -use msg::constellation_msg::MessagePortId; use serde::{Deserialize, Serialize}; use crate::PortMessageTask; diff --git a/components/shared/script/webdriver_msg.rs b/components/shared/script/webdriver_msg.rs index d72d93b61cb..9108f2dcbd2 100644 --- a/components/shared/script/webdriver_msg.rs +++ b/components/shared/script/webdriver_msg.rs @@ -6,11 +6,11 @@ use std::collections::HashMap; +use base::id::BrowsingContextId; use cookie::Cookie; use euclid::default::Rect; use hyper_serde::Serde; use ipc_channel::ipc::IpcSender; -use msg::constellation_msg::BrowsingContextId; use serde::{Deserialize, Serialize}; use servo_url::ServoUrl; use webdriver::common::{WebElement, WebFrame, WebWindow}; diff --git a/components/shared/script_layout/Cargo.toml b/components/shared/script_layout/Cargo.toml index df526c9bec9..57c4059b859 100644 --- a/components/shared/script_layout/Cargo.toml +++ b/components/shared/script_layout/Cargo.toml @@ -11,6 +11,7 @@ name = "script_layout_interface" path = "lib.rs" [dependencies] +base = { workspace = true } app_units = { workspace = true } atomic_refcell = { workspace = true } canvas_traits = { workspace = true } @@ -24,12 +25,12 @@ libc = { workspace = true } malloc_size_of = { workspace = true } malloc_size_of_derive = { workspace = true } metrics = { path = "../../metrics" } -msg = { workspace = true } net_traits = { workspace = true } profile_traits = { workspace = true } range = { path = "../../range" } script_traits = { workspace = true } selectors = { workspace = true } +serde = { workspace = true } servo_arc = { workspace = true } servo_atoms = { workspace = true } servo_url = { path = "../../url" } diff --git a/components/shared/script_layout/lib.rs b/components/shared/script_layout/lib.rs index d4ac0185306..7c1f4ee2162 100644 --- a/components/shared/script_layout/lib.rs +++ b/components/shared/script_layout/lib.rs @@ -12,22 +12,22 @@ pub mod wrapper_traits; use std::any::Any; use std::borrow::Cow; -use std::sync::atomic::AtomicIsize; +use std::sync::atomic::{AtomicIsize, AtomicU64, Ordering}; use std::sync::Arc; use app_units::Au; use atomic_refcell::AtomicRefCell; +use base::id::{BrowsingContextId, PipelineId}; +use base::Epoch; use canvas_traits::canvas::{CanvasId, CanvasMsg}; use crossbeam_channel::Sender; use euclid::default::{Point2D, Rect}; use euclid::Size2D; 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 metrics::PaintTimeMetrics; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image_cache::{ImageCache, PendingImageId}; use profile_traits::mem::Report; use profile_traits::time; @@ -35,6 +35,7 @@ use script_traits::{ ConstellationControlMsg, InitialScriptState, LayoutControlMsg, LayoutMsg, LoadData, Painter, ScrollState, UntrustedNodeAddress, WebrenderIpcSender, WindowSizeData, }; +use serde::{Deserialize, Serialize}; use servo_arc::Arc as ServoArc; use servo_url::{ImmutableOrigin, ServoUrl}; use style::animation::DocumentAnimationSet; @@ -413,3 +414,50 @@ pub struct PendingRestyle { /// Any explicit restyles damage that have been accumulated for this element. pub damage: RestyleDamage, } + +/// The type of fragment that a scroll root is created for. +/// +/// This can only ever grow to maximum 4 entries. That's because we cram the value of this enum +/// into the lower 2 bits of the `ScrollRootId`, which otherwise contains a 32-bit-aligned +/// heap address. +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)] +pub enum FragmentType { + /// A StackingContext for the fragment body itself. + FragmentBody, + /// A StackingContext created to contain ::before pseudo-element content. + BeforePseudoContent, + /// A StackingContext created to contain ::after pseudo-element content. + AfterPseudoContent, +} + +/// The next ID that will be used for a special scroll root id. +/// +/// A special scroll root is a scroll root that is created for generated content. +static NEXT_SPECIAL_SCROLL_ROOT_ID: AtomicU64 = AtomicU64::new(0); + +/// If none of the bits outside this mask are set, the scroll root is a special scroll root. +/// Note that we assume that the top 16 bits of the address space are unused on the platform. +const SPECIAL_SCROLL_ROOT_ID_MASK: u64 = 0xffff; + +/// Returns a new scroll root ID for a scroll root. +fn next_special_id() -> u64 { + // We shift this left by 2 to make room for the fragment type ID. + ((NEXT_SPECIAL_SCROLL_ROOT_ID.fetch_add(1, Ordering::SeqCst) + 1) << 2) & + SPECIAL_SCROLL_ROOT_ID_MASK +} + +pub fn combine_id_with_fragment_type(id: usize, fragment_type: FragmentType) -> u64 { + debug_assert_eq!(id & (fragment_type as usize), 0); + if fragment_type == FragmentType::FragmentBody { + id as u64 + } else { + next_special_id() | (fragment_type as u64) + } +} + +pub fn node_id_from_scroll_id(id: usize) -> Option<usize> { + if (id as u64 & !SPECIAL_SCROLL_ROOT_ID_MASK) != 0 { + return Some(id & !3); + } + None +} diff --git a/components/shared/script_layout/wrapper_traits.rs b/components/shared/script_layout/wrapper_traits.rs index 846943414ae..0adb51be244 100644 --- a/components/shared/script_layout/wrapper_traits.rs +++ b/components/shared/script_layout/wrapper_traits.rs @@ -9,9 +9,9 @@ use std::fmt::Debug; use std::sync::Arc as StdArc; use atomic_refcell::AtomicRef; -use gfx_traits::{ByteIndex, FragmentType}; +use base::id::{BrowsingContextId, PipelineId}; +use gfx_traits::ByteIndex; use html5ever::{local_name, namespace_url, ns, LocalName, Namespace}; -use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; use range::Range; use servo_arc::Arc; @@ -25,7 +25,8 @@ use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorIm use style::stylist::RuleInclusion; use crate::{ - GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutNodeType, SVGSVGData, StyleData, + FragmentType, GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutNodeType, SVGSVGData, + StyleData, }; pub trait LayoutDataTrait: Default + Send + Sync + 'static {} diff --git a/components/shared/webrender/lib.rs b/components/shared/webrender/lib.rs index a71f9f67760..8af3a17b609 100644 --- a/components/shared/webrender/lib.rs +++ b/components/shared/webrender/lib.rs @@ -9,7 +9,10 @@ use std::sync::{Arc, Mutex}; use euclid::default::Size2D; use webrender_api::units::TexelRect; -use webrender_api::{ExternalImage, ExternalImageHandler, ExternalImageId, ExternalImageSource}; +use webrender_api::{ + ExternalImage, ExternalImageHandler, ExternalImageId, ExternalImageSource, FontInstanceFlags, + FontInstanceKey, FontKey, NativeFontHandle, +}; /// This trait is used as a bridge between the different GL clients /// in Servo that handles WebRender ExternalImages and the WebRender @@ -164,3 +167,14 @@ impl ExternalImageHandler for WebrenderExternalImageHandlers { }; } } + +pub trait WebRenderFontApi { + fn add_font_instance( + &self, + font_key: FontKey, + size: f32, + flags: FontInstanceFlags, + ) -> FontInstanceKey; + fn add_font(&self, data: Arc<Vec<u8>>, index: u32) -> FontKey; + fn add_system_font(&self, handle: NativeFontHandle) -> FontKey; +} diff --git a/components/webdriver_server/Cargo.toml b/components/webdriver_server/Cargo.toml index d67ef421693..d0871e205bf 100644 --- a/components/webdriver_server/Cargo.toml +++ b/components/webdriver_server/Cargo.toml @@ -11,6 +11,7 @@ name = "webdriver_server" path = "lib.rs" [dependencies] +base = { workspace = true } base64 = { workspace = true } compositing_traits = { workspace = true } cookie = { workspace = true } @@ -21,7 +22,6 @@ image = { workspace = true } ipc-channel = { workspace = true } keyboard-types = { workspace = true } log = { workspace = true } -msg = { workspace = true } net_traits = { workspace = true } pixels = { path = "../pixels" } script_traits = { workspace = true } diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 2793be805b1..6bdfb645c4e 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -16,6 +16,7 @@ use std::net::{SocketAddr, SocketAddrV4}; use std::time::Duration; use std::{fmt, mem, thread}; +use base::id::{BrowsingContextId, TopLevelBrowsingContextId}; use base64::Engine; use capabilities::ServoCapabilities; use compositing_traits::ConstellationMsg; @@ -27,14 +28,13 @@ use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; use keyboard_types::webdriver::send_keys; use log::{debug, info}; -use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, TraversalDirection}; use net_traits::request::Referrer; use pixels::PixelFormat; use script_traits::webdriver_msg::{ LoadStatus, WebDriverCookieError, WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue, WebDriverScriptCommand, }; -use script_traits::{LoadData, LoadOrigin, WebDriverCommandMsg}; +use script_traits::{LoadData, LoadOrigin, TraversalDirection, WebDriverCommandMsg}; use serde::de::{Deserializer, MapAccess, Visitor}; use serde::ser::Serializer; use serde::{Deserialize, Serialize}; diff --git a/components/webgpu/Cargo.toml b/components/webgpu/Cargo.toml index f9e0f9d7c7a..2926cef6fce 100644 --- a/components/webgpu/Cargo.toml +++ b/components/webgpu/Cargo.toml @@ -12,11 +12,11 @@ path = "lib.rs" [dependencies] arrayvec = { workspace = true, features = ["serde"] } +base = { workspace = true } euclid = { workspace = true } ipc-channel = { workspace = true } log = { workspace = true } malloc_size_of = { workspace = true } -msg = { workspace = true } serde = { workspace = true, features = ["serde_derive"] } servo_config = { path = "../config" } smallvec = { workspace = true, features = ["serde"] } diff --git a/components/webgpu/dom_messages.rs b/components/webgpu/dom_messages.rs index 6edd6f93e88..1bf37233ad6 100644 --- a/components/webgpu/dom_messages.rs +++ b/components/webgpu/dom_messages.rs @@ -7,8 +7,8 @@ use std::borrow::Cow; use arrayvec::ArrayVec; +use base::id::PipelineId; use ipc_channel::ipc::{IpcSender, IpcSharedMemory}; -use msg::constellation_msg::PipelineId; use serde::{Deserialize, Serialize}; use smallvec::SmallVec; use webrender_api::{ExternalImageId, ImageData, ImageDescriptor, ImageKey}; diff --git a/components/webgpu/script_messages.rs b/components/webgpu/script_messages.rs index 08e2269d39c..74a827d6dd1 100644 --- a/components/webgpu/script_messages.rs +++ b/components/webgpu/script_messages.rs @@ -4,7 +4,7 @@ //! IPC massages that are send to script thread (global scope). -use msg::constellation_msg::PipelineId; +use base::id::PipelineId; use serde::{Deserialize, Serialize}; use crate::identity::WebGPUDevice; diff --git a/components/webgpu/wgpu_thread.rs b/components/webgpu/wgpu_thread.rs index 372e8734f2b..9faec2eb5a4 100644 --- a/components/webgpu/wgpu_thread.rs +++ b/components/webgpu/wgpu_thread.rs @@ -10,10 +10,10 @@ use std::slice; use std::sync::{Arc, Mutex}; use arrayvec::ArrayVec; +use base::id::PipelineId; use euclid::default::Size2D; use ipc_channel::ipc::{IpcReceiver, IpcSender, IpcSharedMemory}; use log::{error, warn}; -use msg::constellation_msg::PipelineId; use webrender::{RenderApi, RenderApiSender, Transaction}; use webrender_api::{DirtyRect, DocumentId}; use webrender_traits::{WebrenderExternalImageRegistry, WebrenderImageHandlerType}; diff --git a/ports/jniapi/src/simpleservo.rs b/ports/jniapi/src/simpleservo.rs index d13fb2668ab..cf9a65bbe02 100644 --- a/ports/jniapi/src/simpleservo.rs +++ b/ports/jniapi/src/simpleservo.rs @@ -12,6 +12,7 @@ use std::rc::Rc; use getopts::Options; use ipc_channel::ipc::IpcSender; use log::{debug, info, warn}; +use servo::base::id::WebViewId; use servo::compositing::windowing::{ AnimationState, EmbedderCoordinates, EmbedderEvent, EmbedderMethods, MouseWindowEvent, WindowMethods, @@ -21,18 +22,17 @@ use servo::config::prefs::pref_map; pub use servo::config::prefs::{add_user_prefs, PrefValue}; use servo::embedder_traits::resources::{self, Resource, ResourceReaderMethods}; pub use servo::embedder_traits::{ - ContextMenuResult, MediaSessionPlaybackState, PermissionPrompt, PermissionRequest, PromptResult, + ContextMenuResult, InputMethodType, MediaSessionPlaybackState, PermissionPrompt, + PermissionRequest, PromptResult, }; use servo::embedder_traits::{ EmbedderMsg, EmbedderProxy, MediaSessionEvent, PromptDefinition, PromptOrigin, }; use servo::euclid::{Point2D, Rect, Scale, Size2D, Vector2D}; use servo::keyboard_types::{Key, KeyState, KeyboardEvent}; -pub use servo::msg::constellation_msg::InputMethodType; -use servo::msg::constellation_msg::{TraversalDirection, WebViewId}; use servo::rendering_context::RenderingContext; pub use servo::script_traits::{MediaSessionActionType, MouseButton}; -use servo::script_traits::{TouchEventType, TouchId}; +use servo::script_traits::{TouchEventType, TouchId, TraversalDirection}; use servo::servo_config::{opts, pref}; use servo::servo_url::ServoUrl; pub use servo::webrender_api::units::DeviceIntRect; diff --git a/ports/servoshell/minibrowser.rs b/ports/servoshell/minibrowser.rs index c76efee85c0..af2ce8e2d68 100644 --- a/ports/servoshell/minibrowser.rs +++ b/ports/servoshell/minibrowser.rs @@ -18,8 +18,8 @@ use gleam::gl; use glow::NativeFramebuffer; use log::{trace, warn}; use servo::compositing::windowing::EmbedderEvent; -use servo::msg::constellation_msg::TraversalDirection; use servo::rendering_context::RenderingContext; +use servo::script_traits::TraversalDirection; use servo::servo_geometry::DeviceIndependentPixel; use servo::servo_url::ServoUrl; use servo::style_traits::DevicePixel; diff --git a/ports/servoshell/webview.rs b/ports/servoshell/webview.rs index bbacdb1337d..87795f7a550 100644 --- a/ports/servoshell/webview.rs +++ b/ports/servoshell/webview.rs @@ -15,14 +15,15 @@ use euclid::{Point2D, Vector2D}; use gilrs::{EventType, Gilrs}; use keyboard_types::{Key, KeyboardEvent, Modifiers, ShortcutMatcher}; use log::{debug, error, info, trace, warn}; +use servo::base::id::TopLevelBrowsingContextId as WebViewId; use servo::compositing::windowing::{EmbedderEvent, WebRenderDebugOption}; use servo::embedder_traits::{ CompositorEventVariant, ContextMenuResult, EmbedderMsg, FilterPattern, PermissionPrompt, PermissionRequest, PromptDefinition, PromptOrigin, PromptResult, }; -use servo::msg::constellation_msg::{TopLevelBrowsingContextId as WebViewId, TraversalDirection}; use servo::script_traits::{ GamepadEvent, GamepadIndex, GamepadInputBounds, GamepadUpdateType, TouchEventType, + TraversalDirection, }; use servo::servo_config::opts; use servo::servo_url::ServoUrl; diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 22a3110902a..cf131f8b319 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -153,7 +153,6 @@ class MachCommands(CommandBase): "hyper_serde", "layout_2013", "layout_2020", - "msg", "net", "net_traits", "selectors", diff --git a/tests/unit/metrics/Cargo.toml b/tests/unit/metrics/Cargo.toml index 580d14cef5c..7f410d5701a 100644 --- a/tests/unit/metrics/Cargo.toml +++ b/tests/unit/metrics/Cargo.toml @@ -11,10 +11,10 @@ path = "lib.rs" doctest = false [dependencies] +base = { workspace = true } gfx_traits = { workspace = true } ipc-channel = { workspace = true } metrics = { path = "../../../components/metrics" } -msg = { workspace = true } profile_traits = { workspace = true } servo_url = { path = "../../../components/url" } time = { workspace = true } diff --git a/tests/unit/metrics/paint_time.rs b/tests/unit/metrics/paint_time.rs index 65316e09d16..fc708d3d5ab 100644 --- a/tests/unit/metrics/paint_time.rs +++ b/tests/unit/metrics/paint_time.rs @@ -2,10 +2,10 @@ * 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 gfx_traits::Epoch; +use base::id::TEST_PIPELINE_ID; +use base::Epoch; use ipc_channel::ipc; use metrics::{PaintTimeMetrics, ProfilerMetadataFactory, ProgressiveWebMetric}; -use msg::constellation_msg::TEST_PIPELINE_ID; use profile_traits::time::{ProfilerChan, TimerMetadata}; use servo_url::ServoUrl; |