Fix servoshell can't respond when there's no minibrowser (#30598)

* Fix servoshell can't respond when there's no minibrowser

* Remove external_field and update documentation

* Update documentation

* Fix crash when handling ReadyToPresent if it's headless mode

* Fix some wpt tests got timedout
This commit is contained in:
Ngo Iok Ui (Wu Yu Wei) 2023-11-11 15:45:27 +09:00 committed by GitHub
parent d8e93fa408
commit 44d79269f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 43 deletions

View file

@ -240,10 +240,6 @@ pub struct IOCompositor<Window: WindowMethods + ?Sized> {
/// most up to date rendering.
waiting_on_pending_frame: bool,
/// Whether to send a ReadyToPresent message to the constellation after rendering a new frame,
/// allowing external code to draw to the framebuffer and decide when to present the frame.
external_present: bool,
/// Waiting for external code to call present.
waiting_on_present: bool,
}
@ -410,7 +406,6 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
exit_after_load,
convert_mouse_to_touch,
waiting_on_pending_frame: false,
external_present: false,
waiting_on_present: false,
}
}
@ -1858,17 +1853,14 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
_ => None,
};
// Perform the page flip. This will likely block for a while.
if self.external_present {
self.waiting_on_present = true;
let msg = ConstellationMsg::ReadyToPresent(
self.root_content_pipeline.top_level_browsing_context_id,
);
if let Err(e) = self.constellation_chan.send(msg) {
warn!("Sending event to constellation failed ({:?}).", e);
}
} else {
self.present();
// Nottify embedder that servo is ready to present.
// Embedder should call `present` to tell compositor to continue rendering.
self.waiting_on_present = true;
let msg = ConstellationMsg::ReadyToPresent(
self.root_content_pipeline.top_level_browsing_context_id,
);
if let Err(e) = self.constellation_chan.send(msg) {
warn!("Sending event to constellation failed ({:?}).", e);
}
self.composition_request = CompositionRequest::NoCompositingNecessary;
@ -1904,13 +1896,6 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
let gl = &self.webrender_gl;
self.assert_gl_framebuffer_complete();
if !self.external_present {
// Make framebuffer fully transparent.
gl.clear_color(0.0, 0.0, 0.0, 0.0);
gl.clear(gleam::gl::COLOR_BUFFER_BIT);
self.assert_gl_framebuffer_complete();
}
// Set the viewport background based on prefs.
let viewport = self.embedder_coordinates.get_flipped_viewport();
gl.scissor(
@ -2109,8 +2094,4 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
None => eprintln!("Unable to locate path to save captures"),
}
}
pub fn set_external_present(&mut self, value: bool) {
self.external_present = value;
}
}