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_SHARED_MEMORY_SEQLOCK_BUFFER_H_ | |
6 #define CONTENT_COMMON_SHARED_MEMORY_SEQLOCK_BUFFER_H_ | |
7 | |
8 #include "content/common/one_writer_seqlock.h" | |
9 | |
10 namespace content { | |
11 | |
12 // This structure is stored in shared memory that's shared between the browser | |
13 // which does the hardware polling, and the consumers of the device motion | |
scottmg
2013/06/24 23:24:38
being that this is currently device motion specifi
timvolodine
2013/06/25 03:36:07
Yes, the idea is to use this for the gamepad code
| |
14 // data, i.e. the renderers. The performance characteristics are that | |
15 // we want low latency (so would like to avoid explicit communication via IPC | |
16 // between producer and consumer) and relatively large data size. | |
17 // | |
18 // Writer and reader operate on the same buffer assuming contention is low, and | |
19 // contention is detected by using the associated SeqLock. | |
20 | |
21 class SharedMemorySeqLockBufferBase { | |
22 public: | |
23 OneWriterSeqLock seqlock; | |
24 | |
25 // This boolean is used to indicate the state of the buffer, | |
26 // it is not used for locking. | |
27 bool is_ready_for_read; | |
scottmg
2013/06/24 23:24:38
(unrelated to looking at gamepad changes, but) thi
timvolodine
2013/06/25 03:36:07
ok, I've moved this field to WebDeviceMotionData,
| |
28 }; | |
29 | |
30 template<class Data> | |
31 class SharedMemorySeqLockBuffer : public SharedMemorySeqLockBufferBase { | |
darin (slow to review)
2013/06/24 23:40:34
nit: Since there are no methods here, it seems lik
timvolodine
2013/06/25 03:36:07
The base buffer class is used by the shared_memory
| |
32 public: | |
33 Data data; | |
34 }; | |
35 | |
36 } // namespace content | |
37 | |
38 #endif // CONTENT_COMMON_SHARED_MEMORY_SEQLOCK_BUFFER_H_ | |
OLD | NEW |