Remove WebVR

This commit is contained in:
Alan Jeffrey 2020-04-07 16:05:36 -05:00
parent d8781c1054
commit c611e46381
74 changed files with 97 additions and 3178 deletions

View file

@ -59,7 +59,6 @@ lazy_static = "1"
libservo = {path = "../../components/servo"}
libc = "0.2"
log = "0.4"
rust-webvr = { version = "0.19", features = ["glwindow"] }
servo-media = {git = "https://github.com/servo/media"}
shellwords = "1.0.0"
tinyfiledialogs = "3.0"

View file

@ -65,7 +65,6 @@ impl App {
window.clone(),
events_loop.clone(),
window.gl(),
angle,
));
// Handle browser state.

View file

@ -4,20 +4,13 @@
//! Implements the global methods required by Servo (not window/gl/compositor related).
use crate::app;
use crate::events_loop::EventsLoop;
use crate::window_trait::WindowPortsMethods;
use gleam::gl;
use glutin;
use glutin::dpi::LogicalSize;
use glutin::EventsLoopClosed;
use rust_webvr::GlWindowVRService;
use servo::canvas::{SurfaceProviders, WebGlExecutor};
use servo::compositing::windowing::EmbedderMethods;
use servo::embedder_traits::{EmbedderProxy, EventLoopWaker};
use servo::servo_config::{opts, pref};
use servo::webvr::VRServiceManager;
use servo::webvr_traits::WebVRMainThreadHeartbeat;
use std::cell::RefCell;
use std::rc::Rc;
@ -25,7 +18,6 @@ pub struct EmbedderCallbacks {
window: Rc<dyn WindowPortsMethods>,
events_loop: Rc<RefCell<EventsLoop>>,
gl: Rc<dyn gl::Gl>,
angle: bool,
}
impl EmbedderCallbacks {
@ -33,13 +25,11 @@ impl EmbedderCallbacks {
window: Rc<dyn WindowPortsMethods>,
events_loop: Rc<RefCell<EventsLoop>>,
gl: Rc<dyn gl::Gl>,
angle: bool,
) -> EmbedderCallbacks {
EmbedderCallbacks {
window,
events_loop,
gl,
angle,
}
}
}
@ -49,47 +39,6 @@ impl EmbedderMethods for EmbedderCallbacks {
self.events_loop.borrow().create_event_loop_waker()
}
fn register_vr_services(
&mut self,
services: &mut VRServiceManager,
heartbeats: &mut Vec<Box<dyn WebVRMainThreadHeartbeat>>,
) {
if !opts::get().headless {
if pref!(dom.webvr.test) {
warn!("Creating test VR display");
// This is safe, because register_vr_services is called from the main thread.
let name = String::from("Test VR Display");
let size = opts::get().initial_window_size.to_f64();
let size = LogicalSize::new(size.width, size.height);
let events_loop_clone = self.events_loop.clone();
let events_loop_factory = Box::new(move || {
events_loop_clone
.borrow_mut()
.take()
.ok_or(EventsLoopClosed)
});
let window_builder = glutin::WindowBuilder::new()
.with_title(name.clone())
.with_dimensions(size)
.with_visibility(false)
.with_multitouch();
let context = glutin::ContextBuilder::new()
.with_gl(app::gl_version(self.angle))
.with_vsync(false) // Assume the browser vsync is the same as the test VR window vsync
.build_windowed(window_builder, &*self.events_loop.borrow().as_winit())
.expect("Failed to create window.");
let gl = self.gl.clone();
let (service, heartbeat) =
GlWindowVRService::new(name, context, events_loop_factory, gl);
services.register(Box::new(service));
heartbeats.push(Box::new(heartbeat));
}
} else {
// FIXME: support headless mode
}
}
fn register_webxr(
&mut self,
xr: &mut webxr::MainThreadRegistry,

View file

@ -62,12 +62,6 @@ impl EventsLoop {
panic!("Can't access winit event loop while using the fake headless event loop"),
}
}
pub fn take(&mut self) -> Option<glutin::EventsLoop> {
match self.0 {
EventLoop::Glutin(ref mut event_loop) => event_loop.take(),
EventLoop::Headless(..) => None,
}
}
pub fn poll_events<F>(&mut self, callback: F) where F: FnMut(glutin::Event) {
match self.0 {
EventLoop::Glutin(Some(ref mut events_loop)) => events_loop.poll_events(callback),

View file

@ -20,7 +20,6 @@ layout-2020 = ["simpleservo/layout-2020"]
[dependencies]
libservo = { path = "../../components/servo", features = ["no_static_freetype"] }
simpleservo = { path = "../libsimpleservo/api", features = ["no_static_freetype"] }
rust-webvr = { version = "0.19", features = ["magicleap"] }
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "magicleap"] }
libc = "0.2"

View file

@ -47,7 +47,6 @@ max_log_level = ["log/release_max_level_info"]
native-bluetooth = ["libservo/native-bluetooth"]
no_static_freetype = ["libservo/no_static_freetype"]
no-wgl = ["libservo/no-wgl"]
oculusvr = ["libservo/oculusvr"]
profilemozjs = ["libservo/profilemozjs"]
refcell_backtrace = ["libservo/refcell_backtrace"]
webdriver = ["libservo/webdriver"]

View file

@ -32,7 +32,6 @@ use servo::servo_config::{pref, set_pref};
use servo::servo_url::ServoUrl;
use servo::webrender_api::units::DevicePixel;
use servo::webrender_api::ScrollLocation;
use servo::webvr::{VRExternalShmemPtr, VRMainThreadHeartbeat, VRService, VRServiceManager};
use servo::{self, gl, BrowserId, Servo};
use servo_media::player::context as MediaPlayerContext;
use std::cell::RefCell;
@ -55,19 +54,12 @@ pub struct InitOptions {
pub url: Option<String>,
pub coordinates: Coordinates,
pub density: f32,
pub vr_init: VRInitOptions,
pub xr_discovery: Option<webxr::Discovery>,
pub enable_subpixel_text_antialiasing: bool,
pub gl_context_pointer: Option<*const c_void>,
pub native_display_pointer: Option<*const c_void>,
}
pub enum VRInitOptions {
None,
VRExternal(*mut c_void),
VRService(Box<dyn VRService>, Box<dyn VRMainThreadHeartbeat>),
}
#[derive(Clone, Debug)]
pub struct Coordinates {
pub viewport: Rect<i32, DevicePixel>,
@ -229,7 +221,6 @@ pub fn init(
});
let embedder_callbacks = Box::new(ServoEmbedderCallbacks {
vr_init: init_opts.vr_init,
xr_discovery: init_opts.xr_discovery,
waker,
gl: gl.clone(),
@ -727,7 +718,6 @@ impl ServoGlue {
struct ServoEmbedderCallbacks {
waker: Box<dyn EventLoopWaker>,
xr_discovery: Option<webxr::Discovery>,
vr_init: VRInitOptions,
#[allow(unused)]
gl: Rc<dyn gl::Gl>,
}
@ -742,24 +732,6 @@ struct ServoWindowCallbacks {
}
impl EmbedderMethods for ServoEmbedderCallbacks {
fn register_vr_services(
&mut self,
services: &mut VRServiceManager,
heartbeats: &mut Vec<Box<dyn VRMainThreadHeartbeat>>,
) {
debug!("EmbedderMethods::register_vrexternal");
match mem::replace(&mut self.vr_init, VRInitOptions::None) {
VRInitOptions::None => {},
VRInitOptions::VRExternal(ptr) => {
services.register_vrexternal(VRExternalShmemPtr::new(ptr));
},
VRInitOptions::VRService(service, heartbeat) => {
services.register(service);
heartbeats.push(heartbeat);
},
}
}
#[cfg(feature = "uwp")]
fn register_webxr(
&mut self,

View file

@ -41,7 +41,6 @@ layout-2020 = ["simpleservo/layout-2020"]
max_log_level = ["simpleservo/max_log_level"]
native-bluetooth = ["simpleservo/native-bluetooth"]
no-wgl = ["simpleservo/no-wgl"]
oculusvr = ["simpleservo/oculusvr"]
profilemozjs = ["simpleservo/profilemozjs"]
refcell_backtrace = ["simpleservo/refcell_backtrace"]
uwp = ["simpleservo/uwp"]

View file

@ -18,7 +18,7 @@ use log::LevelFilter;
use simpleservo::{self, gl_glue, ServoGlue, SERVO};
use simpleservo::{
ContextMenuResult, Coordinates, EventLoopWaker, HostTrait, InitOptions, MediaSessionActionType,
MediaSessionPlaybackState, MouseButton, PromptResult, VRInitOptions,
MediaSessionPlaybackState, MouseButton, PromptResult,
};
use std::ffi::{CStr, CString};
#[cfg(target_os = "windows")]
@ -242,7 +242,6 @@ pub struct CInitOptions {
pub width: i32,
pub height: i32,
pub density: f32,
pub vr_pointer: *mut c_void,
pub enable_subpixel_text_antialiasing: bool,
pub vslogger_mod_list: *const *const c_char,
pub vslogger_mod_size: u32,
@ -439,11 +438,6 @@ unsafe fn init(
url,
coordinates,
density: opts.density,
vr_init: if opts.vr_pointer.is_null() {
VRInitOptions::None
} else {
VRInitOptions::VRExternal(opts.vr_pointer)
},
xr_discovery: None,
enable_subpixel_text_antialiasing: opts.enable_subpixel_text_antialiasing,
gl_context_pointer: gl_context,

View file

@ -39,6 +39,5 @@ layout-2013 = ["simpleservo/layout-2013"]
layout-2020 = ["simpleservo/layout-2020"]
max_log_level = ["simpleservo/max_log_level"]
native-bluetooth = ["simpleservo/native-bluetooth"]
oculusvr = ["simpleservo/oculusvr"]
webdriver = ["simpleservo/webdriver"]
webgl_backtrace = ["simpleservo/webgl_backtrace"]