Create a constellation_traits crate (#36088)

This change creates a `constellation_traits` crate. Previously messages
to the `Constellation` were in the `compositing_traits` crate, which
came about organically. This change moves these to a new crate which
also contains data types that are used in both compositing/libservo and
script (ie types that cross the process boundary). The idea is similar
to `embedding_traits`, but this is meant for types not exposed to the
API.

This change allows deduplicating `UntrustedNodeAddress`, which
previously had two versions to avoid circular dependencies.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-03-22 16:49:08 +01:00 committed by GitHub
parent 02375809b0
commit 7c574141c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 399 additions and 270 deletions

View file

@ -11,10 +11,9 @@ use base::id::{
MessagePortRouterId, PipelineId, ServiceWorkerId, ServiceWorkerRegistrationId, WebViewId,
};
use canvas_traits::canvas::{CanvasId, CanvasMsg};
use constellation_traits::{LogEntry, TraversalDirection};
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
use embedder_traits::{
EmbedderMsg, MediaSessionEvent, TouchEventType, TouchSequenceId, TraversalDirection,
};
use embedder_traits::{EmbedderMsg, MediaSessionEvent, TouchEventType, TouchSequenceId};
use euclid::Size2D;
use euclid::default::Size2D as UntypedSize2D;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
@ -55,19 +54,6 @@ pub enum TouchEventResult {
DefaultPrevented(TouchSequenceId, TouchEventType),
}
/// A log entry reported to the constellation
/// We don't report all log entries, just serious ones.
/// We need a separate type for this because `LogLevel` isn't serializable.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum LogEntry {
/// Panic, with a reason and backtrace
Panic(String, String),
/// Error, with a reason
Error(String),
/// warning, with a reason
Warn(String),
}
/// Messages from the script to the constellation.
#[derive(Deserialize, IntoStaticStr, Serialize)]
pub enum ScriptMsg {