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:
Martin Robinson 2025-04-02 00:59:50 +02:00 committed by GitHub
parent 0d38d6239a
commit 4402b7cf8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 95 additions and 206 deletions

View file

@ -17,7 +17,6 @@
//! a page runs its course and the script thread returns to processing events in the main event
//! loop.
use std::borrow::Cow;
use std::cell::{Cell, RefCell};
use std::collections::{HashMap, HashSet};
use std::default::Default;
@ -308,9 +307,6 @@ pub struct ScriptThread {
#[no_trace]
user_content_manager: UserContentManager,
/// An optional string allowing the user agent to be set for testing.
user_agent: Cow<'static, str>,
/// Application window's GL Context for Media player
#[no_trace]
player_context: WindowGLContext,
@ -390,7 +386,6 @@ impl ScriptThreadFactory for ScriptThread {
layout_factory: Arc<dyn LayoutFactory>,
system_font_service: Arc<SystemFontServiceProxy>,
load_data: LoadData,
user_agent: Cow<'static, str>,
) {
thread::Builder::new()
.name(format!("Script{:?}", state.id))
@ -408,8 +403,7 @@ impl ScriptThreadFactory for ScriptThread {
let memory_profiler_sender = state.memory_profiler_sender.clone();
let window_size = state.window_size;
let script_thread =
ScriptThread::new(state, layout_factory, system_font_service, user_agent);
let script_thread = ScriptThread::new(state, layout_factory, system_font_service);
SCRIPT_THREAD_ROOT.with(|root| {
root.set(Some(&script_thread as *const _));
@ -736,7 +730,6 @@ impl ScriptThread {
.pipeline_to_constellation_sender
.clone(),
image_cache: script_thread.image_cache.clone(),
user_agent: script_thread.user_agent.clone(),
#[cfg(feature = "webgpu")]
gpu_id_hub: script_thread.gpu_id_hub.clone(),
inherited_secure_context: script_thread.inherited_secure_context,
@ -826,7 +819,6 @@ impl ScriptThread {
state: InitialScriptState,
layout_factory: Arc<dyn LayoutFactory>,
system_font_service: Arc<SystemFontServiceProxy>,
user_agent: Cow<'static, str>,
) -> ScriptThread {
let (self_sender, self_receiver) = unbounded();
let runtime = Runtime::new(Some(SendableTaskSource {
@ -938,7 +930,6 @@ impl ScriptThread {
unminify_js: opts.unminify_js,
local_script_source: opts.local_script_source.clone(),
unminify_css: opts.unminify_css,
user_agent,
user_content_manager: state.user_content_manager,
player_context: state.player_context,
node_ids: Default::default(),
@ -3109,7 +3100,6 @@ impl ScriptThread {
self.unminify_css,
self.local_script_source.clone(),
self.user_content_manager.clone(),
self.user_agent.clone(),
self.player_context.clone(),
#[cfg(feature = "webgpu")]
self.gpu_id_hub.clone(),