mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
script: Migrate swmanager to GenericChannel (#39076)
Migrate `ServiceWorkerMsg` and `SWManagerMsg` to GenericChannel Testing: Covered by service worker wpt tests Part of #38912 Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
parent
93aeac056b
commit
ce8b05738c
6 changed files with 44 additions and 34 deletions
|
@ -252,6 +252,16 @@ impl From<crossbeam_channel::TryRecvError> for TryReceiveError {
|
|||
pub type RoutedReceiver<T> = crossbeam_channel::Receiver<Result<T, ipc_channel::Error>>;
|
||||
pub type ReceiveResult<T> = Result<T, ReceiveError>;
|
||||
pub type TryReceiveResult<T> = Result<T, TryReceiveError>;
|
||||
pub type RoutedReceiverReceiveResult<T> =
|
||||
Result<Result<T, ipc_channel::Error>, crossbeam_channel::RecvError>;
|
||||
|
||||
pub fn to_receive_result<T>(receive_result: RoutedReceiverReceiveResult<T>) -> ReceiveResult<T> {
|
||||
match receive_result {
|
||||
Ok(Ok(msg)) => Ok(msg),
|
||||
Err(_crossbeam_recv_err) => Err(ReceiveError::Disconnected),
|
||||
Ok(Err(ipc_err)) => Err(ReceiveError::DeserializationFailed(ipc_err.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
pub struct GenericReceiver<T>(GenericReceiverVariants<T>)
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue