GamepadTestChannelParent.h (1660B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "mozilla/WeakPtr.h" 8 #include "mozilla/dom/PGamepadTestChannelParent.h" 9 10 #ifndef mozilla_dom_GamepadTestChannelParent_h_ 11 # define mozilla_dom_GamepadTestChannelParent_h_ 12 13 namespace mozilla::dom { 14 15 class GamepadTestChannelParent final : public PGamepadTestChannelParent, 16 public SupportsWeakPtr { 17 public: 18 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GamepadTestChannelParent) 19 20 static already_AddRefed<GamepadTestChannelParent> Create(); 21 22 mozilla::ipc::IPCResult RecvGamepadTestEvent( 23 const uint32_t& aID, const GamepadChangeEvent& aGamepadEvent); 24 25 void OnMonitoringStateChanged(bool aNewState); 26 27 GamepadTestChannelParent(const GamepadTestChannelParent&) = delete; 28 GamepadTestChannelParent(GamepadTestChannelParent&&) = delete; 29 GamepadTestChannelParent& operator=(const GamepadTestChannelParent&) = delete; 30 GamepadTestChannelParent& operator=(GamepadTestChannelParent&&) = delete; 31 32 private: 33 struct DeferredGamepadAdded { 34 uint32_t promiseId; 35 GamepadAdded gamepadAdded; 36 }; 37 38 GamepadTestChannelParent(); 39 ~GamepadTestChannelParent(); 40 41 void AddGamepadToPlatformService(uint32_t aPromiseId, 42 const GamepadAdded& aGamepadAdded); 43 44 nsTArray<DeferredGamepadAdded> mDeferredGamepadAdded; 45 }; 46 47 } // namespace mozilla::dom 48 49 #endif