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

Unified Diff: device/vr/vr_device_manager.cc

Issue 2471433002: Implement WebVR presentation pausing for VR Shell Menu Mode (Closed)
Patch Set: Created 4 years, 1 month 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: device/vr/vr_device_manager.cc
diff --git a/device/vr/vr_device_manager.cc b/device/vr/vr_device_manager.cc
index b8c99ea3566c19e288ae011494bb6a1e7add6f04..e92ef5c17443a9fb528484b6a95499bcd92c507c 100644
--- a/device/vr/vr_device_manager.cc
+++ b/device/vr/vr_device_manager.cc
@@ -79,7 +79,7 @@ VRDevice* VRDeviceManager::GetAllowedDevice(VRServiceImpl* service,
void VRDeviceManager::SetInstance(VRDeviceManager* instance) {
// Unit tests can create multiple instances but only one should exist at any
// given time so g_vr_device_manager should only go from nullptr to
- // non-nullptr and vica versa.
+ // non-nullptr and vice versa.
CHECK_NE(!!instance, !!g_vr_device_manager);
g_vr_device_manager = instance;
}
@@ -287,6 +287,31 @@ void VRDeviceManager::OnPresentEnded(VRDevice* device) {
presenting_device_ = nullptr;
}
+void VRDeviceManager::PausePresent(VRDevice* device) {
+ // Ensure the presenting device is the one that we've been requested to pause.
+ if (!presenting_device_ || presenting_device_ != device)
+ return;
+
+ // Should never have a presenting device without a presenting service.
+ DCHECK(presenting_service_);
+
+ // Notify the presenting service that it should pause.
+ presenting_service_->client()->OnPausePresent(device->id());
+}
+
+void VRDeviceManager::ResumePresent(VRDevice* device) {
+ // Ensure the presenting device is the one that we've been requested to
+ // resume.
+ if (!presenting_device_ || presenting_device_ != device)
+ return;
+
+ // Should never have a presenting device without a presenting service.
+ DCHECK(presenting_service_);
+
+ // Notify the presenting service that it should pause.
+ presenting_service_->client()->OnResumePresent(device->id());
+}
+
void VRDeviceManager::InitializeProviders() {
if (vr_initialized_) {
return;

Powered by Google App Engine
This is Rietveld 408576698