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

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

Issue 2668003003: Provide WebVR pose data only to the focused frame. (Closed)
Patch Set: Address comments Created 3 years, 10 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 4810e4fa6c24817abeabd72c20f1899c1dfaa14f..49e1cce8342c918a4adca927d22c16b83ba48268 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -114,7 +114,7 @@ void VRDisplay::disconnected() {
}
bool VRDisplay::getFrameData(VRFrameData* frameData) {
- if (!m_framePose || m_displayBlurred)
+ if (!m_navigatorVR->isFocused() || !m_framePose || m_displayBlurred)
return false;
if (!frameData)
@@ -128,7 +128,7 @@ bool VRDisplay::getFrameData(VRFrameData* frameData) {
}
VRPose* VRDisplay::getPose() {
- if (!m_framePose || m_displayBlurred)
+ if (!m_navigatorVR->isFocused() || !m_framePose || m_displayBlurred)
return nullptr;
VRPose* pose = VRPose::create();
@@ -672,6 +672,8 @@ void VRDisplay::OnVSync(device::mojom::blink::VRPosePtr pose,
}
void VRDisplay::ConnectVSyncProvider() {
+ if (!m_navigatorVR->isFocused())
+ return;
m_display->GetVRVSyncProvider(mojo::MakeRequest(&m_vrVSyncProvider));
if (m_pendingRaf && !m_displayBlurred) {
m_vrVSyncProvider->GetVSync(convertToBaseCallback(
@@ -747,6 +749,12 @@ bool VRDisplay::hasPendingActivity() const {
return getExecutionContext() && hasEventListeners();
}
+void VRDisplay::focusChanged() {
+ // TODO(mthiesse): Blur/focus the display.
+ m_vrVSyncProvider.reset();
+ ConnectVSyncProvider();
+}
+
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