From c5f2277f3b6b5a5298e6468aa4b7f9d9f912e290 Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Fri, 9 Oct 2020 16:41:41 +0000 Subject: [PATCH] Bug 1657404 - Remove old IPDL workaround from GamepadTestChannelParent r=handyman Differential Revision: https://phabricator.services.mozilla.com/D93019 --- dom/gamepad/GamepadServiceTest.cpp | 3 ++- dom/gamepad/ipc/GamepadTestChannelParent.cpp | 11 ++--------- dom/gamepad/ipc/GamepadTestChannelParent.h | 7 ++++--- dom/gamepad/ipc/PGamepadTestChannel.ipdl | 3 +-- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/dom/gamepad/GamepadServiceTest.cpp b/dom/gamepad/GamepadServiceTest.cpp index 383ab92e8bde..4c6bc6a7f515 100644 --- a/dom/gamepad/GamepadServiceTest.cpp +++ b/dom/gamepad/GamepadServiceTest.cpp @@ -80,7 +80,8 @@ void GamepadServiceTest::InitPBackgroundActor() { } void GamepadServiceTest::DestroyPBackgroundActor() { - mChild->SendShutdownChannel(); + MOZ_ASSERT(mChild); + PGamepadTestChannelChild::Send__delete__(mChild); mChild = nullptr; } diff --git a/dom/gamepad/ipc/GamepadTestChannelParent.cpp b/dom/gamepad/ipc/GamepadTestChannelParent.cpp index 1b79a592e450..1feb80ce3e3a 100644 --- a/dom/gamepad/ipc/GamepadTestChannelParent.cpp +++ b/dom/gamepad/ipc/GamepadTestChannelParent.cpp @@ -47,9 +47,8 @@ void GamepadTestChannelParent::AddGamepadToPlatformService( gamepadID.get(), static_cast(a.mapping()), a.hand(), a.num_buttons(), a.num_axes(), a.num_haptics(), a.num_lights(), a.num_touches()); - if (!mShuttingdown) { - Unused << SendReplyGamepadIndex(aPromiseId, index); - } + + Unused << SendReplyGamepadIndex(aPromiseId, index); } void GamepadTestChannelParent::OnMonitoringStateChanged(bool aNewState) { @@ -123,11 +122,5 @@ mozilla::ipc::IPCResult GamepadTestChannelParent::RecvGamepadTestEvent( return IPC_FAIL_NO_REASON(this); } -mozilla::ipc::IPCResult GamepadTestChannelParent::RecvShutdownChannel() { - mShuttingdown = true; - Unused << Send__delete__(this); - return IPC_OK(); -} - } // namespace dom } // namespace mozilla diff --git a/dom/gamepad/ipc/GamepadTestChannelParent.h b/dom/gamepad/ipc/GamepadTestChannelParent.h index 9b2aa5cee831..1d53bcc79427 100644 --- a/dom/gamepad/ipc/GamepadTestChannelParent.h +++ b/dom/gamepad/ipc/GamepadTestChannelParent.h @@ -15,12 +15,14 @@ namespace dom { class GamepadTestChannelParent final : public PGamepadTestChannelParent { public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GamepadTestChannelParent) - GamepadTestChannelParent() : mShuttingdown(false) {} + + GamepadTestChannelParent() = default; + bool Init(); void ActorDestroy(ActorDestroyReason aWhy) override; + mozilla::ipc::IPCResult RecvGamepadTestEvent( const uint32_t& aID, const GamepadChangeEvent& aGamepadEvent); - mozilla::ipc::IPCResult RecvShutdownChannel(); void OnMonitoringStateChanged(bool aNewState); @@ -32,7 +34,6 @@ class GamepadTestChannelParent final : public PGamepadTestChannelParent { void AddGamepadToPlatformService(uint32_t aPromiseId, const GamepadAdded& aGamepadAdded); ~GamepadTestChannelParent() = default; - bool mShuttingdown; nsTArray mDeferredGamepadAdded; }; diff --git a/dom/gamepad/ipc/PGamepadTestChannel.ipdl b/dom/gamepad/ipc/PGamepadTestChannel.ipdl index 57b694acc369..5d81080ff2be 100644 --- a/dom/gamepad/ipc/PGamepadTestChannel.ipdl +++ b/dom/gamepad/ipc/PGamepadTestChannel.ipdl @@ -11,9 +11,8 @@ async protocol PGamepadTestChannel { manager PBackground; parent: async GamepadTestEvent(uint32_t aID, GamepadChangeEvent aGamepadEvent); - async ShutdownChannel(); - child: async __delete__(); + child: async ReplyGamepadIndex(uint32_t aID, uint32_t aIndex); };