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
|
@ -23,7 +23,6 @@ pub mod viewport_description;
|
|||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use base::generic_channel::GenericSender;
|
||||
use bitflags::bitflags;
|
||||
use display_list::CompositorDisplayListInfo;
|
||||
use embedder_traits::ScreenGeometry;
|
||||
|
@ -45,12 +44,7 @@ use crate::viewport_description::ViewportDescription;
|
|||
/// Sends messages to the compositor.
|
||||
#[derive(Clone)]
|
||||
pub struct CompositorProxy {
|
||||
/// A sender optimised for sending in the local process.
|
||||
/// The type is a Result to match the API of ipc_channel after routing,
|
||||
/// which contains a Result to propagate deserialization errors to the
|
||||
/// recipient.
|
||||
/// The field is private to hide the inner `Result` type.
|
||||
sender: Sender<Result<CompositorMsg, ipc_channel::Error>>,
|
||||
pub sender: Sender<CompositorMsg>,
|
||||
/// Access to [`Self::sender`] that is possible to send across an IPC
|
||||
/// channel. These messages are routed via the router thread to
|
||||
/// [`Self::sender`].
|
||||
|
@ -58,20 +52,6 @@ pub struct CompositorProxy {
|
|||
pub event_loop_waker: Box<dyn EventLoopWaker>,
|
||||
}
|
||||
|
||||
impl CompositorProxy {
|
||||
pub fn new(
|
||||
local_process_sender: Sender<Result<CompositorMsg, ipc_channel::Error>>,
|
||||
cross_process_compositor_api: CrossProcessCompositorApi,
|
||||
event_loop_waker: Box<dyn EventLoopWaker>,
|
||||
) -> Self {
|
||||
Self {
|
||||
sender: local_process_sender,
|
||||
cross_process_compositor_api,
|
||||
event_loop_waker,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl OpaqueSender<CompositorMsg> for CompositorProxy {
|
||||
fn send(&self, message: CompositorMsg) {
|
||||
CompositorProxy::send(self, message)
|
||||
|
@ -80,7 +60,7 @@ impl OpaqueSender<CompositorMsg> for CompositorProxy {
|
|||
|
||||
impl CompositorProxy {
|
||||
pub fn send(&self, msg: CompositorMsg) {
|
||||
if let Err(err) = self.sender.send(Ok(msg)) {
|
||||
if let Err(err) = self.sender.send(msg) {
|
||||
warn!("Failed to send response ({:?}).", err);
|
||||
}
|
||||
self.event_loop_waker.wake();
|
||||
|
@ -190,18 +170,18 @@ pub struct CompositionPipeline {
|
|||
|
||||
/// A mechanism to send messages from ScriptThread to the parent process' WebRender instance.
|
||||
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct CrossProcessCompositorApi(pub GenericSender<CompositorMsg>);
|
||||
pub struct CrossProcessCompositorApi(pub IpcSender<CompositorMsg>);
|
||||
|
||||
impl CrossProcessCompositorApi {
|
||||
/// Create a new [`CrossProcessCompositorApi`] struct that does not have a listener on the other
|
||||
/// end to use for unit testing.
|
||||
pub fn dummy() -> Self {
|
||||
let (sender, _) = base::generic_channel::channel().unwrap();
|
||||
let (sender, _) = ipc::channel().unwrap();
|
||||
Self(sender)
|
||||
}
|
||||
|
||||
/// Get the sender for this proxy.
|
||||
pub fn sender(&self) -> &GenericSender<CompositorMsg> {
|
||||
pub fn sender(&self) -> &IpcSender<CompositorMsg> {
|
||||
&self.0
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue