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

Unified Diff: content/browser/vr/vr_device_manager.cc

Issue 1967633002: Updated VRService to match the latest Blink WebVR interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: And we're back to removing all the array size checks Created 4 years, 7 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 | « content/browser/vr/vr_device_manager.h ('k') | content/browser/vr/vr_device_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/vr/vr_device_manager.cc
diff --git a/content/browser/vr/vr_device_manager.cc b/content/browser/vr/vr_device_manager.cc
index f7663f352377f5b5f6723256698b1ac293e82c48..47b222c5f16737e2d306fef67d9cd953e3a85ee7 100644
--- a/content/browser/vr/vr_device_manager.cc
+++ b/content/browser/vr/vr_device_manager.cc
@@ -77,7 +77,7 @@ bool VRDeviceManager::HasInstance() {
return !!g_vr_device_manager;
}
-mojo::Array<blink::mojom::VRDeviceInfoPtr> VRDeviceManager::GetVRDevices() {
+mojo::Array<blink::mojom::VRDisplayPtr> VRDeviceManager::GetVRDevices() {
DCHECK(thread_checker_.CalledOnValidThread());
InitializeProviders();
@@ -86,7 +86,7 @@ mojo::Array<blink::mojom::VRDeviceInfoPtr> VRDeviceManager::GetVRDevices() {
for (const auto& provider : providers_)
provider->GetDevices(&devices);
- mojo::Array<blink::mojom::VRDeviceInfoPtr> out_devices;
+ mojo::Array<blink::mojom::VRDisplayPtr> out_devices;
for (const auto& device : devices) {
if (device->id() == VR_DEVICE_LAST_ID)
continue;
@@ -94,7 +94,7 @@ mojo::Array<blink::mojom::VRDeviceInfoPtr> VRDeviceManager::GetVRDevices() {
if (devices_.find(device->id()) == devices_.end())
devices_[device->id()] = device;
- blink::mojom::VRDeviceInfoPtr vr_device_info = device->GetVRDevice();
+ blink::mojom::VRDisplayPtr vr_device_info = device->GetVRDevice();
if (vr_device_info.is_null())
continue;
@@ -108,6 +108,10 @@ mojo::Array<blink::mojom::VRDeviceInfoPtr> VRDeviceManager::GetVRDevices() {
VRDevice* VRDeviceManager::GetDevice(unsigned int index) {
DCHECK(thread_checker_.CalledOnValidThread());
+ if (index == 0) {
+ return NULL;
+ }
+
DeviceMap::iterator iter = devices_.find(index);
if (iter == devices_.end()) {
return nullptr;
@@ -131,24 +135,24 @@ void VRDeviceManager::RegisterProvider(
providers_.push_back(make_linked_ptr(provider.release()));
}
-void VRDeviceManager::GetDevices(const GetDevicesCallback& callback) {
+void VRDeviceManager::GetDisplays(const GetDisplaysCallback& callback) {
callback.Run(GetVRDevices());
}
-void VRDeviceManager::GetSensorState(uint32_t index,
- const GetSensorStateCallback& callback) {
+void VRDeviceManager::GetPose(uint32_t index,
+ const GetPoseCallback& callback) {
VRDevice* device = GetDevice(index);
if (device) {
- callback.Run(device->GetSensorState());
+ callback.Run(device->GetPose());
} else {
callback.Run(nullptr);
}
}
-void VRDeviceManager::ResetSensor(uint32_t index) {
+void VRDeviceManager::ResetPose(uint32_t index) {
VRDevice* device = GetDevice(index);
if (device)
- device->ResetSensor();
+ device->ResetPose();
}
} // namespace content
« no previous file with comments | « content/browser/vr/vr_device_manager.h ('k') | content/browser/vr/vr_device_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698