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

Side by Side Diff: content/renderer/gamepad_shared_memory_reader.h

Issue 2580693003: Decouple GamepadSharedMemory into Blink.
Patch Set: add typemapping, non-copyable Created 4 years 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 | « content/renderer/BUILD.gn ('k') | content/renderer/gamepad_shared_memory_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_
6 #define CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "content/public/renderer/renderer_gamepad_provider.h"
12 #include "device/base/synchronization/shared_memory_seqlock_buffer.h"
13 #include "device/gamepad/public/interfaces/gamepad.mojom.h"
14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "mojo/public/cpp/system/buffer.h"
16 #include "third_party/WebKit/public/platform/WebGamepads.h"
17
18 namespace content {
19
20 typedef device::SharedMemorySeqLockBuffer<blink::WebGamepads>
21 GamepadHardwareBuffer;
22
23 class GamepadSharedMemoryReader : public RendererGamepadProvider,
24 public device::mojom::GamepadObserver {
25 public:
26 explicit GamepadSharedMemoryReader(RenderThread* thread);
27 ~GamepadSharedMemoryReader() override;
28
29 // RendererGamepadProvider implementation.
30 void SampleGamepads(blink::WebGamepads& gamepads) override;
31 void Start(blink::WebPlatformEventListener* listener) override;
32
33 protected:
34 // PlatformEventObserver protected methods.
35 void SendStartMessage() override;
36 void SendStopMessage() override;
37
38 private:
39 // device::mojom::GamepadObserver methods.
40 void GamepadConnected(int index, const blink::WebGamepad& gamepad) override;
41 void GamepadDisconnected(int index,
42 const blink::WebGamepad& gamepad) override;
43
44 mojo::ScopedSharedBufferHandle renderer_shared_buffer_handle_;
45 mojo::ScopedSharedBufferMapping renderer_shared_buffer_mapping_;
46 GamepadHardwareBuffer* gamepad_hardware_buffer_;
47
48 bool ever_interacted_with_;
49
50 mojo::Binding<device::mojom::GamepadObserver> binding_;
51 device::mojom::GamepadMonitorPtr gamepad_monitor_;
52
53 DISALLOW_COPY_AND_ASSIGN(GamepadSharedMemoryReader);
54 };
55
56 } // namespace content
57
58 #endif // CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_
OLDNEW
« no previous file with comments | « content/renderer/BUILD.gn ('k') | content/renderer/gamepad_shared_memory_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698