Limit OpenXR backend to use only a single XrInstance
This change shares a single XrInstance between the XRRuntimeProvider, OpenXrStatics, OpenXrDevice, OpenXrRenderLoop, and OpenXrApiWrapper. The instance is actually owned by the OpenXrStatics, which is in turn owned by the OpenXrDevice when one exists, and the XRRuntimeProvider otherwise. In terms of thead safety, the XrInstance will only be destroyed by the OpenXrDevice destructor, which also owns the OpenXrRenderLoop and explicitly shuts it down. Most methods which take an instance don't have any threading concerns, but even so once we have a render loop we don't make any calls against the instance from the OpenXrDevice thread until the render loop is shut down. Bug: 1100577 Change-Id: I2fc326e17c1faf3915e8eafddf23055ccd9a5639 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2278534 Commit-Queue: Brandon Jones <bajones@chromium.org> Reviewed-by:Klaus Weidner <klausw@chromium.org> Reviewed-by:
Patrick To <patrto@microsoft.com> Reviewed-by:
Alexander Cooper <alcooper@chromium.org> Cr-Commit-Position: refs/heads/master@{#786174}
Showing
Please register or sign in to comment