Finish the integration of webxr into the Cargo workspace (#35229)

- Run `cargo fmt` on `webxr` and `webxr-api`
- Fix clippy warnings in the existing `webxr` code
- Integrate the new crates into the workspace
- Expose `webxr` via the libservo API rather than requiring embedders to
  depend on it explicitly.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-01-31 17:41:57 +01:00 committed by GitHub
parent a4c6c205d2
commit 5466c27f6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 448 additions and 649 deletions

View file

@ -2,28 +2,16 @@
* 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::DiscoveryAPI;
use crate::Error;
use crate::Frame;
use crate::GLTypes;
use crate::LayerGrandManager;
use crate::MainThreadSession;
use crate::MockDeviceInit;
use crate::MockDeviceMsg;
use crate::MockDiscoveryAPI;
use crate::Receiver;
use crate::Sender;
use crate::Session;
use crate::SessionBuilder;
use crate::SessionId;
use crate::SessionInit;
use crate::SessionMode;
use log::warn;
#[cfg(feature = "ipc")]
use serde::{Deserialize, Serialize};
use crate::{
DiscoveryAPI, Error, Frame, GLTypes, LayerGrandManager, MainThreadSession, MockDeviceInit,
MockDeviceMsg, MockDiscoveryAPI, Receiver, Sender, Session, SessionBuilder, SessionId,
SessionInit, SessionMode,
};
#[derive(Clone)]
#[cfg_attr(feature = "ipc", derive(Serialize, Deserialize))]
pub struct Registry {
@ -188,13 +176,13 @@ impl<GL: 'static + GLTypes> MainThreadRegistry<GL> {
match msg {
RegistryMsg::SupportsSession(mode, dest) => {
let _ = dest.send(self.supports_session(mode));
}
},
RegistryMsg::RequestSession(mode, init, dest, raf_sender) => {
let _ = dest.send(self.request_session(mode, init, raf_sender));
}
},
RegistryMsg::SimulateDeviceConnection(init, dest) => {
let _ = dest.send(self.simulate_device_connection(init));
}
},
}
}
@ -250,6 +238,7 @@ impl<GL: 'static + GLTypes> MainThreadRegistry<GL> {
}
#[cfg_attr(feature = "ipc", derive(Serialize, Deserialize))]
#[allow(clippy::large_enum_variant)]
enum RegistryMsg {
RequestSession(
SessionMode,