Revert "GenericChannel: Migrate compositor channels to GenericChannel (#38782)" (#38940)

This reverts commit fb1c0a4c48.

Previously in `create_compositor_channel`, the [routing callback][1] was
setup so that a message received on the Compositor's IPC receiver will
be
forwarded to the local receiver using the `CompositorProxy` which also
takes care of waking up the event loop. In #38782, this was changed so
that the routing callbacks simply forwards the message directly without
going via the `CompositorProxy`. This breaks behaviours that rely on the
event loop being woken up on message sending, e.g. updating image frames
for animated gifs.

Since the GenericChannel API doesn't allow custom routing callbacks,
revert this change until we figure out a better solution.

[1]:
d2ccce6052/components/servo/lib.rs (L1114)

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2025-08-26 19:46:58 +05:30 committed by GitHub
parent 26fb603d15
commit c75995ec87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 42 additions and 96 deletions

View file

@ -290,11 +290,11 @@ pub struct Constellation<STF, SWF> {
/// An IPC channel for script threads to send messages to the constellation.
/// This is the script threads' view of `script_receiver`.
script_sender: GenericSender<(PipelineId, ScriptToConstellationMessage)>,
script_sender: IpcSender<(PipelineId, ScriptToConstellationMessage)>,
/// A channel for the constellation to receive messages from script threads.
/// This is the constellation's view of `script_sender`.
script_receiver: RoutedReceiver<(PipelineId, ScriptToConstellationMessage)>,
script_receiver: Receiver<Result<(PipelineId, ScriptToConstellationMessage), IpcError>>,
/// A handle to register components for hang monitoring.
/// None when in multiprocess mode.
@ -607,8 +607,11 @@ where
.name("Constellation".to_owned())
.spawn(move || {
let (script_ipc_sender, script_ipc_receiver) =
generic_channel::channel().expect("ipc channel failure");
let script_receiver = script_ipc_receiver.route_preserving_errors();
ipc::channel().expect("ipc channel failure");
let script_receiver =
route_ipc_receiver_to_new_crossbeam_receiver_preserving_errors(
script_ipc_receiver,
);
let (namespace_ipc_sender, namespace_ipc_receiver) =
generic_channel::channel().expect("ipc channel failure");
@ -1243,7 +1246,7 @@ where
let request = match request {
Ok(request) => request,
Err(err) => return error!("Deserialization failed ({err:?})."),
Err(err) => return error!("Deserialization failed ({}).", err),
};
match request {