Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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() {
Expand All @@ -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
Expand All @@ -1035,6 +1045,10 @@ void WebGLRenderingContextBase::OnMakeXrCompatibleFinished(
}
CompleteXrCompatiblePromiseIfPending(exception_code);
}
#else
// Act as no device was available
CompleteXrCompatiblePromiseIfPending(DOMExceptionCode::kInvalidStateError);
#endif
}

void WebGLRenderingContextBase::CompleteXrCompatiblePromiseIfPending(
Expand Down
Loading