| OLD | NEW |
| (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 "device/base/synchronization/shared_memory_seqlock_buffer.h" |
| 9 #include "device/gamepad/public/interfaces/gamepad.mojom-blink.h" |
| 10 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "mojo/public/cpp/system/buffer.h" |
| 12 #include "public/platform/WebGamepadListener.h" |
| 13 #include "public/platform/WebGamepads.h" |
| 14 #include "wtf/Noncopyable.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:: |
| 24 GamepadObserver { // heke:export?SampleGamepads.. |
| 25 WTF_MAKE_NONCOPYABLE(GamepadSharedMemoryReader); |
| 26 |
| 27 public: |
| 28 explicit GamepadSharedMemoryReader(InterfaceProvider*); |
| 29 ~GamepadSharedMemoryReader() override; |
| 30 |
| 31 void sampleGamepads(WebGamepads&); |
| 32 void start(WebGamepadListener*); |
| 33 void stop(); |
| 34 |
| 35 protected: |
| 36 void sendStartMessage(); |
| 37 void sendStopMessage(); |
| 38 |
| 39 private: |
| 40 // device::mojom::blink::GamepadObserver methods. |
| 41 void GamepadConnected(int index, const ::blink::WebGamepad&) override; |
| 42 void GamepadDisconnected(int index, const ::blink::WebGamepad&) override; |
| 43 |
| 44 mojo::ScopedSharedBufferHandle m_sharedBufferHandle; |
| 45 mojo::ScopedSharedBufferMapping m_sharedBufferMapping; |
| 46 GamepadHardwareBuffer* m_gamepadHardwareBuffer; |
| 47 |
| 48 bool m_everInteracted; |
| 49 bool m_isObserving; |
| 50 |
| 51 mojo::Binding<device::mojom::blink::GamepadObserver> m_binding; |
| 52 device::mojom::blink::GamepadMonitorPtr m_gamepadMonitor; |
| 53 WebGamepadListener* m_listener; |
| 54 }; |
| 55 |
| 56 } // namespace blink |
| 57 |
| 58 #endif // GamepadSharedMemoryReader_h |
| OLD | NEW |