mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Compositor: add document id to NewWebRenderFrame variant (#33597)
* Add document id to NewWebRenderFrame variant Signed-off-by: Wu Wayne <yuweiwu@pm.me> * Match the arguments order Signed-off-by: Wu Wayne <yuweiwu@pm.me> --------- Signed-off-by: Wu Wayne <yuweiwu@pm.me>
This commit is contained in:
parent
e534c7d461
commit
88dad77483
3 changed files with 14 additions and 9 deletions
|
@ -610,7 +610,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
let _ = sender.send(());
|
let _ = sender.send(());
|
||||||
},
|
},
|
||||||
|
|
||||||
CompositorMsg::NewWebRenderFrameReady(recomposite_needed) => {
|
CompositorMsg::NewWebRenderFrameReady(_document_id, recomposite_needed) => {
|
||||||
self.pending_frames -= 1;
|
self.pending_frames -= 1;
|
||||||
|
|
||||||
if recomposite_needed {
|
if recomposite_needed {
|
||||||
|
@ -991,7 +991,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CompositorMsg::NewWebRenderFrameReady(_) => {
|
CompositorMsg::NewWebRenderFrameReady(..) => {
|
||||||
// Subtract from the number of pending frames, but do not do any compositing.
|
// Subtract from the number of pending frames, but do not do any compositing.
|
||||||
self.pending_frames -= 1;
|
self.pending_frames -= 1;
|
||||||
},
|
},
|
||||||
|
@ -2378,12 +2378,12 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
let mut found_recomposite_msg = false;
|
let mut found_recomposite_msg = false;
|
||||||
while let Some(msg) = self.port.try_recv_compositor_msg() {
|
while let Some(msg) = self.port.try_recv_compositor_msg() {
|
||||||
match msg {
|
match msg {
|
||||||
CompositorMsg::NewWebRenderFrameReady(_) if found_recomposite_msg => {
|
CompositorMsg::NewWebRenderFrameReady(..) if found_recomposite_msg => {
|
||||||
// Only take one of duplicate NewWebRendeFrameReady messages, but do subtract
|
// Only take one of duplicate NewWebRendeFrameReady messages, but do subtract
|
||||||
// one frame from the pending frames.
|
// one frame from the pending frames.
|
||||||
self.pending_frames -= 1;
|
self.pending_frames -= 1;
|
||||||
},
|
},
|
||||||
CompositorMsg::NewWebRenderFrameReady(_) => {
|
CompositorMsg::NewWebRenderFrameReady(..) => {
|
||||||
found_recomposite_msg = true;
|
found_recomposite_msg = true;
|
||||||
compositor_messages.push(msg)
|
compositor_messages.push(msg)
|
||||||
},
|
},
|
||||||
|
@ -2437,7 +2437,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
pub fn repaint_synchronously(&mut self) {
|
pub fn repaint_synchronously(&mut self) {
|
||||||
while self.shutdown_state != ShutdownState::ShuttingDown {
|
while self.shutdown_state != ShutdownState::ShuttingDown {
|
||||||
let msg = self.port.recv_compositor_msg();
|
let msg = self.port.recv_compositor_msg();
|
||||||
let need_recomposite = matches!(msg, CompositorMsg::NewWebRenderFrameReady(_));
|
let need_recomposite = matches!(msg, CompositorMsg::NewWebRenderFrameReady(..));
|
||||||
let keep_going = self.handle_browser_message(msg);
|
let keep_going = self.handle_browser_message(msg);
|
||||||
if need_recomposite {
|
if need_recomposite {
|
||||||
self.composite();
|
self.composite();
|
||||||
|
|
|
@ -206,13 +206,16 @@ impl webrender_api::RenderNotifier for RenderNotifier {
|
||||||
|
|
||||||
fn new_frame_ready(
|
fn new_frame_ready(
|
||||||
&self,
|
&self,
|
||||||
_document_id: DocumentId,
|
document_id: DocumentId,
|
||||||
_scrolled: bool,
|
_scrolled: bool,
|
||||||
composite_needed: bool,
|
composite_needed: bool,
|
||||||
_frame_publish_id: FramePublishId,
|
_frame_publish_id: FramePublishId,
|
||||||
) {
|
) {
|
||||||
self.compositor_proxy
|
self.compositor_proxy
|
||||||
.send(CompositorMsg::NewWebRenderFrameReady(composite_needed));
|
.send(CompositorMsg::NewWebRenderFrameReady(
|
||||||
|
document_id,
|
||||||
|
composite_needed,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ use script_traits::{
|
||||||
};
|
};
|
||||||
use style_traits::CSSPixel;
|
use style_traits::CSSPixel;
|
||||||
use webrender_api::units::{DeviceIntPoint, DeviceIntSize, DeviceRect};
|
use webrender_api::units::{DeviceIntPoint, DeviceIntSize, DeviceRect};
|
||||||
|
use webrender_api::DocumentId;
|
||||||
use webrender_traits::{
|
use webrender_traits::{
|
||||||
CanvasToCompositorMsg, FontToCompositorMsg, NetToCompositorMsg, ScriptToCompositorMsg,
|
CanvasToCompositorMsg, FontToCompositorMsg, NetToCompositorMsg, ScriptToCompositorMsg,
|
||||||
};
|
};
|
||||||
|
@ -93,8 +94,9 @@ pub enum CompositorMsg {
|
||||||
/// Set whether to use less resources by stopping animations.
|
/// Set whether to use less resources by stopping animations.
|
||||||
SetThrottled(PipelineId, bool),
|
SetThrottled(PipelineId, bool),
|
||||||
/// WebRender has produced a new frame. This message informs the compositor that
|
/// WebRender has produced a new frame. This message informs the compositor that
|
||||||
/// the frame is ready, so that it may trigger a recomposite.
|
/// the frame is ready. It contains a bool to indicate if it needs to composite and the
|
||||||
NewWebRenderFrameReady(bool /* composite_needed */),
|
/// `DocumentId` of the new frame.
|
||||||
|
NewWebRenderFrameReady(DocumentId, bool),
|
||||||
/// A pipeline was shut down.
|
/// A pipeline was shut down.
|
||||||
// This message acts as a synchronization point between the constellation,
|
// This message acts as a synchronization point between the constellation,
|
||||||
// when it shuts down a pipeline, to the compositor; when the compositor
|
// when it shuts down a pipeline, to the compositor; when the compositor
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue