| OLD | NEW |
| 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/gamepad/gamepad_export.h" | 10 #include "device/gamepad/gamepad_export.h" |
| 10 #include "third_party/WebKit/public/platform/WebGamepads.h" | 11 #include "third_party/WebKit/public/platform/WebGamepads.h" |
| 11 | 12 |
| 12 namespace device { | 13 namespace device { |
| 13 | 14 |
| 15 typedef SharedMemorySeqLockBuffer<blink::WebGamepads> GamepadHardwareBuffer; |
| 16 |
| 14 class DEVICE_GAMEPAD_EXPORT GamepadSharedBuffer { | 17 class DEVICE_GAMEPAD_EXPORT GamepadSharedBuffer { |
| 15 public: | 18 public: |
| 16 virtual ~GamepadSharedBuffer() {} | 19 GamepadSharedBuffer(); |
| 20 ~GamepadSharedBuffer(); |
| 17 | 21 |
| 18 virtual base::SharedMemory* shared_memory() = 0; | 22 base::SharedMemory* shared_memory(); |
| 19 virtual blink::WebGamepads* buffer() = 0; | 23 blink::WebGamepads* buffer(); |
| 24 GamepadHardwareBuffer* hardware_buffer(); |
| 20 | 25 |
| 21 virtual void WriteBegin() = 0; | 26 void WriteBegin(); |
| 22 virtual void WriteEnd() = 0; | 27 void WriteEnd(); |
| 28 |
| 29 private: |
| 30 base::SharedMemory shared_memory_; |
| 31 GamepadHardwareBuffer* hardware_buffer_; |
| 23 }; | 32 }; |
| 24 | 33 |
| 25 } // namespace device | 34 } // namespace device |
| 26 | 35 |
| 27 #endif // DEVICE_GAMEPAD_SHARED_BUFFER_H_ | 36 #endif // DEVICE_GAMEPAD_SHARED_BUFFER_H_ |
| OLD | NEW |