OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_COMMON_DEVICE_MOTION_HARDWARE_BUFFER_H_ |
| 6 #define CONTENT_COMMON_DEVICE_MOTION_HARDWARE_BUFFER_H_ |
| 7 |
| 8 #include "content/common/gamepad_seqlock.h" |
| 9 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 // This structure is stored in shared memory that's shared between the browser |
| 14 // which does the hardware polling, and the consumers of the device motion |
| 15 // data, i.e. the renderers. The performance characteristics are that |
| 16 // we want low latency (so would like to avoid explicit communication via IPC |
| 17 // between producer and consumer) and relatively large data size. |
| 18 // |
| 19 // Writer and reader operate on the same buffer assuming contention is low, and |
| 20 // contention is detected by using the associated SeqLock. |
| 21 |
| 22 struct DeviceMotionHardwareBuffer { |
| 23 GamepadSeqLock sequence; |
| 24 WebKit::WebDeviceMotionData buffer; |
| 25 |
| 26 // This boolean flag indicates that the values in the buffer are reliable and |
| 27 // ready for reading. This is needed in cases where no motion information is |
| 28 // available, but the event should be fired anyway (with null values) |
| 29 // according to spec: http://dev.w3.org/geo/api/spec-source-orientation.html. |
| 30 bool is_ready_for_read; |
| 31 }; |
| 32 |
| 33 } // namespace content |
| 34 |
| 35 #endif // CONTENT_COMMON_DEVICE_MOTION_HARDWARE_BUFFER_H_ |
OLD | NEW |