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 "device/generic_sensor/public/cpp/sensor_reading.h" | 9 #include "device/generic_sensor/public/cpp/sensor_reading.h" |
10 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" | 10 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 device::mojom::blink::SensorType type() const { return m_type; } | 63 device::mojom::blink::SensorType type() const { return m_type; } |
64 device::mojom::blink::ReportingMode reportingMode() const { return m_mode; } | 64 device::mojom::blink::ReportingMode reportingMode() const { return m_mode; } |
65 | 65 |
66 // The |SensorReading| instance which is shared between sensor instances | 66 // The |SensorReading| instance which is shared between sensor instances |
67 // of the same type. | 67 // of the same type. |
68 // Note: the returned value is reset after updateSensorReading() call. | 68 // Note: the returned value is reset after updateSensorReading() call. |
69 SensorReading* sensorReading() const { return m_reading; } | 69 SensorReading* sensorReading() const { return m_reading; } |
70 | 70 |
71 const device::mojom::blink::SensorConfiguration* defaultConfig() const; | 71 const device::mojom::blink::SensorConfiguration* defaultConfig() const; |
72 | 72 |
| 73 double maximumFrequency() const { return m_maximumFrequency; } |
| 74 |
73 // Updates sensor reading from shared buffer. | 75 // Updates sensor reading from shared buffer. |
74 void updateSensorReading(); | 76 void updateSensorReading(); |
75 | 77 |
76 DECLARE_VIRTUAL_TRACE(); | 78 DECLARE_VIRTUAL_TRACE(); |
77 | 79 |
78 private: | 80 private: |
79 friend class SensorProviderProxy; | 81 friend class SensorProviderProxy; |
80 SensorProxy(device::mojom::blink::SensorType, | 82 SensorProxy(device::mojom::blink::SensorType, |
81 SensorProviderProxy*, | 83 SensorProviderProxy*, |
82 std::unique_ptr<SensorReadingFactory>); | 84 std::unique_ptr<SensorReadingFactory>); |
(...skipping 23 matching lines...) Expand all Loading... |
106 device::mojom::blink::SensorConfigurationPtr m_defaultConfig; | 108 device::mojom::blink::SensorConfigurationPtr m_defaultConfig; |
107 mojo::Binding<device::mojom::blink::SensorClient> m_clientBinding; | 109 mojo::Binding<device::mojom::blink::SensorClient> m_clientBinding; |
108 | 110 |
109 enum State { Uninitialized, Initializing, Initialized }; | 111 enum State { Uninitialized, Initializing, Initialized }; |
110 State m_state; | 112 State m_state; |
111 mojo::ScopedSharedBufferHandle m_sharedBufferHandle; | 113 mojo::ScopedSharedBufferHandle m_sharedBufferHandle; |
112 mojo::ScopedSharedBufferMapping m_sharedBuffer; | 114 mojo::ScopedSharedBufferMapping m_sharedBuffer; |
113 bool m_suspended; | 115 bool m_suspended; |
114 Member<SensorReading> m_reading; | 116 Member<SensorReading> m_reading; |
115 std::unique_ptr<SensorReadingFactory> m_readingFactory; | 117 std::unique_ptr<SensorReadingFactory> m_readingFactory; |
| 118 double m_maximumFrequency; |
116 | 119 |
117 using ReadingBuffer = device::SensorReadingSharedBuffer; | 120 using ReadingBuffer = device::SensorReadingSharedBuffer; |
118 static_assert( | 121 static_assert( |
119 sizeof(ReadingBuffer) == | 122 sizeof(ReadingBuffer) == |
120 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, | 123 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, |
121 "Check reading buffer size for tests"); | 124 "Check reading buffer size for tests"); |
122 }; | 125 }; |
123 | 126 |
124 } // namespace blink | 127 } // namespace blink |
125 | 128 |
126 #endif // SensorProxy_h | 129 #endif // SensorProxy_h |
OLD | NEW |