Index: third_party/WebKit/Source/modules/sensor/SensorProxy.h |
diff --git a/third_party/WebKit/Source/modules/sensor/SensorProxy.h b/third_party/WebKit/Source/modules/sensor/SensorProxy.h |
index 70c87a2f15b4b5e194ef350aa14f311c55b13fa3..05c7c446b6f7d8a58ec576cd661ee3a616593ddb 100644 |
--- a/third_party/WebKit/Source/modules/sensor/SensorProxy.h |
+++ b/third_party/WebKit/Source/modules/sensor/SensorProxy.h |
@@ -6,6 +6,7 @@ |
#define SensorProxy_h |
#include "core/dom/ExceptionCode.h" |
+#include "device/generic_sensor/public/cpp/sensor_reading.h" |
#include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" |
#include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h" |
#include "mojo/public/cpp/bindings/binding.h" |
@@ -60,13 +61,7 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>, |
device::mojom::blink::SensorType type() const { return m_type; } |
device::mojom::blink::ReportingMode reportingMode() const { return m_mode; } |
- struct Reading { |
- double timestamp; |
- double reading[3]; |
- }; |
- static_assert(sizeof(Reading) == |
- device::mojom::blink::SensorInitParams::kReadBufferSize, |
- "Check reading size"); |
+ using Reading = device::SensorReading; |
const Reading& reading() const { return m_reading; } |
@@ -93,6 +88,8 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>, |
void onSensorCreated(device::mojom::blink::SensorInitParamsPtr, |
device::mojom::blink::SensorClientRequest); |
+ bool tryReadFromBuffer(); |
+ |
device::mojom::blink::SensorType m_type; |
device::mojom::blink::ReportingMode m_mode; |
Member<SensorProviderProxy> m_provider; |
@@ -109,6 +106,11 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>, |
mojo::ScopedSharedBufferMapping m_sharedBuffer; |
Reading m_reading; |
bool m_suspended; |
+ using ReadingBuffer = device::SensorReadingSharedBuffer; |
+ static_assert( |
+ sizeof(ReadingBuffer) == |
+ device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, |
+ "Check reading buffer size for tests"); |
}; |
} // namespace blink |