mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
compositor: Improve the way we wait for frames (#31523)
* compositor: Improve the way we wait for frames In the newest version of WebRender it will be harder to make the distinction between frame queued for scrolling and other kinds of pending frames. This change makes it so that we queue frames for both kinds of changes the same way and keeps a counting of pending frames. This is conceptually a lot simpler. In addition, do queue a composite even when recomposite isn't necessary for a WebRender frame when there are active requestAnimationFrame callbacks. Doing a composite is what triggers the callbacks to actually run in the script thread! I believe this was a bug, but the WebRender upgrade made it much more obvious. These changes are in preparation for the WebRender upgrade. * Remove spurious println
This commit is contained in:
parent
3098c3d121
commit
6005049d88
3 changed files with 74 additions and 98 deletions
|
@ -33,8 +33,8 @@ use canvas_traits::webgl::WebGLThreads;
|
|||
use compositing::windowing::{EmbedderEvent, EmbedderMethods, WindowMethods};
|
||||
use compositing::{CompositeTarget, IOCompositor, InitialCompositorState, ShutdownState};
|
||||
use compositing_traits::{
|
||||
CanvasToCompositorMsg, CompositingReason, CompositorMsg, CompositorProxy, CompositorReceiver,
|
||||
ConstellationMsg, FontToCompositorMsg, ForwardedToCompositorMsg,
|
||||
CanvasToCompositorMsg, CompositorMsg, CompositorProxy, CompositorReceiver, ConstellationMsg,
|
||||
FontToCompositorMsg, ForwardedToCompositorMsg,
|
||||
};
|
||||
#[cfg(all(
|
||||
not(target_os = "windows"),
|
||||
|
@ -198,26 +198,17 @@ impl webrender_api::RenderNotifier for RenderNotifier {
|
|||
Box::new(RenderNotifier::new(self.compositor_proxy.clone()))
|
||||
}
|
||||
|
||||
fn wake_up(&self, composite_needed: bool) {
|
||||
if composite_needed {
|
||||
self.compositor_proxy
|
||||
.recomposite(CompositingReason::NewWebRenderFrame);
|
||||
}
|
||||
}
|
||||
fn wake_up(&self, _composite_needed: bool) {}
|
||||
|
||||
fn new_frame_ready(
|
||||
&self,
|
||||
_document_id: DocumentId,
|
||||
scrolled: bool,
|
||||
_scrolled: bool,
|
||||
composite_needed: bool,
|
||||
_render_time_ns: Option<u64>,
|
||||
) {
|
||||
if scrolled {
|
||||
self.compositor_proxy
|
||||
.send(CompositorMsg::NewScrollFrameReady(composite_needed));
|
||||
} else {
|
||||
self.wake_up(true);
|
||||
}
|
||||
self.compositor_proxy
|
||||
.send(CompositorMsg::NewWebRenderFrameReady(composite_needed));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue