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

Side by Side Diff: third_party/WebKit/Source/modules/vr/VRDisplayCollection.cpp

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 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 "modules/vr/VRDisplayCollection.h" 5 #include "modules/vr/VRDisplayCollection.h"
6 6
7 #include "modules/vr/NavigatorVR.h" 7 #include "modules/vr/NavigatorVR.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 VRDisplayCollection::VRDisplayCollection(NavigatorVR* navigatorVR) 11 VRDisplayCollection::VRDisplayCollection(NavigatorVR* navigatorVR)
12 : m_navigatorVR(navigatorVR) 12 : m_navigatorVR(navigatorVR)
13 { 13 {
14 } 14 }
15 15
16 VRDisplayVector VRDisplayCollection::updateDisplays(mojo::WTFArray<mojom::blink: :VRDeviceInfoPtr> devices) 16 VRDisplayVector VRDisplayCollection::updateDisplays(mojo::WTFArray<mojom::blink: :VRDisplayPtr> displays)
17 { 17 {
18 VRDisplayVector vrDevices; 18 VRDisplayVector vrDisplays;
19 19
20 for (const auto& device : devices.PassStorage()) { 20 for (const auto& display : displays.PassStorage()) {
21 VRDisplay* display = getDisplayForIndex(device->index); 21 VRDisplay* vrDisplay = getDisplayForIndex(display->index);
22 if (!display) { 22 if (!vrDisplay) {
23 display = new VRDisplay(m_navigatorVR); 23 vrDisplay = new VRDisplay(m_navigatorVR);
24 m_displays.append(display); 24 m_displays.append(vrDisplay);
25 } 25 }
26 26
27 display->update(device); 27 vrDisplay->update(display);
28 vrDevices.append(display); 28 vrDisplays.append(vrDisplay);
29 } 29 }
30 30
31 return vrDevices; 31 return vrDisplays;
32 } 32 }
33 33
34 VRDisplay* VRDisplayCollection::getDisplayForIndex(unsigned index) 34 VRDisplay* VRDisplayCollection::getDisplayForIndex(unsigned index)
35 { 35 {
36 VRDisplay* display; 36 VRDisplay* display;
37 for (size_t i = 0; i < m_displays.size(); ++i) { 37 for (size_t i = 0; i < m_displays.size(); ++i) {
38 display = m_displays[i]; 38 display = m_displays[i];
39 if (display->displayId() == index) { 39 if (display->displayId() == index) {
40 return display; 40 return display;
41 } 41 }
42 } 42 }
43 43
44 return 0; 44 return 0;
45 } 45 }
46 46
47 DEFINE_TRACE(VRDisplayCollection) 47 DEFINE_TRACE(VRDisplayCollection)
48 { 48 {
49 visitor->trace(m_navigatorVR); 49 visitor->trace(m_navigatorVR);
50 visitor->trace(m_displays); 50 visitor->trace(m_displays);
51 } 51 }
52 52
53 } // namespace blink 53 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRDisplayCollection.h ('k') | third_party/WebKit/Source/modules/vr/VREyeParameters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698