mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
servoshell: Fix --no-default-features and make webxr optional on ohos/android (#34242)
* servoshell: fix --no-default-features The Embeddertraits only contain `register_webxr` if the webxr feature is enabled, hence we also need to guard the trait implementation. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> * ohos/android: Make webxr optional in servoshell Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
parent
47a243614f
commit
6b6697e97b
5 changed files with 16 additions and 4 deletions
|
@ -39,7 +39,7 @@ ProductName = "Servo"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
debugmozjs = ["libservo/debugmozjs"]
|
debugmozjs = ["libservo/debugmozjs"]
|
||||||
default = ["layout_2013", "max_log_level", "webdriver", "libservo/webxr"]
|
default = ["layout_2013", "max_log_level", "webdriver", "webxr"]
|
||||||
jitspew = ["libservo/jitspew"]
|
jitspew = ["libservo/jitspew"]
|
||||||
js_backtrace = ["libservo/js_backtrace"]
|
js_backtrace = ["libservo/js_backtrace"]
|
||||||
layout_2013 = ["libservo/layout_2013"]
|
layout_2013 = ["libservo/layout_2013"]
|
||||||
|
@ -54,6 +54,7 @@ tracing-hitrace = ["tracing", "dep:hitrace"]
|
||||||
tracing-perfetto = ["tracing", "dep:tracing-perfetto"]
|
tracing-perfetto = ["tracing", "dep:tracing-perfetto"]
|
||||||
webdriver = ["libservo/webdriver"]
|
webdriver = ["libservo/webdriver"]
|
||||||
webgl_backtrace = ["libservo/webgl_backtrace"]
|
webgl_backtrace = ["libservo/webgl_backtrace"]
|
||||||
|
webxr = ["dep:webxr", "libservo/webxr"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = { workspace = true }
|
libc = { workspace = true }
|
||||||
|
@ -95,7 +96,7 @@ ohos-vsync = "0.1.2"
|
||||||
nix = { workspace = true, features = ["fs"] }
|
nix = { workspace = true, features = ["fs"] }
|
||||||
surfman = { workspace = true, features = ["sm-angle-default"] }
|
surfman = { workspace = true, features = ["sm-angle-default"] }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
webxr = { workspace = true }
|
webxr = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_env = "ohos")))'.dependencies]
|
[target.'cfg(not(any(target_os = "android", target_env = "ohos")))'.dependencies]
|
||||||
|
|
|
@ -42,6 +42,7 @@ impl EmbedderMethods for EmbedderCallbacks {
|
||||||
self.event_loop_waker.clone()
|
self.event_loop_waker.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "webxr")]
|
||||||
fn register_webxr(
|
fn register_webxr(
|
||||||
&mut self,
|
&mut self,
|
||||||
xr: &mut webxr::MainThreadRegistry,
|
xr: &mut webxr::MainThreadRegistry,
|
||||||
|
|
|
@ -40,6 +40,7 @@ pub struct InitOptions {
|
||||||
pub url: Option<String>,
|
pub url: Option<String>,
|
||||||
pub coordinates: Coordinates,
|
pub coordinates: Coordinates,
|
||||||
pub density: f32,
|
pub density: f32,
|
||||||
|
#[cfg(feature = "webxr")]
|
||||||
pub xr_discovery: Option<webxr::Discovery>,
|
pub xr_discovery: Option<webxr::Discovery>,
|
||||||
pub surfman_integration: SurfmanIntegration,
|
pub surfman_integration: SurfmanIntegration,
|
||||||
pub prefs: Option<HashMap<String, PrefValue>>,
|
pub prefs: Option<HashMap<String, PrefValue>>,
|
||||||
|
@ -109,6 +110,7 @@ pub fn init(
|
||||||
|
|
||||||
let embedder_callbacks = Box::new(ServoEmbedderCallbacks::new(
|
let embedder_callbacks = Box::new(ServoEmbedderCallbacks::new(
|
||||||
waker,
|
waker,
|
||||||
|
#[cfg(feature = "webxr")]
|
||||||
init_opts.xr_discovery,
|
init_opts.xr_discovery,
|
||||||
gl.clone(),
|
gl.clone(),
|
||||||
));
|
));
|
||||||
|
|
|
@ -141,7 +141,12 @@ pub fn init(
|
||||||
rendering_context.clone(),
|
rendering_context.clone(),
|
||||||
));
|
));
|
||||||
|
|
||||||
let embedder_callbacks = Box::new(ServoEmbedderCallbacks::new(waker, None, gl.clone()));
|
let embedder_callbacks = Box::new(ServoEmbedderCallbacks::new(
|
||||||
|
waker,
|
||||||
|
#[cfg(feature = "webxr")]
|
||||||
|
None,
|
||||||
|
gl.clone(),
|
||||||
|
));
|
||||||
|
|
||||||
let servo = Servo::new(
|
let servo = Servo::new(
|
||||||
embedder_callbacks,
|
embedder_callbacks,
|
||||||
|
|
|
@ -651,6 +651,7 @@ impl ServoGlue {
|
||||||
|
|
||||||
pub(super) struct ServoEmbedderCallbacks {
|
pub(super) struct ServoEmbedderCallbacks {
|
||||||
waker: Box<dyn EventLoopWaker>,
|
waker: Box<dyn EventLoopWaker>,
|
||||||
|
#[cfg(feature = "webxr")]
|
||||||
xr_discovery: Option<webxr::Discovery>,
|
xr_discovery: Option<webxr::Discovery>,
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
gl: Rc<dyn gl::Gl>,
|
gl: Rc<dyn gl::Gl>,
|
||||||
|
@ -659,11 +660,12 @@ pub(super) struct ServoEmbedderCallbacks {
|
||||||
impl ServoEmbedderCallbacks {
|
impl ServoEmbedderCallbacks {
|
||||||
pub(super) fn new(
|
pub(super) fn new(
|
||||||
waker: Box<dyn EventLoopWaker>,
|
waker: Box<dyn EventLoopWaker>,
|
||||||
xr_discovery: Option<webxr::Discovery>,
|
#[cfg(feature = "webxr")] xr_discovery: Option<webxr::Discovery>,
|
||||||
gl: Rc<dyn gl::Gl>,
|
gl: Rc<dyn gl::Gl>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
waker,
|
waker,
|
||||||
|
#[cfg(feature = "webxr")]
|
||||||
xr_discovery,
|
xr_discovery,
|
||||||
gl,
|
gl,
|
||||||
}
|
}
|
||||||
|
@ -676,6 +678,7 @@ impl EmbedderMethods for ServoEmbedderCallbacks {
|
||||||
self.waker.clone()
|
self.waker.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "webxr")]
|
||||||
fn register_webxr(
|
fn register_webxr(
|
||||||
&mut self,
|
&mut self,
|
||||||
registry: &mut webxr::MainThreadRegistry,
|
registry: &mut webxr::MainThreadRegistry,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue