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

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

Issue 2668003003: Provide WebVR pose data only to the focused frame. (Closed)
Patch Set: Address comments Created 3 years, 11 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
Index: third_party/WebKit/Source/modules/vr/VRController.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRController.cpp b/third_party/WebKit/Source/modules/vr/VRController.cpp
index 0df41d123929b8776bdb9a749274202c3f2677af..04ac9037a9fe88267040cdc8c4f77f660b9cf16f 100644
--- a/third_party/WebKit/Source/modules/vr/VRController.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRController.cpp
@@ -64,6 +64,7 @@ void VRController::OnDisplayConnected(
new VRDisplay(m_navigatorVR, std::move(display), std::move(request));
vrDisplay->update(displayInfo);
vrDisplay->onConnected();
+ vrDisplay->focusChanged(m_focused);
m_displays.push_back(vrDisplay);
if (m_displays.size() == m_numberOfSyncedDisplays) {
@@ -72,6 +73,12 @@ void VRController::OnDisplayConnected(
}
}
+void VRController::focusChanged(bool focused) {
+ m_focused = focused;
+ for (const auto& display : m_displays)
+ display->focusChanged(focused);
+}
+
// Called when the VRService has called OnDisplayConnected for all active
// VRDisplays.
void VRController::onDisplaysSynced(unsigned numberOfDisplays) {
@@ -101,8 +108,8 @@ void VRController::dispose() {
m_binding.Close();
// Shutdown all displays' message pipe
- for (size_t i = 0; i < m_displays.size(); ++i)
- m_displays[i]->dispose();
+ for (const auto& display : m_displays)
+ display->dispose();
m_displays.clear();

Powered by Google App Engine
This is Rietveld 408576698