mirror of
https://github.com/servo/servo.git
synced 2025-08-29 17:18:23 +01:00
constellation: Migrate namespace channel to GenericChannel (#38913)
Migrates the namespace sender and receiver to use GenericChannel Testing: Covered by existing tests Part of #38912 Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
parent
e21ea2a135
commit
cf13fd4628
3 changed files with 13 additions and 14 deletions
|
@ -99,7 +99,7 @@ use background_hang_monitor::HangMonitorRegister;
|
|||
use background_hang_monitor_api::{
|
||||
BackgroundHangMonitorControlMsg, BackgroundHangMonitorRegister, HangMonitorAlert,
|
||||
};
|
||||
use base::generic_channel::GenericSender;
|
||||
use base::generic_channel::{GenericSender, RoutedReceiver};
|
||||
use base::id::{
|
||||
BrowsingContextGroupId, BrowsingContextId, HistoryStateId, MessagePortId, MessagePortRouterId,
|
||||
PipelineId, PipelineNamespace, PipelineNamespaceId, PipelineNamespaceRequest, WebViewId,
|
||||
|
@ -284,8 +284,8 @@ pub struct Constellation<STF, SWF> {
|
|||
/// An ipc-sender/threaded-receiver pair
|
||||
/// to facilitate installing pipeline namespaces in threads
|
||||
/// via a per-process installer.
|
||||
namespace_receiver: Receiver<Result<PipelineNamespaceRequest, IpcError>>,
|
||||
namespace_ipc_sender: IpcSender<PipelineNamespaceRequest>,
|
||||
namespace_receiver: RoutedReceiver<PipelineNamespaceRequest>,
|
||||
namespace_ipc_sender: GenericSender<PipelineNamespaceRequest>,
|
||||
|
||||
/// An IPC channel for script threads to send messages to the constellation.
|
||||
/// This is the script threads' view of `script_receiver`.
|
||||
|
@ -293,7 +293,7 @@ pub struct Constellation<STF, SWF> {
|
|||
|
||||
/// A channel for the constellation to receive messages from script threads.
|
||||
/// This is the constellation's view of `script_sender`.
|
||||
script_receiver: generic_channel::RoutedReceiver<(PipelineId, ScriptToConstellationMessage)>,
|
||||
script_receiver: RoutedReceiver<(PipelineId, ScriptToConstellationMessage)>,
|
||||
|
||||
/// A handle to register components for hang monitoring.
|
||||
/// None when in multiprocess mode.
|
||||
|
@ -610,11 +610,8 @@ where
|
|||
let script_receiver = script_ipc_receiver.route_preserving_errors();
|
||||
|
||||
let (namespace_ipc_sender, namespace_ipc_receiver) =
|
||||
ipc::channel().expect("ipc channel failure");
|
||||
let namespace_receiver =
|
||||
route_ipc_receiver_to_new_crossbeam_receiver_preserving_errors(
|
||||
namespace_ipc_receiver,
|
||||
);
|
||||
generic_channel::channel().expect("ipc channel failure");
|
||||
let namespace_receiver = namespace_ipc_receiver.route_preserving_errors();
|
||||
|
||||
let (background_hang_monitor_ipc_sender, background_hang_monitor_ipc_receiver) =
|
||||
ipc::channel().expect("ipc channel failure");
|
||||
|
|
|
@ -132,7 +132,7 @@ pub struct InitialPipelineState {
|
|||
pub script_to_constellation_chan: ScriptToConstellationChan,
|
||||
|
||||
/// A sender to request pipeline namespace ids.
|
||||
pub namespace_request_sender: IpcSender<PipelineNamespaceRequest>,
|
||||
pub namespace_request_sender: GenericSender<PipelineNamespaceRequest>,
|
||||
|
||||
/// A handle to register components for hang monitoring.
|
||||
/// None when in multiprocess mode.
|
||||
|
@ -470,7 +470,7 @@ pub struct UnprivilegedPipelineContent {
|
|||
browsing_context_id: BrowsingContextId,
|
||||
parent_pipeline_id: Option<PipelineId>,
|
||||
opener: Option<BrowsingContextId>,
|
||||
namespace_request_sender: IpcSender<PipelineNamespaceRequest>,
|
||||
namespace_request_sender: GenericSender<PipelineNamespaceRequest>,
|
||||
script_to_constellation_chan: ScriptToConstellationChan,
|
||||
background_hang_monitor_to_constellation_chan: IpcSender<HangMonitorAlert>,
|
||||
bhm_control_port: Option<IpcReceiver<BackgroundHangMonitorControlMsg>>,
|
||||
|
|
|
@ -19,6 +19,8 @@ use parking_lot::Mutex;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use webrender_api::{ExternalScrollId, PipelineId as WebRenderPipelineId};
|
||||
|
||||
use crate::generic_channel::GenericSender;
|
||||
|
||||
/// Asserts the size of a type at compile time.
|
||||
macro_rules! size_of_test {
|
||||
($t: ty, $expected_size: expr) => {
|
||||
|
@ -119,7 +121,7 @@ pub struct PipelineNamespaceRequest(pub IpcSender<PipelineNamespaceId>);
|
|||
|
||||
/// A per-process installer of pipeline-namespaces.
|
||||
pub struct PipelineNamespaceInstaller {
|
||||
request_sender: Option<IpcSender<PipelineNamespaceRequest>>,
|
||||
request_sender: Option<GenericSender<PipelineNamespaceRequest>>,
|
||||
namespace_sender: IpcSender<PipelineNamespaceId>,
|
||||
namespace_receiver: IpcReceiver<PipelineNamespaceId>,
|
||||
}
|
||||
|
@ -138,7 +140,7 @@ impl Default for PipelineNamespaceInstaller {
|
|||
|
||||
impl PipelineNamespaceInstaller {
|
||||
/// Provide a request sender to send requests to the constellation.
|
||||
pub fn set_sender(&mut self, sender: IpcSender<PipelineNamespaceRequest>) {
|
||||
pub fn set_sender(&mut self, sender: GenericSender<PipelineNamespaceRequest>) {
|
||||
self.request_sender = Some(sender);
|
||||
}
|
||||
|
||||
|
@ -207,7 +209,7 @@ impl PipelineNamespace {
|
|||
|
||||
/// Setup the pipeline-namespace-installer, by providing it with a sender to the constellation.
|
||||
/// Idempotent in single-process mode.
|
||||
pub fn set_installer_sender(sender: IpcSender<PipelineNamespaceRequest>) {
|
||||
pub fn set_installer_sender(sender: GenericSender<PipelineNamespaceRequest>) {
|
||||
PIPELINE_NAMESPACE_INSTALLER.lock().set_sender(sender);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue