• Brandon Jones's avatar
    Limit OpenXR backend to use only a single XrInstance · 2fce924d
    Brandon Jones authored
    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: default avatarKlaus Weidner <klausw@chromium.org>
    Reviewed-by: default avatarPatrick To <patrto@microsoft.com>
    Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#786174}
    2fce924d
openxr_test_helper.h 9.39 KB