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

Side by Side Diff: device/vr/vr_device.cc

Issue 2624633002: Remove Sync GetPose VRService call, implement VRVSyncProvider (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/vr/vr_device.h" 5 #include "device/vr/vr_device.h"
6 #include "device/vr/vr_device_provider.h" 6 #include "device/vr/vr_device_provider.h"
7 #include "device/vr/vr_display_impl.h" 7 #include "device/vr/vr_display_impl.h"
8 8
9 namespace device { 9 namespace device {
10 10
11 namespace {
12
13 void OnVRVSyncProviderClientConnected(
14 const base::Callback<void(mojom::VRVSyncProviderClientPtr)>& callback,
15 device::mojom::VRVSyncProviderClientPtr client) {
16 callback.Run(std::move(client));
17 }
18
19 } // namespace
20
11 unsigned int VRDevice::next_id_ = 1; 21 unsigned int VRDevice::next_id_ = 1;
12 22
13 VRDevice::VRDevice() : presenting_display_(nullptr), id_(next_id_) { 23 VRDevice::VRDevice() : presenting_display_(nullptr), id_(next_id_) {
14 // Prevent wraparound. Devices with this ID will be treated as invalid. 24 // Prevent wraparound. Devices with this ID will be treated as invalid.
15 if (next_id_ != VR_DEVICE_LAST_ID) 25 if (next_id_ != VR_DEVICE_LAST_ID)
16 next_id_++; 26 next_id_++;
17 } 27 }
18 28
19 VRDevice::~VRDevice() {} 29 VRDevice::~VRDevice() {}
20 30
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void VRDevice::OnActivate(mojom::VRDisplayEventReason reason) { 82 void VRDevice::OnActivate(mojom::VRDisplayEventReason reason) {
73 for (const auto& display : displays_) 83 for (const auto& display : displays_)
74 display->client()->OnActivate(reason); 84 display->client()->OnActivate(reason);
75 } 85 }
76 86
77 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { 87 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) {
78 for (const auto& display : displays_) 88 for (const auto& display : displays_)
79 display->client()->OnDeactivate(reason); 89 display->client()->OnDeactivate(reason);
80 } 90 }
81 91
92 void VRDevice::OnVRVsyncProviderReady(
93 const base::Callback<void(mojom::VRVSyncProviderClientPtr)>& callback) {
94 presenting_display_->client()->OnVRVsyncProviderReady(
95 base::Bind(&OnVRVSyncProviderClientConnected, callback));
96 }
97
82 void VRDevice::SetPresentingDisplay(VRDisplayImpl* display) { 98 void VRDevice::SetPresentingDisplay(VRDisplayImpl* display) {
83 presenting_display_ = display; 99 presenting_display_ = display;
84 } 100 }
85 101
86 } // namespace device 102 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698