For a more high level overview of the entire WebXR stack, please refer to components/webxr.
This folder contains trusted XR code. It is largely responsible for either communicating with other trusted code, or to broker connections and communication between either other trusted code or the renderer process and the various XR device runtimes (which are hosted in a separate process).
The primary entrypoint is the VRServiceImpl
, which implements the VRService
mojom interface. This service is responsible for brokering connections between the renderer process and the device process, both for the sake of starting up an XR Session, as well as simply querying support for a session. Each browsing context ends up creating its own VRService
. A VRServiceImpl
instance, when tracking a session, also leans on code from the ./metrics directory to log various metrics about that session, both at creation and termination.
The XRRuntimeManager
is a singleton component which maintains references to BrowserXrRuntime
objects representing the various devices and/or sensor groups that could back an XR Session. The XRRuntimeManager
is responsible for tracking the state of the hardware and aiding the multiple VRServices
with communicating/tracking this state.
When necessary, XRFrameSinkClient
instances aid communication with viz for runtimes which utilize that component to manage their own compositing.
Some chrome-specific customizations based on this content implementation can be found in chrome/browser/vr