aboutsummaryrefslogtreecommitdiffstats
path: root/components/constellation
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-05-17 14:28:58 +0200
committerGitHub <noreply@github.com>2024-05-17 12:28:58 +0000
commit3398fc017b994fff113342baab47718a44a37752 (patch)
tree9ec5881db059b0bda7d374ad4d0abe96319e5c25 /components/constellation
parent1017533297889beca40be5f121629347963fbf27 (diff)
downloadservo-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`.
Diffstat (limited to 'components/constellation')
-rw-r--r--components/constellation/Cargo.toml3
-rw-r--r--components/constellation/browsingcontext.rs4
-rw-r--r--components/constellation/constellation.rs20
-rw-r--r--components/constellation/logging.rs2
-rw-r--r--components/constellation/network_listener.rs2
-rw-r--r--components/constellation/pipeline.rs14
-rw-r--r--components/constellation/session_history.rs4
-rw-r--r--components/constellation/webview.rs4
8 files changed, 27 insertions, 26 deletions
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,
};