Index: third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
index 27228f4c3112e7f043355473a92f84f67ce20b10..31fbc5f152979223fcafbeaa97bdcbe2648c76b2 100644 |
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
@@ -105,7 +105,7 @@ void VRDisplay::Update(const device::mojom::blink::VRDisplayInfoPtr& display) { |
} |
bool VRDisplay::getFrameData(VRFrameData* frame_data) { |
- if (!navigator_vr_->IsFocused() || !frame_pose_ || display_blurred_) |
+ if (!FocusedOrPresenting() || !frame_pose_ || display_blurred_) |
return false; |
if (!frame_data) |
@@ -559,7 +559,7 @@ void VRDisplay::submitFrame() { |
// as implemented by AcceleratedStaticBitmapImage. Ensure this is |
// the case, don't attempt to render if using an unexpected drawing |
// path. |
- if (!image_ref->IsTextureBacked()) { |
+ if (!image_ref.Get() || !image_ref->IsTextureBacked()) { |
klausw
2017/05/03 16:20:42
Is this out of paranoia, or have you run into case
mthiesse
2017/05/04 17:29:01
I was running into this occasionally when using th
|
NOTREACHED() << "WebVR requires hardware-accelerated rendering to texture"; |
return; |
} |
@@ -794,7 +794,7 @@ void VRDisplay::OnVSync(device::mojom::blink::VRPosePtr pose, |
} |
void VRDisplay::ConnectVSyncProvider() { |
- if (!navigator_vr_->IsFocused() || vr_v_sync_provider_.is_bound()) |
+ if (!FocusedOrPresenting() || vr_v_sync_provider_.is_bound()) |
return; |
display_->GetVRVSyncProvider(mojo::MakeRequest(&vr_v_sync_provider_)); |
vr_v_sync_provider_.set_connection_error_handler(ConvertToBaseCallback( |
@@ -853,6 +853,12 @@ void VRDisplay::FocusChanged() { |
ConnectVSyncProvider(); |
} |
+bool VRDisplay::FocusedOrPresenting() { |
+ // TODO(mthiesse, crbug.com/687411): Focused state should be determined |
+ // browser-side to correctly track which display should be receiving input. |
+ return navigator_vr_->IsFocused() || is_presenting_; |
+} |
+ |
DEFINE_TRACE(VRDisplay) { |
EventTargetWithInlineData::Trace(visitor); |
ContextLifecycleObserver::Trace(visitor); |