diff --git a/third_party/blink/renderer/bindings/generated_in_modules_excluded.gni b/third_party/blink/renderer/bindings/generated_in_modules_excluded.gni index 6b15d67b38ea..435aee31ea60 100644 --- a/third_party/blink/renderer/bindings/generated_in_modules_excluded.gni +++ b/third_party/blink/renderer/bindings/generated_in_modules_excluded.gni @@ -56,6 +56,8 @@ if (disable_xr) { generated_enumeration_sources_in_modules_excluded += [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_data_format.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_data_format.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_type.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_usage.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_usage.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_dom_overlay_type.cc", diff --git a/third_party/blink/renderer/bindings/idl_in_modules_excluded.gni b/third_party/blink/renderer/bindings/idl_in_modules_excluded.gni index d5457a96d7b2..4a208a3d73e2 100644 --- a/third_party/blink/renderer/bindings/idl_in_modules_excluded.gni +++ b/third_party/blink/renderer/bindings/idl_in_modules_excluded.gni @@ -69,6 +69,7 @@ if (disable_xr) { "//third_party/blink/renderer/modules/xr/xr_transient_input_hit_test_options_init.idl", "//third_party/blink/renderer/modules/xr/xr_transient_input_hit_test_result.idl", "//third_party/blink/renderer/modules/xr/xr_transient_input_hit_test_source.idl", + "//third_party/blink/renderer/modules/xr/xr_view_geometry.idl", "//third_party/blink/renderer/modules/xr/xr_view.idl", "//third_party/blink/renderer/modules/xr/xr_viewer_pose.idl", "//third_party/blink/renderer/modules/xr/xr_viewport.idl", diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc index cb4f020a5287..0ebf38fad236 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc @@ -941,18 +941,26 @@ bool WebGLRenderingContextBase::IsXRCompatible() const { bool WebGLRenderingContextBase::IsXrCompatibleFromResult( device::mojom::blink::XrCompatibleResult result) { +#if !BUILDFLAG(DISABLE_XR) return result == device::mojom::blink::XrCompatibleResult::kAlreadyCompatible || result == device::mojom::blink::XrCompatibleResult::kCompatibleAfterRestart; +#else + return false; +#endif } bool WebGLRenderingContextBase::DidGpuRestart( device::mojom::blink::XrCompatibleResult result) { +#if !BUILDFLAG(DISABLE_XR) return result == device::mojom::blink::XrCompatibleResult:: kCompatibleAfterRestart || result == device::mojom::blink::XrCompatibleResult:: kNotCompatibleAfterRestart; +#else + return false; +#endif } #if !BUILDFLAG(DISABLE_XR) @@ -979,18 +987,19 @@ XRSystem* WebGLRenderingContextBase::GetXrSystemFromHost( bool WebGLRenderingContextBase::MakeXrCompatibleSync( CanvasRenderingContextHost* host) { +#if !BUILDFLAG(DISABLE_XR) device::mojom::blink::XrCompatibleResult xr_compatible_result = device::mojom::blink::XrCompatibleResult::kNoDeviceAvailable; -#if !BUILDFLAG(DISABLE_XR) if constexpr (BUILDFLAG(ENABLE_VR)) { if (XRSystem* xr = GetXrSystemFromHost(host)) { xr->MakeXrCompatibleSync(&xr_compatible_result); } } -#endif - return IsXrCompatibleFromResult(xr_compatible_result); +#else + return false; +#endif } void WebGLRenderingContextBase::MakeXrCompatibleAsync() { @@ -1012,6 +1021,7 @@ void WebGLRenderingContextBase::MakeXrCompatibleAsync() { void WebGLRenderingContextBase::OnMakeXrCompatibleFinished( device::mojom::blink::XrCompatibleResult xr_compatible_result) { +#if !BUILDFLAG(DISABLE_XR) xr_compatible_ = IsXrCompatibleFromResult(xr_compatible_result); // If the gpu process is restarted, MaybeRestoreContext will resolve the @@ -1035,6 +1045,10 @@ void WebGLRenderingContextBase::OnMakeXrCompatibleFinished( } CompleteXrCompatiblePromiseIfPending(exception_code); } +#else + // Act as no device was available + CompleteXrCompatiblePromiseIfPending(DOMExceptionCode::kInvalidStateError); +#endif } void WebGLRenderingContextBase::CompleteXrCompatiblePromiseIfPending(