mirror of
https://github.com/servo/servo.git
synced 2025-09-23 13:20:11 +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
|
@ -99,11 +99,12 @@ use background_hang_monitor::HangMonitorRegister;
|
|||
use background_hang_monitor_api::{
|
||||
BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, HangMonitorAlert,
|
||||
};
|
||||
use base::Epoch;
|
||||
use base::generic_channel::GenericSender;
|
||||
use base::id::{
|
||||
BrowsingContextGroupId, BrowsingContextId, HistoryStateId, MessagePortId, MessagePortRouterId,
|
||||
PipelineId, PipelineNamespace, PipelineNamespaceId, PipelineNamespaceRequest, WebViewId,
|
||||
};
|
||||
use base::{Epoch, generic_channel};
|
||||
#[cfg(feature = "bluetooth")]
|
||||
use bluetooth_traits::BluetoothRequest;
|
||||
use canvas::canvas_paint_thread::CanvasPaintThread;
|
||||
|
@ -288,11 +289,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: IpcSender<(PipelineId, ScriptToConstellationMessage)>,
|
||||
script_sender: GenericSender<(PipelineId, ScriptToConstellationMessage)>,
|
||||
|
||||
/// A channel for the constellation to receive messages from script threads.
|
||||
/// This is the constellation's view of `script_sender`.
|
||||
script_receiver: Receiver<Result<(PipelineId, ScriptToConstellationMessage), IpcError>>,
|
||||
script_receiver: generic_channel::RoutedReceiver<(PipelineId, ScriptToConstellationMessage)>,
|
||||
|
||||
/// A handle to register components for hang monitoring.
|
||||
/// None when in multiprocess mode.
|
||||
|
@ -605,11 +606,8 @@ where
|
|||
.name("Constellation".to_owned())
|
||||
.spawn(move || {
|
||||
let (script_ipc_sender, script_ipc_receiver) =
|
||||
ipc::channel().expect("ipc channel failure");
|
||||
let script_receiver =
|
||||
route_ipc_receiver_to_new_crossbeam_receiver_preserving_errors(
|
||||
script_ipc_receiver,
|
||||
);
|
||||
generic_channel::channel().expect("ipc channel failure");
|
||||
let script_receiver = script_ipc_receiver.route_preserving_errors();
|
||||
|
||||
let (namespace_ipc_sender, namespace_ipc_receiver) =
|
||||
ipc::channel().expect("ipc channel failure");
|
||||
|
@ -1243,7 +1241,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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue