Currently, a single `surfman::Device` is used for all WebGL contexts.
This cannot work when we have multiple rendering contexts. So, extract
the surfman `Connection` and `Adapter` into a per-painter data structure
(`PainterSurfmanDetailsMap`) and store the `Device` directly in the
WebGL context.
This patch also modifies the WebXR traits so that the `Device` doesn't
need to be explictly passed into most methods.
*This is a reland of #40594* with the following changes:
- Do not remove WebGL contexts from the context map before cleaning up
the
WebXR layers. The layer cleanup process consults the map.
- When cleanup up layers, be sure to replace the WebXRBridge in the
WebGLThread data structure.
- Allow failing to the Device when processing WebXR commands. WebXR
sometimes tries to access contexts after they have been removed.
Testing: Should be covered by existing tests.
---------
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>