mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #22948 - shanavas786:niko-master, r=jdm
Move RenderNotifier from compositing component to servo component <!-- Please describe your changes on the following line: --> I have absorbed #22713 into this. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #22707 <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22948) <!-- Reviewable:end -->
This commit is contained in:
commit
de3d2f7495
3 changed files with 45 additions and 43 deletions
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::compositor_thread::{CompositorProxy, CompositorReceiver};
|
use crate::compositor_thread::CompositorReceiver;
|
||||||
use crate::compositor_thread::{InitialCompositorState, Msg};
|
use crate::compositor_thread::{InitialCompositorState, Msg};
|
||||||
#[cfg(feature = "gl")]
|
#[cfg(feature = "gl")]
|
||||||
use crate::gl;
|
use crate::gl;
|
||||||
|
@ -249,45 +249,6 @@ enum CompositeTarget {
|
||||||
PngFile,
|
PngFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct RenderNotifier {
|
|
||||||
compositor_proxy: CompositorProxy,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RenderNotifier {
|
|
||||||
pub fn new(compositor_proxy: CompositorProxy) -> RenderNotifier {
|
|
||||||
RenderNotifier {
|
|
||||||
compositor_proxy: compositor_proxy,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl webrender_api::RenderNotifier for RenderNotifier {
|
|
||||||
fn clone(&self) -> Box<dyn webrender_api::RenderNotifier> {
|
|
||||||
Box::new(RenderNotifier::new(self.compositor_proxy.clone()))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn wake_up(&self) {
|
|
||||||
self.compositor_proxy
|
|
||||||
.recomposite(CompositingReason::NewWebRenderFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn new_frame_ready(
|
|
||||||
&self,
|
|
||||||
_document_id: webrender_api::DocumentId,
|
|
||||||
scrolled: bool,
|
|
||||||
composite_needed: bool,
|
|
||||||
_render_time_ns: Option<u64>,
|
|
||||||
) {
|
|
||||||
if scrolled {
|
|
||||||
self.compositor_proxy
|
|
||||||
.send(Msg::NewScrollFrameReady(composite_needed));
|
|
||||||
} else {
|
|
||||||
self.wake_up();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<Window: WindowMethods> IOCompositor<Window> {
|
impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
fn new(window: Rc<Window>, state: InitialCompositorState) -> Self {
|
fn new(window: Rc<Window>, state: InitialCompositorState) -> Self {
|
||||||
let composite_target = match opts::get().output_file {
|
let composite_target = match opts::get().output_file {
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
|
pub use crate::compositor::CompositingReason;
|
||||||
pub use crate::compositor::IOCompositor;
|
pub use crate::compositor::IOCompositor;
|
||||||
pub use crate::compositor::RenderNotifier;
|
|
||||||
pub use crate::compositor::ShutdownState;
|
pub use crate::compositor::ShutdownState;
|
||||||
pub use crate::compositor_thread::CompositorProxy;
|
pub use crate::compositor_thread::CompositorProxy;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
|
|
|
@ -65,9 +65,11 @@ use bluetooth::BluetoothThreadFactory;
|
||||||
use bluetooth_traits::BluetoothRequest;
|
use bluetooth_traits::BluetoothRequest;
|
||||||
use canvas::gl_context::GLContextFactory;
|
use canvas::gl_context::GLContextFactory;
|
||||||
use canvas::webgl_thread::WebGLThreads;
|
use canvas::webgl_thread::WebGLThreads;
|
||||||
use compositing::compositor_thread::{CompositorProxy, CompositorReceiver, InitialCompositorState};
|
use compositing::compositor_thread::{
|
||||||
|
CompositorProxy, CompositorReceiver, InitialCompositorState, Msg,
|
||||||
|
};
|
||||||
use compositing::windowing::{WindowEvent, WindowMethods};
|
use compositing::windowing::{WindowEvent, WindowMethods};
|
||||||
use compositing::{IOCompositor, RenderNotifier, ShutdownState};
|
use compositing::{CompositingReason, IOCompositor, ShutdownState};
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
not(target_os = "windows"),
|
not(target_os = "windows"),
|
||||||
not(target_os = "ios"),
|
not(target_os = "ios"),
|
||||||
|
@ -132,6 +134,45 @@ pub struct Servo<Window: WindowMethods + 'static> {
|
||||||
embedder_events: Vec<(Option<BrowserId>, EmbedderMsg)>,
|
embedder_events: Vec<(Option<BrowserId>, EmbedderMsg)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct RenderNotifier {
|
||||||
|
compositor_proxy: CompositorProxy,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RenderNotifier {
|
||||||
|
pub fn new(compositor_proxy: CompositorProxy) -> RenderNotifier {
|
||||||
|
RenderNotifier {
|
||||||
|
compositor_proxy: compositor_proxy,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl webrender_api::RenderNotifier for RenderNotifier {
|
||||||
|
fn clone(&self) -> Box<dyn webrender_api::RenderNotifier> {
|
||||||
|
Box::new(RenderNotifier::new(self.compositor_proxy.clone()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn wake_up(&self) {
|
||||||
|
self.compositor_proxy
|
||||||
|
.recomposite(CompositingReason::NewWebRenderFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_frame_ready(
|
||||||
|
&self,
|
||||||
|
_document_id: webrender_api::DocumentId,
|
||||||
|
scrolled: bool,
|
||||||
|
composite_needed: bool,
|
||||||
|
_render_time_ns: Option<u64>,
|
||||||
|
) {
|
||||||
|
if scrolled {
|
||||||
|
self.compositor_proxy
|
||||||
|
.send(Msg::NewScrollFrameReady(composite_needed));
|
||||||
|
} else {
|
||||||
|
self.wake_up();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<Window> Servo<Window>
|
impl<Window> Servo<Window>
|
||||||
where
|
where
|
||||||
Window: WindowMethods + 'static,
|
Window: WindowMethods + 'static,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue