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

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

Issue 2167643003: Refactored VRService interaction and added VRServiceClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Liberal sprinkling of 'u's Created 4 years, 4 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(mojo::WTFArray<device::blink ::VRDisplayPtr> displays)
17 {
18 VRDisplayVector vrDisplays;
19
20 for (const auto& display : displays.PassStorage()) {
21 VRDisplay* vrDisplay = getDisplayForIndex(display->index);
22 if (!vrDisplay) {
23 vrDisplay = new VRDisplay(m_navigatorVR);
24 m_displays.append(vrDisplay);
25 }
26
27 vrDisplay->update(display);
28 vrDisplays.append(vrDisplay);
29 }
30
31 return vrDisplays;
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

Powered by Google App Engine
This is Rietveld 408576698