mirror of
https://github.com/servo/servo.git
synced 2025-09-27 15:20:09 +01:00
Port ScriptToConstellation channel to generic channel (#38990)
This change was previously part of
fb1c0a4c48
, which got reverted due to an
issue
with the compositor channel.
Split this change out into a separate PR, as it probably should have
been in the first place. Presumably it was one change before, since
serialization of crossbeam generic channels in single-process mode was
not implemented yet at the time.
Testing: Covered by existing tests. No custom callbacks involved.
Part of #38912
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
parent
c4a69abe30
commit
20e955277a
4 changed files with 9 additions and 11 deletions
|
@ -8,6 +8,7 @@ use std::collections::HashMap;
|
|||
use std::fmt;
|
||||
|
||||
use base::Epoch;
|
||||
use base::generic_channel::{GenericSender, SendResult};
|
||||
use base::id::{
|
||||
BroadcastChannelRouterId, BrowsingContextId, HistoryStateId, MessagePortId,
|
||||
MessagePortRouterId, PipelineId, ServiceWorkerId, ServiceWorkerRegistrationId, WebViewId,
|
||||
|
@ -23,7 +24,6 @@ use embedder_traits::{
|
|||
use euclid::default::Size2D as UntypedSize2D;
|
||||
use fonts_traits::SystemFontServiceProxySender;
|
||||
use http::{HeaderMap, Method};
|
||||
use ipc_channel::Error as IpcError;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use net_traits::policy_container::PolicyContainer;
|
||||
|
@ -48,14 +48,14 @@ use crate::{
|
|||
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct ScriptToConstellationChan {
|
||||
/// Sender for communicating with constellation thread.
|
||||
pub sender: IpcSender<(PipelineId, ScriptToConstellationMessage)>,
|
||||
pub sender: GenericSender<(PipelineId, ScriptToConstellationMessage)>,
|
||||
/// Used to identify the origin of the message.
|
||||
pub pipeline_id: PipelineId,
|
||||
}
|
||||
|
||||
impl ScriptToConstellationChan {
|
||||
/// Send ScriptMsg and attach the pipeline_id to the message.
|
||||
pub fn send(&self, msg: ScriptToConstellationMessage) -> Result<(), IpcError> {
|
||||
pub fn send(&self, msg: ScriptToConstellationMessage) -> SendResult {
|
||||
self.sender.send((self.pipeline_id, msg))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue