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

Side by Side Diff: third_party/WebKit/Source/modules/gamepad/GamepadSharedMemoryReader.h

Issue 2580693003: Decouple GamepadSharedMemory into Blink.
Patch Set: 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
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 GamepadSharedMemoryReader_h
6 #define GamepadSharedMemoryReader_h
7
8 //#include "base/macros.h" //heke:DISALLOW_COPY_AND_ASSIGN
9 #include "device/base/synchronization/shared_memory_seqlock_buffer.h"
10 #include "device/gamepad/public/interfaces/gamepad.mojom-blink.h"
11 #include "mojo/public/cpp/bindings/binding.h"
12 #include "mojo/public/cpp/system/buffer.h"
13 #include "public/platform/WebGamepadListener.h"
14 #include "public/platform/WebGamepads.h"
15
16 namespace blink {
17
18 typedef device::SharedMemorySeqLockBuffer<WebGamepads> GamepadHardwareBuffer;
19
20 class InterfaceProvider;
21
22 class GamepadSharedMemoryReader final
23 : public device::mojom::blink::GamepadObserver { // heke:export?
24 // SampleGamepads..
25 public:
26 explicit GamepadSharedMemoryReader(InterfaceProvider*);
27 ~GamepadSharedMemoryReader() override;
28
29 void sampleGamepads(WebGamepads&);
30 void start(WebGamepadListener*);
31 void stop();
32
33 protected:
34 void sendStartMessage();
35 void sendStopMessage();
36
37 private:
38 // device::mojom::GamepadObserver methods.
39 void GamepadConnected(int index, const WebGamepad&) override;
40 void GamepadDisconnected(int index, const WebGamepad&) override;
41
42 mojo::ScopedSharedBufferHandle m_sharedBufferHandle;
43 mojo::ScopedSharedBufferMapping m_sharedBufferMapping;
44 GamepadHardwareBuffer* m_gamepadHardwareBuffer;
45
46 bool m_everInteracted;
47 bool m_isObserving;
48
49 mojo::Binding<device::mojom::blink::GamepadObserver> m_binding;
50 device::mojom::GamepadMonitorPtr m_gamepadMonitor;
51 WebGamepadListener* m_listener;
52
53 DISALLOW_COPY_AND_ASSIGN(GamepadSharedMemoryReader);
54 };
55
56 } // namespace blink
57
58 #endif // GamepadSharedMemoryReader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698