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/SensorReadingUpdater.h" | 10 #include "modules/sensor/SensorReadingUpdater.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 bool result) { | 254 bool result) { |
255 if (!result) | 255 if (!result) |
256 DVLOG(1) << "Failure at sensor configuration removal"; | 256 DVLOG(1) << "Failure at sensor configuration removal"; |
257 | 257 |
258 size_t index = m_frequenciesUsed.find(frequency); | 258 size_t index = m_frequenciesUsed.find(frequency); |
259 if (index == kNotFound) { | 259 if (index == kNotFound) { |
260 // Could happen e.g. if 'handleSensorError' was called before. | 260 // Could happen e.g. if 'handleSensorError' was called before. |
261 return; | 261 return; |
262 } | 262 } |
263 | 263 |
264 m_frequenciesUsed.remove(index); | 264 m_frequenciesUsed.erase(index); |
265 } | 265 } |
266 | 266 |
267 bool SensorProxy::tryReadFromBuffer(device::SensorReading& result) { | 267 bool SensorProxy::tryReadFromBuffer(device::SensorReading& result) { |
268 DCHECK(isInitialized()); | 268 DCHECK(isInitialized()); |
269 const ReadingBuffer* buffer = | 269 const ReadingBuffer* buffer = |
270 static_cast<const ReadingBuffer*>(m_sharedBuffer.get()); | 270 static_cast<const ReadingBuffer*>(m_sharedBuffer.get()); |
271 const device::OneWriterSeqLock& seqlock = buffer->seqlock.value(); | 271 const device::OneWriterSeqLock& seqlock = buffer->seqlock.value(); |
272 auto version = seqlock.ReadBegin(); | 272 auto version = seqlock.ReadBegin(); |
273 auto readingData = buffer->reading; | 273 auto readingData = buffer->reading; |
274 if (seqlock.ReadRetry(version)) | 274 if (seqlock.ReadRetry(version)) |
275 return false; | 275 return false; |
276 result = readingData; | 276 result = readingData; |
277 return true; | 277 return true; |
278 } | 278 } |
279 | 279 |
280 } // namespace blink | 280 } // namespace blink |
OLD | NEW |