Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Unified Diff: third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Issue 2859533003: WebVR: lock focus while presenting to presenting window (Closed)
Patch Set: Add comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRDisplay.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRDisplay.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698