mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
Port StorageThreadMsg to GenericChannel (#38932)
This change includes the following additions to GenericChannel: - Add a GenericSend trait which is meant to replace the `IpcSend` trait over time, as channels are migrated. For the time being this means, that we often need to use `GenericSend::send()` to disambiguate from the `IpcSend::send` function, until all usages of `IpcSend` have been replaced. - Add an OpaqueSender impl for GenericSender - Add a profiled version of GenericChannel. The profiling is 1:1 the same as for the existing profiled IPC channel, namely that only the blocked time during `recv` is measured. Testing: No functional changes, covered by existing tests Part of #38912 --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
parent
c4dcd17214
commit
32aba08be7
12 changed files with 113 additions and 27 deletions
|
@ -15,6 +15,18 @@ use serde::de::VariantAccess;
|
|||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use servo_config::opts;
|
||||
|
||||
/// Abstraction of the ability to send a particular type of message cross-process.
|
||||
/// This can be used to ease the use of GenericSender sub-fields.
|
||||
pub trait GenericSend<T>
|
||||
where
|
||||
T: serde::Serialize + for<'de> serde::Deserialize<'de>,
|
||||
{
|
||||
/// send message T
|
||||
fn send(&self, _: T) -> SendResult;
|
||||
/// get underlying sender
|
||||
fn sender(&self) -> GenericSender<T>;
|
||||
}
|
||||
|
||||
/// A GenericSender that sends messages to a [GenericReceiver].
|
||||
///
|
||||
/// The sender supports sending messages cross-process, if servo is run in multiprocess mode.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue