Remove type parameter from Servo and IOCompositor (#35121) (#35156)

* Remove type parameter from Servo and IOCompositor (#35121)

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* Fix compile error in libservo example

Signed-off-by: Delan Azabani <dazabani@igalia.com>

* Fix compile error in servoshell

Signed-off-by: Delan Azabani <dazabani@igalia.com>

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Delan Azabani 2025-01-24 15:41:21 +08:00 committed by GitHub
parent b95fa5ddd6
commit 8976f2420c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 28 additions and 21 deletions

View file

@ -97,9 +97,9 @@ impl FrameTreeId {
}
/// NB: Never block on the constellation, because sometimes the constellation blocks on us.
pub struct IOCompositor<Window: WindowMethods + ?Sized> {
pub struct IOCompositor {
/// The application window.
pub window: Rc<Window>,
pub window: Rc<dyn WindowMethods>,
/// The port on which we receive messages.
port: CompositorReceiver,
@ -356,9 +356,9 @@ pub enum CompositeTarget {
PngFile(Rc<String>),
}
impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
impl IOCompositor {
pub fn new(
window: Rc<Window>,
window: Rc<dyn WindowMethods>,
state: InitialCompositorState,
composite_target: CompositeTarget,
exit_after_load: bool,

View file

@ -44,7 +44,7 @@ enum App {
Initial(Waker),
Running {
window_delegate: Rc<WindowDelegate>,
servo: Servo<WindowDelegate>,
servo: Servo,
},
Exiting,
}

View file

@ -176,8 +176,8 @@ mod media_platform {
/// application Servo is embedded in. Clients then create an event
/// loop to pump messages between the embedding application and
/// various browser components.
pub struct Servo<Window: WindowMethods + 'static + ?Sized> {
compositor: IOCompositor<Window>,
pub struct Servo {
compositor: IOCompositor,
constellation_chan: Sender<ConstellationMsg>,
embedder_receiver: EmbedderReceiver,
messages_for_embedder: Vec<(Option<TopLevelBrowsingContextId>, EmbedderMsg)>,
@ -221,10 +221,7 @@ impl webrender_api::RenderNotifier for RenderNotifier {
}
}
impl<Window> Servo<Window>
where
Window: WindowMethods + 'static + ?Sized,
{
impl Servo {
#[cfg_attr(
feature = "tracing",
tracing::instrument(
@ -233,16 +230,15 @@ where
level = "trace",
)
)]
#[allow(clippy::new_ret_no_self)]
pub fn new(
opts: Opts,
preferences: Preferences,
rendering_context: Rc<dyn RenderingContext>,
mut embedder: Box<dyn EmbedderMethods>,
window: Rc<Window>,
window: Rc<dyn WindowMethods>,
user_agent: Option<String>,
composite_target: CompositeTarget,
) -> Servo<Window> {
) -> Self {
// Global configuration options, parsed from the command line.
opts::set_options(opts);
let opts = opts::get();
@ -982,7 +978,7 @@ where
log::set_max_level(filter);
}
pub fn window(&self) -> &Window {
pub fn window(&self) -> &Rc<dyn WindowMethods> {
&self.compositor.window
}