mirror of
https://github.com/servo/servo.git
synced 2025-09-27 15:20:09 +01:00
GenericChannel: Migrate compositor channels to GenericChannel (#38782)
Besides migrating the channel to GenericChannel, this PR adds `routed_channel_with_local_sender()` to `generic_channel`. This is for existing use-cases, where we want to provide both an IPC capable GenericSender, as well as a crossbeam Sender, for efficient sending if the sender is in the same process. Testing: All of our channels should send / receive at least some messages during WPT tests. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
parent
7441944e36
commit
fb1c0a4c48
9 changed files with 98 additions and 43 deletions
|
@ -11,9 +11,9 @@ use std::rc::Rc;
|
|||
use std::sync::Arc;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use base::Epoch;
|
||||
use base::cross_process_instant::CrossProcessInstant;
|
||||
use base::id::{PipelineId, WebViewId};
|
||||
use base::{Epoch, generic_channel};
|
||||
use bitflags::bitflags;
|
||||
use compositing_traits::display_list::{CompositorDisplayListInfo, ScrollTree, ScrollType};
|
||||
use compositing_traits::rendering_context::RenderingContext;
|
||||
|
@ -22,7 +22,7 @@ use compositing_traits::{
|
|||
WebViewTrait,
|
||||
};
|
||||
use constellation_traits::{EmbedderToConstellationMessage, PaintMetricEvent};
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use crossbeam_channel::Sender;
|
||||
use dpi::PhysicalSize;
|
||||
use embedder_traits::{CompositorHitTestResult, InputEvent, ShutdownState, ViewportDetails};
|
||||
use euclid::{Point2D, Rect, Scale, Size2D, Transform3D};
|
||||
|
@ -90,7 +90,7 @@ pub struct ServoRenderer {
|
|||
shutdown_state: Rc<Cell<ShutdownState>>,
|
||||
|
||||
/// The port on which we receive messages.
|
||||
compositor_receiver: Receiver<CompositorMsg>,
|
||||
compositor_receiver: generic_channel::RoutedReceiver<CompositorMsg>,
|
||||
|
||||
/// The channel on which messages can be sent to the constellation.
|
||||
pub(crate) constellation_sender: Sender<EmbedderToConstellationMessage>,
|
||||
|
@ -1377,7 +1377,7 @@ impl IOCompositor {
|
|||
}
|
||||
|
||||
/// Get the message receiver for this [`IOCompositor`].
|
||||
pub fn receiver(&self) -> Ref<'_, Receiver<CompositorMsg>> {
|
||||
pub fn receiver(&self) -> Ref<'_, generic_channel::RoutedReceiver<CompositorMsg>> {
|
||||
Ref::map(self.global.borrow(), |global| &global.compositor_receiver)
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,11 @@
|
|||
use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use base::generic_channel;
|
||||
use compositing_traits::rendering_context::RenderingContext;
|
||||
use compositing_traits::{CompositorMsg, CompositorProxy};
|
||||
use constellation_traits::EmbedderToConstellationMessage;
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use crossbeam_channel::Sender;
|
||||
use embedder_traits::{EventLoopWaker, ShutdownState};
|
||||
use profile_traits::{mem, time};
|
||||
use webrender::RenderApi;
|
||||
|
@ -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: Receiver<CompositorMsg>,
|
||||
pub receiver: generic_channel::RoutedReceiver<CompositorMsg>,
|
||||
/// A channel to the constellation.
|
||||
pub constellation_chan: Sender<EmbedderToConstellationMessage>,
|
||||
/// A channel to the time profiler thread.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue