aboutsummaryrefslogtreecommitdiffstats
path: root/components/servo/lib.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-04-29 10:45:29 -0400
committerGitHub <noreply@github.com>2019-04-29 10:45:29 -0400
commita9f7b132303f7c02648043df5ebdc25726bd3f88 (patch)
treeeee887c8856ce5a5973e2b1650c6a9bccb7bebe6 /components/servo/lib.rs
parent799490a02e9bea575bf34c39f045ef0883539f05 (diff)
parent21ed7653f491d9e378aa7a334b40e7327f4bfc90 (diff)
downloadservo-a9f7b132303f7c02648043df5ebdc25726bd3f88.tar.gz
servo-a9f7b132303f7c02648043df5ebdc25726bd3f88.zip
Auto merge of #23233 - paulrouget:glutin-port-refactoring, r=jdm
Glutin port refactoring Glutin port refactoring in preparation for the compositor and libservo refactoring. In theory, the only behavior change is for headless mode. The headless event loop now uses winit's event loop (but still headless). Notes: - headless and glutin window implementations are now separated - I split the methods of the embedder in 2: window specific and general methods. In the future, we still want the app to run even without a window or with multiple windows <!-- 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/23233) <!-- Reviewable:end -->
Diffstat (limited to 'components/servo/lib.rs')
-rw-r--r--components/servo/lib.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index d919613c9c0..d3d8d8eb1cb 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -67,7 +67,7 @@ use canvas::webgl_thread::WebGLThreads;
use compositing::compositor_thread::{
CompositorProxy, CompositorReceiver, InitialCompositorState, Msg,
};
-use compositing::windowing::{WindowEvent, WindowMethods};
+use compositing::windowing::{EmbedderMethods, WindowEvent, WindowMethods};
use compositing::{CompositingReason, IOCompositor, ShutdownState};
#[cfg(all(
not(target_os = "windows"),
@@ -148,7 +148,7 @@ type MediaBackend = media_platform::MediaBackend;
/// application Servo is embedded in. Clients then create an event
/// loop to pump messages between the embedding application and
/// various browser components.
-pub struct Servo<Window: WindowMethods + 'static> {
+pub struct Servo<Window: WindowMethods + 'static + ?Sized> {
compositor: IOCompositor<Window>,
constellation_chan: Sender<ConstellationMsg>,
embedder_receiver: EmbedderReceiver,
@@ -197,9 +197,9 @@ impl webrender_api::RenderNotifier for RenderNotifier {
impl<Window> Servo<Window>
where
- Window: WindowMethods + 'static,
+ Window: WindowMethods + 'static + ?Sized,
{
- pub fn new(window: Rc<Window>) -> Servo<Window> {
+ pub fn new(embedder: Box<EmbedderMethods>, window: Rc<Window>) -> Servo<Window> {
// Global configuration options, parsed from the command line.
let opts = opts::get();
@@ -218,9 +218,9 @@ where
// messages to client may need to pump a platform-specific event loop
// to deliver the message.
let (compositor_proxy, compositor_receiver) =
- create_compositor_channel(window.create_event_loop_waker());
+ create_compositor_channel(embedder.create_event_loop_waker());
let (embedder_proxy, embedder_receiver) =
- create_embedder_channel(window.create_event_loop_waker());
+ create_embedder_channel(embedder.create_event_loop_waker());
let time_profiler_chan = profile_time::Profiler::create(
&opts.time_profiling,
opts.time_profiler_trace_path.clone(),
@@ -288,7 +288,7 @@ where
let webvr_services = if pref!(dom.webvr.enabled) {
let mut services = VRServiceManager::new();
services.register_defaults();
- window.register_vr_services(&mut services, &mut webvr_heartbeats);
+ embedder.register_vr_services(&mut services, &mut webvr_heartbeats);
Some(services)
} else {
None