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

@ -20,7 +20,7 @@ use compositing_traits::{
CompositionPipeline, CompositorMsg, CompositorReceiver, SendableFrameTree,
};
use constellation_traits::{
AnimationTickType, CompositorHitTestResult, ConstellationMsg, PaintMetricEvent,
AnimationTickType, CompositorHitTestResult, EmbedderToConstellationMessage, PaintMetricEvent,
UntrustedNodeAddress, WindowSizeType,
};
use crossbeam_channel::Sender;
@ -101,7 +101,7 @@ pub struct ServoRenderer {
compositor_receiver: CompositorReceiver,
/// The channel on which messages can be sent to the constellation.
pub(crate) constellation_sender: Sender<ConstellationMsg>,
pub(crate) constellation_sender: Sender<EmbedderToConstellationMessage>,
/// The channel on which messages can be sent to the time profiler.
time_profiler_chan: profile_time::ProfilerChan,
@ -279,7 +279,7 @@ impl PipelineDetails {
tick_type.insert(AnimationTickType::REQUEST_ANIMATION_FRAME);
}
let msg = ConstellationMsg::TickAnimation(self.id, tick_type);
let msg = EmbedderToConstellationMessage::TickAnimation(self.id, tick_type);
if let Err(e) = compositor.global.borrow().constellation_sender.send(msg) {
warn!("Sending tick to constellation failed ({:?}).", e);
}
@ -415,7 +415,9 @@ impl ServoRenderer {
self.cursor = cursor;
if let Err(e) = self
.constellation_sender
.send(ConstellationMsg::SetCursor(webview_id, cursor))
.send(EmbedderToConstellationMessage::SetCursor(
webview_id, cursor,
))
{
warn!("Sending event to constellation failed ({:?}).", e);
}
@ -1261,7 +1263,7 @@ impl IOCompositor {
// to device pixels, but not including any pinch zoom.
let hidpi_scale_factor = self.device_pixels_per_page_pixel_not_including_page_zoom();
let size = rect.size().to_f32() / hidpi_scale_factor;
let msg = ConstellationMsg::ChangeViewportDetails(
let msg = EmbedderToConstellationMessage::ChangeViewportDetails(
webview_id,
ViewportDetails {
size,
@ -1420,7 +1422,7 @@ impl IOCompositor {
// Pass the pipeline/epoch states to the constellation and check
// if it's safe to output the image.
let msg = ConstellationMsg::IsReadyToSaveImage(pipeline_epochs);
let msg = EmbedderToConstellationMessage::IsReadyToSaveImage(pipeline_epochs);
if let Err(e) = self.global.borrow().constellation_sender.send(msg) {
warn!("Sending ready to save to constellation failed ({:?}).", e);
}
@ -1585,7 +1587,7 @@ impl IOCompositor {
PaintMetricState::Seen(epoch, first_reflow) if epoch <= current_epoch => {
assert!(epoch <= current_epoch);
if let Err(error) = self.global.borrow().constellation_sender.send(
ConstellationMsg::PaintMetric(
EmbedderToConstellationMessage::PaintMetric(
*pipeline_id,
PaintMetricEvent::FirstPaint(paint_time, first_reflow),
),
@ -1602,7 +1604,7 @@ impl IOCompositor {
match pipeline.first_contentful_paint_metric {
PaintMetricState::Seen(epoch, first_reflow) if epoch <= current_epoch => {
if let Err(error) = self.global.borrow().constellation_sender.send(
ConstellationMsg::PaintMetric(
EmbedderToConstellationMessage::PaintMetric(
*pipeline_id,
PaintMetricEvent::FirstContentfulPaint(paint_time, first_reflow),
),