OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/sensor/SensorProxy.h" | 5 #include "modules/sensor/SensorProxy.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "modules/sensor/SensorProviderProxy.h" | 9 #include "modules/sensor/SensorProviderProxy.h" |
10 #include "modules/sensor/SensorReading.h" | 10 #include "modules/sensor/SensorReading.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 for (Observer* observer : m_observers) | 236 for (Observer* observer : m_observers) |
237 observer->onSensorInitialized(); | 237 observer->onSensorInitialized(); |
238 } | 238 } |
239 | 239 |
240 void SensorProxy::onAddConfigurationCompleted( | 240 void SensorProxy::onAddConfigurationCompleted( |
241 double frequency, | 241 double frequency, |
242 std::unique_ptr<Function<void(bool)>> callback, | 242 std::unique_ptr<Function<void(bool)>> callback, |
243 bool result) { | 243 bool result) { |
244 if (result) { | 244 if (result) { |
245 m_frequenciesUsed.append(frequency); | 245 m_frequenciesUsed.push_back(frequency); |
246 std::sort(m_frequenciesUsed.begin(), m_frequenciesUsed.end()); | 246 std::sort(m_frequenciesUsed.begin(), m_frequenciesUsed.end()); |
247 if (isActive()) | 247 if (isActive()) |
248 m_readingUpdater->start(); | 248 m_readingUpdater->start(); |
249 } | 249 } |
250 | 250 |
251 (*callback)(result); | 251 (*callback)(result); |
252 } | 252 } |
253 | 253 |
254 void SensorProxy::onRemoveConfigurationCompleted(double frequency, | 254 void SensorProxy::onRemoveConfigurationCompleted(double frequency, |
255 bool result) { | 255 bool result) { |
(...skipping 16 matching lines...) Expand all Loading... |
272 const device::OneWriterSeqLock& seqlock = buffer->seqlock.value(); | 272 const device::OneWriterSeqLock& seqlock = buffer->seqlock.value(); |
273 auto version = seqlock.ReadBegin(); | 273 auto version = seqlock.ReadBegin(); |
274 auto readingData = buffer->reading; | 274 auto readingData = buffer->reading; |
275 if (seqlock.ReadRetry(version)) | 275 if (seqlock.ReadRetry(version)) |
276 return false; | 276 return false; |
277 result = readingData; | 277 result = readingData; |
278 return true; | 278 return true; |
279 } | 279 } |
280 | 280 |
281 } // namespace blink | 281 } // namespace blink |
OLD | NEW |