Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(882)

Unified Diff: third_party/WebKit/Source/modules/sensor/SensorProxy.h

Issue 2395853003: [Sensors] Improvements in shared buffer managing (Closed)
Patch Set: Test compilation fix + comment from Ken Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/DEPS ('k') | third_party/WebKit/Source/modules/sensor/SensorProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698