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

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

Issue 1918143007: Updated Blink WebVR interfaces to WebVR v1 spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webvr_mojo
Patch Set: Fixed layout test 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "modules/vr/VRDisplayCollection.h"
6
7 #include "modules/vr/NavigatorVR.h"
8
9 namespace blink {
10
11 VRDisplayCollection::VRDisplayCollection(NavigatorVR* navigatorVR)
12 : m_navigatorVR(navigatorVR)
13 {
14 }
15
16 VRDisplayVector VRDisplayCollection::updateDisplays(const WebVector<WebVRDevice> & devices)
17 {
18 VRDisplayVector vrDevices;
19
20 for (const auto& device : devices) {
21 VRDisplay* display = getDisplayForIndex(device.index);
22 if (!display) {
23 display = new VRDisplay(m_navigatorVR);
24 m_displays.append(display);
25 }
26
27 display->updateFromWebVRDevice(device);
28 vrDevices.append(display);
29 }
30
31 return vrDevices;
32 }
33
34 VRDisplay* VRDisplayCollection::getDisplayForIndex(unsigned index)
35 {
36 VRDisplay* display;
37 for (size_t i = 0; i < m_displays.size(); ++i) {
38 display = m_displays[i];
39 if (display->displayId() == index) {
40 return display;
41 }
42 }
43
44 return 0;
45 }
46
47 DEFINE_TRACE(VRDisplayCollection)
48 {
49 visitor->trace(m_navigatorVR);
50 visitor->trace(m_displays);
51 }
52
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.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698