OLD | NEW |
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_manager.h" | 5 #include "device/vr/vr_device_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 unsigned int VRDeviceManager::GetNumberOfConnectedDevices() { | 118 unsigned int VRDeviceManager::GetNumberOfConnectedDevices() { |
119 DCHECK(thread_checker_.CalledOnValidThread()); | 119 DCHECK(thread_checker_.CalledOnValidThread()); |
120 | 120 |
121 return static_cast<unsigned int>(devices_.size()); | 121 return static_cast<unsigned int>(devices_.size()); |
122 } | 122 } |
123 | 123 |
124 void VRDeviceManager::ListeningForActivateChanged(bool listening) { | 124 void VRDeviceManager::ListeningForActivateChanged(bool listening) { |
125 DCHECK(thread_checker_.CalledOnValidThread()); | 125 DCHECK(thread_checker_.CalledOnValidThread()); |
| 126 VLOG(1) << __FUNCTION__ << ": listening=" << listening; |
126 | 127 |
127 bool activate_listeners = listening; | 128 bool activate_listeners = listening; |
128 if (!activate_listeners) { | 129 if (!activate_listeners) { |
129 for (const auto& service : services_) { | 130 for (const auto& service : services_) { |
130 if (service->listening_for_activate()) { | 131 if (service->listening_for_activate()) { |
131 activate_listeners = true; | 132 activate_listeners = true; |
132 break; | 133 break; |
133 } | 134 } |
134 } | 135 } |
135 } | 136 } |
136 | 137 |
137 // Notify all the providers if this changes | 138 // Notify all the providers if this changes |
138 if (has_activate_listeners_ != activate_listeners) { | 139 if (has_activate_listeners_ != activate_listeners) { |
139 has_activate_listeners_ = activate_listeners; | 140 has_activate_listeners_ = activate_listeners; |
140 for (const auto& provider : providers_) | 141 VLOG(1) << __FUNCTION__ << ": has_activate_listeners_=" << has_activate_list
eners_; |
| 142 for (const auto& provider : providers_) { |
| 143 VLOG(1) << __FUNCTION__ << ": provider SetListeningForActivate " << has_ac
tivate_listeners_; |
141 provider->SetListeningForActivate(has_activate_listeners_); | 144 provider->SetListeningForActivate(has_activate_listeners_); |
| 145 } |
142 } | 146 } |
143 } | 147 } |
144 | 148 |
145 VRDevice* VRDeviceManager::GetDevice(unsigned int index) { | 149 VRDevice* VRDeviceManager::GetDevice(unsigned int index) { |
146 DCHECK(thread_checker_.CalledOnValidThread()); | 150 DCHECK(thread_checker_.CalledOnValidThread()); |
147 | 151 |
148 if (index == 0) { | 152 if (index == 0) { |
149 return NULL; | 153 return NULL; |
150 } | 154 } |
151 | 155 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 for (const auto& provider : providers_) | 191 for (const auto& provider : providers_) |
188 provider->PollEvents(); | 192 provider->PollEvents(); |
189 } | 193 } |
190 | 194 |
191 void VRDeviceManager::StopSchedulingPollEvents() { | 195 void VRDeviceManager::StopSchedulingPollEvents() { |
192 if (has_scheduled_poll_) | 196 if (has_scheduled_poll_) |
193 timer_.Stop(); | 197 timer_.Stop(); |
194 } | 198 } |
195 | 199 |
196 } // namespace device | 200 } // namespace device |
OLD | NEW |