Use webxr IPC to get a WebXR device registry to each script thread

This commit is contained in:
Alan Jeffrey 2019-07-02 12:34:58 -05:00
parent fee1418b43
commit 9eb75d4ea6
12 changed files with 148 additions and 35 deletions

View file

@ -50,6 +50,7 @@ servo_remutex = {path = "../remutex"}
servo_url = {path = "../url"}
webvr_traits = {path = "../webvr_traits"}
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
webxr-api = {git = "https://github.com/servo/webxr", features = ["ipc"]}
[target.'cfg(all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_arch="arm"), not(target_arch="aarch64")))'.dependencies]
gaol = {git = "https://github.com/servo/gaol"}

View file

@ -390,6 +390,9 @@ pub struct Constellation<Message, LTF, STF> {
/// A channel through which messages can be sent to the webvr thread.
webvr_chan: Option<IpcSender<WebVRMsg>>,
/// The XR device registry
webxr_registry: webxr_api::Registry,
/// A channel through which messages can be sent to the canvas paint thread.
canvas_chan: IpcSender<CanvasMsg>,
@ -455,6 +458,9 @@ pub struct InitialConstellationState {
/// A channel to the webgl thread.
pub webvr_chan: Option<IpcSender<WebVRMsg>>,
/// The XR device registry
pub webxr_registry: webxr_api::Registry,
}
/// Data needed for webdriver
@ -751,6 +757,7 @@ where
}),
webgl_threads: state.webgl_threads,
webvr_chan: state.webvr_chan,
webxr_registry: state.webxr_registry,
canvas_chan: CanvasPaintThread::start(),
pending_approval_navigations: HashMap::new(),
pressed_mouse_buttons: 0,
@ -997,6 +1004,7 @@ where
.as_ref()
.map(|threads| threads.pipeline()),
webvr_chan: self.webvr_chan.clone(),
webxr_registry: self.webxr_registry.clone(),
});
let pipeline = match result {

View file

@ -188,6 +188,9 @@ pub struct InitialPipelineState {
/// A channel to the webvr thread.
pub webvr_chan: Option<IpcSender<WebVRMsg>>,
/// The XR device registry
pub webxr_registry: webxr_api::Registry,
}
pub struct NewPipeline {
@ -305,6 +308,7 @@ impl Pipeline {
webrender_document: state.webrender_document,
webgl_chan: state.webgl_chan,
webvr_chan: state.webvr_chan,
webxr_registry: state.webxr_registry,
};
// Spawn the child process.
@ -510,6 +514,7 @@ pub struct UnprivilegedPipelineContent {
webrender_document: webrender_api::DocumentId,
webgl_chan: Option<WebGLPipeline>,
webvr_chan: Option<IpcSender<WebVRMsg>>,
webxr_registry: webxr_api::Registry,
}
impl UnprivilegedPipelineContent {
@ -554,6 +559,7 @@ impl UnprivilegedPipelineContent {
content_process_shutdown_chan: self.script_content_process_shutdown_chan,
webgl_chan: self.webgl_chan,
webvr_chan: self.webvr_chan,
webxr_registry: self.webxr_registry,
webrender_document: self.webrender_document,
webrender_api_sender: self.webrender_api_sender.clone(),
layout_is_busy: layout_thread_busy_flag.clone(),