mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +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
|
@ -11,6 +11,7 @@ use std::collections::HashSet;
|
|||
use std::ffi::c_void;
|
||||
use std::marker::Send;
|
||||
|
||||
use base::generic_channel::GenericSender;
|
||||
use crossbeam_channel::Sender;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
|
@ -49,6 +50,20 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> OpaqueSender<T> for GenericSender<T>
|
||||
where
|
||||
T: serde::Serialize,
|
||||
{
|
||||
fn send(&self, message: T) {
|
||||
if let Err(e) = GenericSender::send(self, message) {
|
||||
warn!(
|
||||
"Error communicating with the target thread from the profiler: {}",
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Front-end representation of the profiler used to communicate with the
|
||||
/// profiler.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue