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
|
@ -1,13 +1,12 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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::{GenericSend, SendResult};
|
||||
use base::id::WebViewId;
|
||||
use constellation_traits::ScriptToConstellationMessage;
|
||||
use dom_struct::dom_struct;
|
||||
use net_traits::storage_thread::{StorageThreadMsg, StorageType};
|
||||
use net_traits::{IpcSend, IpcSendResult};
|
||||
use profile_traits::ipc;
|
||||
use profile_traits::{generic_channel, ipc};
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::StorageBinding::StorageMethods;
|
||||
|
@ -57,8 +56,8 @@ impl Storage {
|
|||
self.global().get_url()
|
||||
}
|
||||
|
||||
fn send_storage_msg(&self, msg: StorageThreadMsg) -> IpcSendResult {
|
||||
self.global().resource_threads().send(msg)
|
||||
fn send_storage_msg(&self, msg: StorageThreadMsg) -> SendResult {
|
||||
GenericSend::send(self.global().resource_threads(), msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +172,8 @@ impl StorageMethods<crate::DomTypeHolder> for Storage {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#the-storage-interface:supported-property-names
|
||||
fn SupportedPropertyNames(&self) -> Vec<DOMString> {
|
||||
let (sender, receiver) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();
|
||||
let time_profiler = self.global().time_profiler_chan().clone();
|
||||
let (sender, receiver) = generic_channel::channel(time_profiler).unwrap();
|
||||
|
||||
self.send_storage_msg(StorageThreadMsg::Keys(
|
||||
sender,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use std::cell::Cell;
|
||||
use std::ptr;
|
||||
|
||||
use base::generic_channel::GenericSend;
|
||||
use base::id::{BrowsingContextId, PipelineId, WebViewId};
|
||||
use constellation_traits::{
|
||||
AuxiliaryWebViewCreationRequest, LoadData, LoadOrigin, NavigationHistoryBehavior,
|
||||
|
@ -32,7 +33,6 @@ use js::jsval::{NullValue, PrivateValue, UndefinedValue};
|
|||
use js::rust::wrappers::{JS_TransplantObject, NewWindowProxy, SetWindowProxy};
|
||||
use js::rust::{Handle, MutableHandle, MutableHandleValue, get_object_class};
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use net_traits::IpcSend;
|
||||
use net_traits::request::Referrer;
|
||||
use net_traits::storage_thread::StorageThreadMsg;
|
||||
use script_traits::NewLayoutInfo;
|
||||
|
@ -356,7 +356,7 @@ impl WindowProxy {
|
|||
dest: response.new_webview_id,
|
||||
};
|
||||
|
||||
document.global().resource_threads().send(msg).unwrap();
|
||||
GenericSend::send(document.global().resource_threads(), msg).unwrap();
|
||||
receiver.recv().unwrap();
|
||||
}
|
||||
Some(new_window_proxy)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue