compositor: Unify the cross process and in-process API (#36443)

Because there used to be two traits exposing messages to the compositor,
there were two kinds of messages that could be sent:

1. In-process messages from the `Constellation`
2. Cross-process messages from other parts of Servo

Now these two types of messages can be unified into one type. With that
done the compositor can simply keep a single `IpcReceiver` for all
messages, instead of having to set up a route for the cross-process
messsages. This decreases overhead of cross proceses messages a bit, but
more importantly solves an issue where Servo would rely on the
compositor's cross-process message route after the `Constellation` had
called `ROUTER.shutdown()`.

This is part of #36442.

Testing: This is covered by existing WPT tests.
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-12 23:38:22 +02:00 committed by GitHub
parent 5f0f457ac3
commit 4c55104b36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 95 additions and 215 deletions

View file

@ -8,10 +8,11 @@ use std::cell::Cell;
use std::rc::Rc;
use compositing_traits::rendering_context::RenderingContext;
use compositing_traits::{CompositorProxy, CompositorReceiver};
use compositing_traits::{CompositorMsg, CompositorProxy};
use constellation_traits::EmbedderToConstellationMessage;
use crossbeam_channel::Sender;
use embedder_traits::ShutdownState;
use ipc_channel::ipc::IpcReceiver;
use profile_traits::{mem, time};
use webrender::RenderApi;
use webrender_api::DocumentId;
@ -32,7 +33,7 @@ pub struct InitialCompositorState {
/// A channel to the compositor.
pub sender: CompositorProxy,
/// A port on which messages inbound to the compositor can be received.
pub receiver: CompositorReceiver,
pub receiver: IpcReceiver<CompositorMsg>,
/// A channel to the constellation.
pub constellation_chan: Sender<EmbedderToConstellationMessage>,
/// A channel to the time profiler thread.