Index: content/common/device_motion_hardware_buffer.h |
diff --git a/content/common/device_motion_hardware_buffer.h b/content/common/device_motion_hardware_buffer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6859be7c418bec94b8706ffb529cb6b07a6e3377 |
--- /dev/null |
+++ b/content/common/device_motion_hardware_buffer.h |
@@ -0,0 +1,35 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_COMMON_DEVICE_MOTION_HARDWARE_BUFFER_H_ |
+#define CONTENT_COMMON_DEVICE_MOTION_HARDWARE_BUFFER_H_ |
+ |
+#include "content/common/gamepad_seqlock.h" |
+#include "third_party/WebKit/public/platform/WebDeviceMotionData.h" |
+ |
+namespace content { |
+ |
+// This structure is stored in shared memory that's shared between the browser |
+// which does the hardware polling, and the consumers of the device motion |
+// data, i.e. the renderers. The performance characteristics are that |
+// we want low latency (so would like to avoid explicit communication via IPC |
+// between producer and consumer) and relatively large data size. |
+// |
+// Writer and reader operate on the same buffer assuming contention is low, and |
+// contention is detected by using the associated SeqLock. |
+ |
+struct DeviceMotionHardwareBuffer { |
+ GamepadSeqLock sequence; |
+ WebKit::WebDeviceMotionData buffer; |
+ |
+ // This boolean flag indicates that the values in the buffer are reliable and |
+ // ready for reading. This is needed in cases where no motion information is |
+ // available, but the event should be fired anyway (with null values) |
+ // according to spec: http://dev.w3.org/geo/api/spec-source-orientation.html. |
+ bool is_ready_for_read; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_COMMON_DEVICE_MOTION_HARDWARE_BUFFER_H_ |