aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-02-28 09:29:10 -0500
committerGitHub <noreply@github.com>2019-02-28 09:29:10 -0500
commitde3d2f74951bf0c0834dfda8837d934b3e88aff2 (patch)
tree85258841f14a15d43b2c5eab29648d58bb4072ba
parentfd07be1cefa7c96ec15bcb16e21dbb0558627d3d (diff)
parent0b8deed28ad61fc3ba3b933e96dd2829aadaf41e (diff)
downloadservo-de3d2f74951bf0c0834dfda8837d934b3e88aff2.tar.gz
servo-de3d2f74951bf0c0834dfda8837d934b3e88aff2.zip
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 -->
-rw-r--r--components/compositing/compositor.rs41
-rw-r--r--components/compositing/lib.rs2
-rw-r--r--components/servo/lib.rs45
3 files changed, 45 insertions, 43 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs
index 89f185beadb..253fc1cb925 100644
--- a/components/compositing/compositor.rs
+++ b/components/compositing/compositor.rs
@@ -2,7 +2,7 @@
* 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/. */
-use crate::compositor_thread::{CompositorProxy, CompositorReceiver};
+use crate::compositor_thread::CompositorReceiver;
use crate::compositor_thread::{InitialCompositorState, Msg};
#[cfg(feature = "gl")]
use crate::gl;
@@ -249,45 +249,6 @@ enum CompositeTarget {
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> {
fn new(window: Rc<Window>, state: InitialCompositorState) -> Self {
let composite_target = match opts::get().output_file {
diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs
index 8ffbb9196b2..49b2ab7bf70 100644
--- a/components/compositing/lib.rs
+++ b/components/compositing/lib.rs
@@ -7,8 +7,8 @@
#[macro_use]
extern crate log;
+pub use crate::compositor::CompositingReason;
pub use crate::compositor::IOCompositor;
-pub use crate::compositor::RenderNotifier;
pub use crate::compositor::ShutdownState;
pub use crate::compositor_thread::CompositorProxy;
use ipc_channel::ipc::IpcSender;
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 16fb675cfe4..0eed4aa6c1d 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -65,9 +65,11 @@ use bluetooth::BluetoothThreadFactory;
use bluetooth_traits::BluetoothRequest;
use canvas::gl_context::GLContextFactory;
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::{IOCompositor, RenderNotifier, ShutdownState};
+use compositing::{CompositingReason, IOCompositor, ShutdownState};
#[cfg(all(
not(target_os = "windows"),
not(target_os = "ios"),
@@ -132,6 +134,45 @@ pub struct Servo<Window: WindowMethods + 'static> {
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>
where
Window: WindowMethods + 'static,