OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_ | 5 #ifndef CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_ |
6 #define CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_ | 6 #define CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
12 #include "content/public/renderer/renderer_gamepad_provider.h" | 12 #include "content/public/renderer/renderer_gamepad_provider.h" |
| 13 #include "device/base/synchronization/shared_memory_seqlock_buffer.h" |
13 #include "device/gamepad/public/interfaces/gamepad.mojom.h" | 14 #include "device/gamepad/public/interfaces/gamepad.mojom.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
15 #include "mojo/public/cpp/system/platform_handle.h" | 16 #include "mojo/public/cpp/system/platform_handle.h" |
16 #include "third_party/WebKit/public/platform/WebGamepads.h" | 17 #include "third_party/WebKit/public/platform/WebGamepads.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 struct GamepadHardwareBuffer; | 21 typedef device::SharedMemorySeqLockBuffer<blink::WebGamepads> |
| 22 GamepadHardwareBuffer; |
21 | 23 |
22 class GamepadSharedMemoryReader : public RendererGamepadProvider, | 24 class GamepadSharedMemoryReader : public RendererGamepadProvider, |
23 public device::mojom::GamepadObserver { | 25 public device::mojom::GamepadObserver { |
24 public: | 26 public: |
25 explicit GamepadSharedMemoryReader(RenderThread* thread); | 27 explicit GamepadSharedMemoryReader(RenderThread* thread); |
26 ~GamepadSharedMemoryReader() override; | 28 ~GamepadSharedMemoryReader() override; |
27 | 29 |
28 // RendererGamepadProvider implementation. | 30 // RendererGamepadProvider implementation. |
29 void SampleGamepads(blink::WebGamepads& gamepads) override; | 31 void SampleGamepads(blink::WebGamepads& gamepads) override; |
30 void Start(blink::WebPlatformEventListener* listener) override; | 32 void Start(blink::WebPlatformEventListener* listener) override; |
(...skipping 17 matching lines...) Expand all Loading... |
48 | 50 |
49 mojo::Binding<device::mojom::GamepadObserver> binding_; | 51 mojo::Binding<device::mojom::GamepadObserver> binding_; |
50 device::mojom::GamepadMonitorPtr gamepad_monitor_; | 52 device::mojom::GamepadMonitorPtr gamepad_monitor_; |
51 | 53 |
52 DISALLOW_COPY_AND_ASSIGN(GamepadSharedMemoryReader); | 54 DISALLOW_COPY_AND_ASSIGN(GamepadSharedMemoryReader); |
53 }; | 55 }; |
54 | 56 |
55 } // namespace content | 57 } // namespace content |
56 | 58 |
57 #endif // CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_ | 59 #endif // CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_ |
OLD | NEW |