From 666018b3ddfdb0ff46800daae84f7be358fbeafc Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Fri, 9 Oct 2020 16:42:30 +0000 Subject: [PATCH] Bug 1657404 - Change PGamepadTestChannel to "refcounted protocol" r=handyman Depends on D93022 Differential Revision: https://phabricator.services.mozilla.com/D93023 --- dom/gamepad/GamepadServiceTest.cpp | 3 +-- dom/gamepad/ipc/PGamepadTestChannel.ipdl | 2 +- ipc/glue/BackgroundChildImpl.cpp | 14 -------------- ipc/glue/BackgroundChildImpl.h | 5 ----- ipc/glue/BackgroundParentImpl.cpp | 12 ++---------- ipc/glue/BackgroundParentImpl.h | 6 ++---- 6 files changed, 6 insertions(+), 36 deletions(-) diff --git a/dom/gamepad/GamepadServiceTest.cpp b/dom/gamepad/GamepadServiceTest.cpp index 6bff07ee1f12..d14a764e88c6 100644 --- a/dom/gamepad/GamepadServiceTest.cpp +++ b/dom/gamepad/GamepadServiceTest.cpp @@ -73,8 +73,7 @@ void GamepadServiceTest::InitPBackgroundActor() { mChild = GamepadTestChannelChild::Create(); PGamepadTestChannelChild* initedChild = - actor->SendPGamepadTestChannelConstructor( - RefPtr(mChild).forget().take()); + actor->SendPGamepadTestChannelConstructor(mChild.get()); if (NS_WARN_IF(!initedChild)) { MOZ_CRASH("Failed to create a PBackgroundChild actor!"); } diff --git a/dom/gamepad/ipc/PGamepadTestChannel.ipdl b/dom/gamepad/ipc/PGamepadTestChannel.ipdl index 5d81080ff2be..7cbe3f41d5a1 100644 --- a/dom/gamepad/ipc/PGamepadTestChannel.ipdl +++ b/dom/gamepad/ipc/PGamepadTestChannel.ipdl @@ -7,7 +7,7 @@ include GamepadEventTypes; namespace mozilla { namespace dom { -async protocol PGamepadTestChannel { +refcounted protocol PGamepadTestChannel { manager PBackground; parent: async GamepadTestEvent(uint32_t aID, GamepadChangeEvent aGamepadEvent); diff --git a/ipc/glue/BackgroundChildImpl.cpp b/ipc/glue/BackgroundChildImpl.cpp index ea5887f00978..307b134be98c 100644 --- a/ipc/glue/BackgroundChildImpl.cpp +++ b/ipc/glue/BackgroundChildImpl.cpp @@ -619,20 +619,6 @@ bool BackgroundChildImpl::DeallocPGamepadEventChannelChild( return true; } -dom::PGamepadTestChannelChild* -BackgroundChildImpl::AllocPGamepadTestChannelChild() { - MOZ_CRASH("PGamepadTestChannelChild actor should be manually constructed!"); - return nullptr; -} - -bool BackgroundChildImpl::DeallocPGamepadTestChannelChild( - PGamepadTestChannelChild* aActor) { - MOZ_ASSERT(aActor); - RefPtr child( - dont_AddRef(static_cast(aActor))); - return true; -} - mozilla::dom::PClientManagerChild* BackgroundChildImpl::AllocPClientManagerChild() { return mozilla::dom::AllocClientManagerChild(); diff --git a/ipc/glue/BackgroundChildImpl.h b/ipc/glue/BackgroundChildImpl.h index d7234cd6d7f5..e0c85637efe5 100644 --- a/ipc/glue/BackgroundChildImpl.h +++ b/ipc/glue/BackgroundChildImpl.h @@ -229,11 +229,6 @@ class BackgroundChildImpl : public PBackgroundChild, virtual bool DeallocPGamepadEventChannelChild( PGamepadEventChannelChild* aActor) override; - virtual PGamepadTestChannelChild* AllocPGamepadTestChannelChild() override; - - virtual bool DeallocPGamepadTestChannelChild( - PGamepadTestChannelChild* aActor) override; - virtual PClientManagerChild* AllocPClientManagerChild() override; virtual bool DeallocPClientManagerChild(PClientManagerChild* aActor) override; diff --git a/ipc/glue/BackgroundParentImpl.cpp b/ipc/glue/BackgroundParentImpl.cpp index 3f4430abef13..8aa3e0fa2f04 100644 --- a/ipc/glue/BackgroundParentImpl.cpp +++ b/ipc/glue/BackgroundParentImpl.cpp @@ -1120,17 +1120,9 @@ BackgroundParentImpl::RecvPGamepadEventChannelConstructor( return IPC_OK(); } -dom::PGamepadTestChannelParent* +already_AddRefed BackgroundParentImpl::AllocPGamepadTestChannelParent() { - return dom::GamepadTestChannelParent::Create().take(); -} - -bool BackgroundParentImpl::DeallocPGamepadTestChannelParent( - dom::PGamepadTestChannelParent* aActor) { - MOZ_ASSERT(aActor); - RefPtr parent = - dont_AddRef(static_cast(aActor)); - return true; + return dom::GamepadTestChannelParent::Create(); } dom::PWebAuthnTransactionParent* diff --git a/ipc/glue/BackgroundParentImpl.h b/ipc/glue/BackgroundParentImpl.h index 2edf092da483..134da3a70ca6 100644 --- a/ipc/glue/BackgroundParentImpl.h +++ b/ipc/glue/BackgroundParentImpl.h @@ -332,10 +332,8 @@ class BackgroundParentImpl : public PBackgroundParent, virtual mozilla::ipc::IPCResult RecvPGamepadEventChannelConstructor( PGamepadEventChannelParent* aActor) override; - virtual PGamepadTestChannelParent* AllocPGamepadTestChannelParent() override; - - virtual bool DeallocPGamepadTestChannelParent( - PGamepadTestChannelParent* aActor) override; + virtual already_AddRefed + AllocPGamepadTestChannelParent() override; virtual PWebAuthnTransactionParent* AllocPWebAuthnTransactionParent() override;