constellation: Rename messages sent to the Constellation (#36341)

Messages that are sent to the `Constellation` have pretty ambiguous
names.
This change does two renames:

- `ConstellationMsg` → `EmbedderToConstellationMessage`
- `ScriptMsg` → `ScriptToConstellationMessage`

This naming reflects that the `Constellation` stands in between the
embedding layer and the script layer and can receive messages from both.
Soon both of these message types will live in `constellation_traits`,
reflecting the idea that the `_traits` variant for a crate is
responsible for exposing the API for that crate.

Testing: No new tests are necessary here as this just renames two enums.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-04-04 21:39:38 +02:00 committed by GitHub
parent c7a7862574
commit 5a35e1faec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 415 additions and 364 deletions

View file

@ -62,7 +62,8 @@ use webrender_traits::CrossProcessCompositorApi;
pub use crate::script_msg::{
DOMMessage, IFrameSizeMsg, Job, JobError, JobResult, JobResultValue, JobType, SWManagerMsg,
SWManagerSenders, ScopeThings, ScriptMsg, ServiceWorkerMsg, TouchEventResult,
SWManagerSenders, ScopeThings, ScriptToConstellationMessage, ServiceWorkerMsg,
TouchEventResult,
};
use crate::serializable::{BlobImpl, DomPoint};
use crate::transferable::MessagePortImpl;
@ -634,14 +635,14 @@ pub struct DrawAPaintImageResult {
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ScriptToConstellationChan {
/// Sender for communicating with constellation thread.
pub sender: IpcSender<(PipelineId, ScriptMsg)>,
pub sender: IpcSender<(PipelineId, ScriptToConstellationMessage)>,
/// Used to identify the origin of the message.
pub pipeline_id: PipelineId,
}
impl ScriptToConstellationChan {
/// Send ScriptMsg and attach the pipeline_id to the message.
pub fn send(&self, msg: ScriptMsg) -> Result<(), IpcError> {
pub fn send(&self, msg: ScriptToConstellationMessage) -> Result<(), IpcError> {
self.sender.send((self.pipeline_id, msg))
}
}

View file

@ -54,9 +54,9 @@ pub enum TouchEventResult {
DefaultPrevented(TouchSequenceId, TouchEventType),
}
/// Messages from the script to the constellation.
/// Messages sent from the `ScriptThread` to the `Constellation`.
#[derive(Deserialize, IntoStaticStr, Serialize)]
pub enum ScriptMsg {
pub enum ScriptToConstellationMessage {
/// Request to complete the transfer of a set of ports to a router.
CompleteMessagePortTransfer(MessagePortRouterId, Vec<MessagePortId>),
/// The results of attempting to complete the transfer of a batch of ports.
@ -219,7 +219,7 @@ pub enum ScriptMsg {
ReportMemory(IpcSender<MemoryReportResult>),
}
impl fmt::Debug for ScriptMsg {
impl fmt::Debug for ScriptToConstellationMessage {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
let variant_string: &'static str = self.into();
write!(formatter, "ScriptMsg::{variant_string}")