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

Side by Side Diff: device/gamepad/gamepad_shared_buffer.h

Issue 2808093006: [Device Service] Move Gamepad Blink headers to be part of the Gamepad client library (Closed)
Patch Set: rebase and address comments Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « device/gamepad/gamepad_service_unittest.cc ('k') | device/gamepad/gamepad_shared_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_GAMEPAD_SHARED_BUFFER_H_ 5 #ifndef DEVICE_GAMEPAD_SHARED_BUFFER_H_
6 #define DEVICE_GAMEPAD_SHARED_BUFFER_H_ 6 #define DEVICE_GAMEPAD_SHARED_BUFFER_H_
7 7
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "device/base/synchronization/shared_memory_seqlock_buffer.h" 9 #include "device/base/synchronization/shared_memory_seqlock_buffer.h"
10 #include "device/gamepad/gamepad_export.h" 10 #include "device/gamepad/gamepad_export.h"
11 #include "third_party/WebKit/public/platform/WebGamepads.h" 11 #include "device/gamepad/public/cpp/gamepads.h"
12 12
13 namespace device { 13 namespace device {
14 14
15 /* 15 /*
16 16
17 GamepadHardwareBuffer is stored in shared memory that's shared between the 17 GamepadHardwareBuffer is stored in shared memory that's shared between the
18 browser which does the hardware polling, and the various consumers of the 18 browser which does the hardware polling, and the various consumers of the
19 gamepad state (renderers and NaCl plugins). The performance characteristics are 19 gamepad state (renderers and NaCl plugins). The performance characteristics are
20 that we want low latency (so would like to avoid explicit communication via IPC 20 that we want low latency (so would like to avoid explicit communication via IPC
21 between producer and consumer) and relatively large data size. 21 between producer and consumer) and relatively large data size.
22 22
23 Writer and reader operate on the same buffer assuming contention is low, and 23 Writer and reader operate on the same buffer assuming contention is low, and
24 contention is detected by using the associated SeqLock. 24 contention is detected by using the associated SeqLock.
25 25
26 */ 26 */
27 27
28 typedef SharedMemorySeqLockBuffer<blink::WebGamepads> GamepadHardwareBuffer; 28 typedef SharedMemorySeqLockBuffer<Gamepads> GamepadHardwareBuffer;
29 29
30 class DEVICE_GAMEPAD_EXPORT GamepadSharedBuffer { 30 class DEVICE_GAMEPAD_EXPORT GamepadSharedBuffer {
31 public: 31 public:
32 GamepadSharedBuffer(); 32 GamepadSharedBuffer();
33 ~GamepadSharedBuffer(); 33 ~GamepadSharedBuffer();
34 34
35 base::SharedMemory* shared_memory(); 35 base::SharedMemory* shared_memory();
36 blink::WebGamepads* buffer(); 36 Gamepads* buffer();
37 GamepadHardwareBuffer* hardware_buffer(); 37 GamepadHardwareBuffer* hardware_buffer();
38 38
39 void WriteBegin(); 39 void WriteBegin();
40 void WriteEnd(); 40 void WriteEnd();
41 41
42 private: 42 private:
43 base::SharedMemory shared_memory_; 43 base::SharedMemory shared_memory_;
44 GamepadHardwareBuffer* hardware_buffer_; 44 GamepadHardwareBuffer* hardware_buffer_;
45 }; 45 };
46 46
47 } // namespace device 47 } // namespace device
48 48
49 #endif // DEVICE_GAMEPAD_SHARED_BUFFER_H_ 49 #endif // DEVICE_GAMEPAD_SHARED_BUFFER_H_
OLDNEW
« no previous file with comments | « device/gamepad/gamepad_service_unittest.cc ('k') | device/gamepad/gamepad_shared_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698