Commit 956fd70f authored by Bill Orr's avatar Bill Orr Committed by Commit Bot

Fix a crash and a timeout issue.

WebXR may not submit frames if pose data is null.  Pose data will
be null if WebXR isn't visible.  However, we want at least one pose
data to be non-null to know that WebXR is ready to submit frames.

The fix is to hand out a non-null pose data.

Also, fix a crash.  graphics_ is set to null when UI hides, but we
may still have an outstanding frame callback.

Change-Id: Ib304a0b56d8737da1d8200cbb6257645755c99ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1540616Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Commit-Queue: Bill Orr <billorr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644604}
parent 8b3d5524
...@@ -293,7 +293,9 @@ void VRBrowserRendererThreadWin::OnPose(device::mojom::XRFrameDataPtr data) { ...@@ -293,7 +293,9 @@ void VRBrowserRendererThreadWin::OnPose(device::mojom::XRFrameDataPtr data) {
// We shouldn't be showing UI. // We shouldn't be showing UI.
overlay_->SetOverlayAndWebXRVisibility(draw_state_.ShouldDrawUI(), overlay_->SetOverlayAndWebXRVisibility(draw_state_.ShouldDrawUI(),
draw_state_.ShouldDrawWebXR()); draw_state_.ShouldDrawWebXR());
graphics_->ResetMemoryBuffer();
if (graphics_)
graphics_->ResetMemoryBuffer();
return; return;
} }
......
...@@ -99,7 +99,6 @@ void XRCompositorCommon::SubmitFrameWithTextureHandle( ...@@ -99,7 +99,6 @@ void XRCompositorCommon::SubmitFrameWithTextureHandle(
int16_t frame_index, int16_t frame_index,
mojo::ScopedHandle texture_handle) { mojo::ScopedHandle texture_handle) {
TRACE_EVENT1("xr", "SubmitFrameWithTextureHandle", "frameIndex", frame_index); TRACE_EVENT1("xr", "SubmitFrameWithTextureHandle", "frameIndex", frame_index);
webxr_has_pose_ = false; webxr_has_pose_ = false;
// Tell the browser that WebXR has submitted a frame. // Tell the browser that WebXR has submitted a frame.
if (on_webxr_submitted_) if (on_webxr_submitted_)
...@@ -351,7 +350,8 @@ void XRCompositorCommon::GetControllerDataAndSendFrameData( ...@@ -351,7 +350,8 @@ void XRCompositorCommon::GetControllerDataAndSendFrameData(
// We have posted a message to allow other calls to get through, and now state // We have posted a message to allow other calls to get through, and now state
// may have changed. WebXR may not be presenting any more, or may be hidden. // may have changed. WebXR may not be presenting any more, or may be hidden.
std::move(callback).Run(is_presenting_ && webxr_visible_ std::move(callback).Run(is_presenting_ &&
(webxr_visible_ || on_webxr_submitted_)
? std::move(frame_data) ? std::move(frame_data)
: mojom::XRFrameData::New()); : mojom::XRFrameData::New());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment