mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
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`.
This commit is contained in:
parent
1017533297
commit
3398fc017b
163 changed files with 709 additions and 632 deletions
|
@ -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 }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue