mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
This reverts commitfb1c0a4c48
. 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:
parent
26fb603d15
commit
c75995ec87
9 changed files with 42 additions and 96 deletions
|
@ -395,18 +395,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// A GenericChannel, which was routed via the Router.
|
||||
pub struct GenericRoutedChannel<T: Serialize + for<'de> Deserialize<'de>> {
|
||||
/// A GenericSender of the channel, i.e. it may be sent to other processes in multiprocess mode.
|
||||
/// Connected to `local_receiver` via the [ROUTER].
|
||||
pub generic_sender: GenericSender<T>,
|
||||
/// A sender that directly sends to the local_receiver. Can only be used in the same process
|
||||
/// as the `local_receiver`.
|
||||
pub local_sender: crossbeam_channel::Sender<Result<T, ipc_channel::Error>>,
|
||||
/// The receiving end of the channel. Only usable in the current process.
|
||||
pub local_receiver: RoutedReceiver<T>,
|
||||
}
|
||||
|
||||
/// Private helper function to create a crossbeam based channel.
|
||||
///
|
||||
/// Do NOT make this function public!
|
||||
|
@ -447,34 +435,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns a [GenericRoutedChannel], where the receiver is usable in the current process,
|
||||
/// and sending is possible both in remote and local process, via the generic_sender and the
|
||||
/// local_sender.
|
||||
pub fn routed_channel_with_local_sender<T>() -> Option<GenericRoutedChannel<T>>
|
||||
where
|
||||
T: for<'de> Deserialize<'de> + Serialize + Send + 'static,
|
||||
{
|
||||
let (crossbeam_sender, crossbeam_receiver) = crossbeam_channel::unbounded();
|
||||
let generic_sender = if opts::get().multiprocess || opts::get().force_ipc {
|
||||
let (ipc_sender, ipc_receiver) = ipc_channel::ipc::channel().ok()?;
|
||||
let crossbeam_sender_clone = crossbeam_sender.clone();
|
||||
ROUTER.add_typed_route(
|
||||
ipc_receiver,
|
||||
Box::new(move |message| {
|
||||
let _ = crossbeam_sender_clone.send(message);
|
||||
}),
|
||||
);
|
||||
GenericSender(GenericSenderVariants::Ipc(ipc_sender))
|
||||
} else {
|
||||
GenericSender(GenericSenderVariants::Crossbeam(crossbeam_sender.clone()))
|
||||
};
|
||||
Some(GenericRoutedChannel {
|
||||
generic_sender,
|
||||
local_sender: crossbeam_sender,
|
||||
local_receiver: crossbeam_receiver,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod single_process_channel_tests {
|
||||
//! These unit-tests test that ipc_channel and crossbeam_channel Senders and Receivers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue