mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19: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
|
@ -10,6 +10,7 @@ use std::sync::{LazyLock, OnceLock};
|
|||
use std::thread::{self, JoinHandle};
|
||||
|
||||
use base::cross_process_instant::CrossProcessInstant;
|
||||
use base::generic_channel::{GenericSend, GenericSender, SendResult};
|
||||
use base::id::{CookieStoreId, HistoryStateId};
|
||||
use content_security_policy::{self as csp};
|
||||
use cookie::Cookie;
|
||||
|
@ -421,14 +422,14 @@ where
|
|||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ResourceThreads {
|
||||
pub core_thread: CoreResourceThread,
|
||||
storage_thread: IpcSender<StorageThreadMsg>,
|
||||
storage_thread: GenericSender<StorageThreadMsg>,
|
||||
idb_thread: IpcSender<IndexedDBThreadMsg>,
|
||||
}
|
||||
|
||||
impl ResourceThreads {
|
||||
pub fn new(
|
||||
c: CoreResourceThread,
|
||||
s: IpcSender<StorageThreadMsg>,
|
||||
s: GenericSender<StorageThreadMsg>,
|
||||
i: IpcSender<IndexedDBThreadMsg>,
|
||||
) -> ResourceThreads {
|
||||
ResourceThreads {
|
||||
|
@ -463,12 +464,12 @@ impl IpcSend<IndexedDBThreadMsg> for ResourceThreads {
|
|||
}
|
||||
}
|
||||
|
||||
impl IpcSend<StorageThreadMsg> for ResourceThreads {
|
||||
fn send(&self, msg: StorageThreadMsg) -> IpcSendResult {
|
||||
impl GenericSend<StorageThreadMsg> for ResourceThreads {
|
||||
fn send(&self, msg: StorageThreadMsg) -> SendResult {
|
||||
self.storage_thread.send(msg)
|
||||
}
|
||||
|
||||
fn sender(&self) -> IpcSender<StorageThreadMsg> {
|
||||
fn sender(&self) -> GenericSender<StorageThreadMsg> {
|
||||
self.storage_thread.clone()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use base::generic_channel::GenericSender;
|
||||
use base::id::WebViewId;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
|
@ -31,7 +32,7 @@ pub enum StorageThreadMsg {
|
|||
),
|
||||
|
||||
/// Gets the available keys in the associated storage data
|
||||
Keys(IpcSender<Vec<String>>, StorageType, WebViewId, ServoUrl),
|
||||
Keys(GenericSender<Vec<String>>, StorageType, WebViewId, ServoUrl),
|
||||
|
||||
/// gets the value associated with the given key in the associated storage data
|
||||
GetItem(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue