mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
libservo: Remove a couple EmbedderMethods
(#36276)
- Remove `EmbedderMethods::get_user_agent_string`. This is now part of the `Preferences` data structure, which should allow it to be per-`WebView` in the future. - Remove `EmbedderMethods::get_version_string`. This was used to include some data along with WebRender captures about the Servo version. This isn't really necessary and it was done to replace code in the past that output the WebRender version, so also isn't what the original code did. I think we can just remove this entirely. The idea with these changes is that `EmbedderMethods` can be removed in a followup and the rest of the methods can be added to `ServoDelegate`. These two methods are ones that cannot be added to a delegate as they are used during `Servo` initialization. Testing: There is currently no testing for libservo. These changes are meant as preparation for adding a suite of `WebView` unit tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
0d38d6239a
commit
4402b7cf8f
27 changed files with 95 additions and 206 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! A thread that takes a URL and streams back the binary data.
|
||||
|
||||
use std::borrow::{Cow, ToOwned};
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
|
@ -71,7 +71,6 @@ fn load_root_cert_store_from_file(file_path: String) -> io::Result<RootCertStore
|
|||
/// Returns a tuple of (public, private) senders to the new threads.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new_resource_threads(
|
||||
user_agent: Cow<'static, str>,
|
||||
devtools_sender: Option<Sender<DevtoolsControlMsg>>,
|
||||
time_profiler_chan: ProfilerChan,
|
||||
mem_profiler_chan: MemProfilerChan,
|
||||
|
@ -93,7 +92,6 @@ pub fn new_resource_threads(
|
|||
};
|
||||
|
||||
let (public_core, private_core) = new_core_resource_thread(
|
||||
user_agent,
|
||||
devtools_sender,
|
||||
time_profiler_chan,
|
||||
mem_profiler_chan,
|
||||
|
@ -113,7 +111,6 @@ pub fn new_resource_threads(
|
|||
/// Create a CoreResourceThread
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new_core_resource_thread(
|
||||
user_agent: Cow<'static, str>,
|
||||
devtools_sender: Option<Sender<DevtoolsControlMsg>>,
|
||||
time_profiler_chan: ProfilerChan,
|
||||
mem_profiler_chan: MemProfilerChan,
|
||||
|
@ -131,7 +128,6 @@ pub fn new_core_resource_thread(
|
|||
.name("ResourceManager".to_owned())
|
||||
.spawn(move || {
|
||||
let resource_manager = CoreResourceManager::new(
|
||||
user_agent,
|
||||
devtools_sender,
|
||||
time_profiler_chan,
|
||||
embedder_proxy.clone(),
|
||||
|
@ -549,7 +545,6 @@ pub struct AuthCache {
|
|||
}
|
||||
|
||||
pub struct CoreResourceManager {
|
||||
user_agent: Cow<'static, str>,
|
||||
devtools_sender: Option<Sender<DevtoolsControlMsg>>,
|
||||
sw_managers: HashMap<ImmutableOrigin, IpcSender<CustomResponseMediator>>,
|
||||
filemanager: FileManager,
|
||||
|
@ -691,7 +686,6 @@ impl CoreResourceThreadPool {
|
|||
|
||||
impl CoreResourceManager {
|
||||
pub fn new(
|
||||
user_agent: Cow<'static, str>,
|
||||
devtools_sender: Option<Sender<DevtoolsControlMsg>>,
|
||||
_profiler_chan: ProfilerChan,
|
||||
embedder_proxy: EmbedderProxy,
|
||||
|
@ -705,7 +699,6 @@ impl CoreResourceManager {
|
|||
let pool = CoreResourceThreadPool::new(num_threads, "CoreResourceThreadPool".to_string());
|
||||
let pool_handle = Arc::new(pool);
|
||||
CoreResourceManager {
|
||||
user_agent,
|
||||
devtools_sender,
|
||||
sw_managers: Default::default(),
|
||||
filemanager: FileManager::new(embedder_proxy.clone(), Arc::downgrade(&pool_handle)),
|
||||
|
@ -749,7 +742,6 @@ impl CoreResourceManager {
|
|||
protocols: Arc<ProtocolRegistry>,
|
||||
) {
|
||||
let http_state = http_state.clone();
|
||||
let ua = self.user_agent.clone();
|
||||
let dc = self.devtools_sender.clone();
|
||||
let filemanager = self.filemanager.clone();
|
||||
let request_interceptor = self.request_interceptor.clone();
|
||||
|
@ -790,7 +782,7 @@ impl CoreResourceManager {
|
|||
// todo service worker stuff
|
||||
let context = FetchContext {
|
||||
state: http_state,
|
||||
user_agent: ua,
|
||||
user_agent: servo_config::pref!(user_agent),
|
||||
devtools_chan: dc.map(|dc| Arc::new(Mutex::new(dc))),
|
||||
filemanager: Arc::new(Mutex::new(filemanager)),
|
||||
file_token,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue