| 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 #ifndef SensorProxy_h | 5 #ifndef SensorProxy_h |
| 6 #define SensorProxy_h | 6 #define SensorProxy_h |
| 7 | 7 |
| 8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
| 9 #include "core/page/PageVisibilityObserver.h" | 9 #include "core/page/PageVisibilityObserver.h" |
| 10 #include "device/generic_sensor/public/cpp/sensor_reading.h" | 10 #include "device/generic_sensor/public/cpp/sensor_reading.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void resume(); | 74 void resume(); |
| 75 | 75 |
| 76 device::mojom::blink::SensorType type() const { return m_type; } | 76 device::mojom::blink::SensorType type() const { return m_type; } |
| 77 device::mojom::blink::ReportingMode reportingMode() const { return m_mode; } | 77 device::mojom::blink::ReportingMode reportingMode() const { return m_mode; } |
| 78 | 78 |
| 79 // Note: the returned value is reset after updateSensorReading() call. | 79 // Note: the returned value is reset after updateSensorReading() call. |
| 80 const device::SensorReading& reading() const { return m_reading; } | 80 const device::SensorReading& reading() const { return m_reading; } |
| 81 | 81 |
| 82 const device::mojom::blink::SensorConfiguration* defaultConfig() const; | 82 const device::mojom::blink::SensorConfiguration* defaultConfig() const; |
| 83 | 83 |
| 84 double maximumFrequency() const { return m_maximumFrequency; } | 84 const std::pair<double, double>& frequencyLimits() const { |
| 85 return m_frequencyLimits; |
| 86 } |
| 85 | 87 |
| 86 Document* document() const; | 88 Document* document() const; |
| 87 const WTF::Vector<double>& frequenciesUsed() const { | 89 const WTF::Vector<double>& frequenciesUsed() const { |
| 88 return m_frequenciesUsed; | 90 return m_frequenciesUsed; |
| 89 } | 91 } |
| 90 | 92 |
| 91 DECLARE_VIRTUAL_TRACE(); | 93 DECLARE_VIRTUAL_TRACE(); |
| 92 | 94 |
| 93 private: | 95 private: |
| 94 friend class SensorProviderProxy; | 96 friend class SensorProviderProxy; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 device::mojom::blink::SensorPtr m_sensor; | 135 device::mojom::blink::SensorPtr m_sensor; |
| 134 device::mojom::blink::SensorConfigurationPtr m_defaultConfig; | 136 device::mojom::blink::SensorConfigurationPtr m_defaultConfig; |
| 135 mojo::Binding<device::mojom::blink::SensorClient> m_clientBinding; | 137 mojo::Binding<device::mojom::blink::SensorClient> m_clientBinding; |
| 136 | 138 |
| 137 enum State { Uninitialized, Initializing, Initialized }; | 139 enum State { Uninitialized, Initializing, Initialized }; |
| 138 State m_state; | 140 State m_state; |
| 139 mojo::ScopedSharedBufferHandle m_sharedBufferHandle; | 141 mojo::ScopedSharedBufferHandle m_sharedBufferHandle; |
| 140 mojo::ScopedSharedBufferMapping m_sharedBuffer; | 142 mojo::ScopedSharedBufferMapping m_sharedBuffer; |
| 141 bool m_suspended; | 143 bool m_suspended; |
| 142 device::SensorReading m_reading; | 144 device::SensorReading m_reading; |
| 143 double m_maximumFrequency; | 145 std::pair<double, double> m_frequencyLimits; |
| 144 | 146 |
| 145 Member<SensorReadingUpdater> m_readingUpdater; | 147 Member<SensorReadingUpdater> m_readingUpdater; |
| 146 WTF::Vector<double> m_frequenciesUsed; | 148 WTF::Vector<double> m_frequenciesUsed; |
| 147 double m_lastRafTimestamp; | 149 double m_lastRafTimestamp; |
| 148 | 150 |
| 149 using ReadingBuffer = device::SensorReadingSharedBuffer; | 151 using ReadingBuffer = device::SensorReadingSharedBuffer; |
| 150 static_assert( | 152 static_assert( |
| 151 sizeof(ReadingBuffer) == | 153 sizeof(ReadingBuffer) == |
| 152 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, | 154 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, |
| 153 "Check reading buffer size for tests"); | 155 "Check reading buffer size for tests"); |
| 154 }; | 156 }; |
| 155 | 157 |
| 156 } // namespace blink | 158 } // namespace blink |
| 157 | 159 |
| 158 #endif // SensorProxy_h | 160 #endif // SensorProxy_h |
| OLD | NEW |