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

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

Issue 2395853003: [Sensors] Improvements in shared buffer managing (Closed)
Patch Set: 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 9e41bd3a56bb3ccf5cfecc56dc02410bf4f824f2..82e5e3164160bf45792ddb1a54681c32d2d88a8f 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorProxy.h
+++ b/third_party/WebKit/Source/modules/sensor/SensorProxy.h
@@ -5,6 +5,7 @@
#ifndef SensorProxy_h
#define SensorProxy_h
+#include "device/base/synchronization/shared_memory_seqlock_buffer.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"
@@ -57,13 +58,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::mojom::blink::SensorReading;
const Reading& reading() const { return m_reading; }
@@ -104,6 +99,7 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>,
mojo::ScopedSharedBufferMapping m_sharedBuffer;
Reading m_reading;
bool m_suspended;
+ using ReadingBuffer = device::SharedMemorySeqLockBuffer<Reading>;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698