Bug 1657404 - Change PGamepadTestChannel to "refcounted protocol" r=handyman

Differential Revision: https://phabricator.services.mozilla.com/D93023
This commit is contained in:
Chris Martin 2020-10-14 20:33:55 +00:00
Родитель bcd28df3be
Коммит e2f2de6530
7 изменённых файлов: 11 добавлений и 36 удалений

Просмотреть файл

@ -73,8 +73,7 @@ void GamepadServiceTest::InitPBackgroundActor() {
mChild = GamepadTestChannelChild::Create();
PGamepadTestChannelChild* initedChild =
actor->SendPGamepadTestChannelConstructor(
RefPtr<GamepadTestChannelChild>(mChild).forget().take());
actor->SendPGamepadTestChannelConstructor(mChild.get());
if (NS_WARN_IF(!initedChild)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -14,6 +14,11 @@ let is = window.parent.is;
let SimpleTest = window.parent.SimpleTest;
let SpecialPowers = window.parent.SpecialPowers;
// This should be held for the entire time the testing API is being used to
// ensure monitoring has been started and that a single GamepadPlatformService
// instance is used for the entire test
var GamepadsKungFuDeathGrip = navigator.getGamepads();
// Due to gamepad being a polling API instead of event driven, test ordering
// ends up being a little weird in order to deal with e10s. Calls to
// GamepadService are async across processes, so we'll need to make sure

Просмотреть файл

@ -605,20 +605,6 @@ bool BackgroundChildImpl::DeallocPMIDIManagerChild(PMIDIManagerChild* aActor) {
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<dom::GamepadTestChannelChild> child(
dont_AddRef(static_cast<dom::GamepadTestChannelChild*>(aActor)));
return true;
}
mozilla::dom::PClientManagerChild*
BackgroundChildImpl::AllocPClientManagerChild() {
return mozilla::dom::AllocClientManagerChild();

Просмотреть файл

@ -223,11 +223,6 @@ class BackgroundChildImpl : public PBackgroundChild,
virtual bool DeallocPQuotaChild(PQuotaChild* aActor) override;
virtual PGamepadTestChannelChild* AllocPGamepadTestChannelChild() override;
virtual bool DeallocPGamepadTestChannelChild(
PGamepadTestChannelChild* aActor) override;
virtual PClientManagerChild* AllocPClientManagerChild() override;
virtual bool DeallocPClientManagerChild(PClientManagerChild* aActor) override;

Просмотреть файл

@ -1140,17 +1140,9 @@ BackgroundParentImpl::AllocPGamepadEventChannelParent() {
return dom::GamepadEventChannelParent::Create();
}
dom::PGamepadTestChannelParent*
already_AddRefed<dom::PGamepadTestChannelParent>
BackgroundParentImpl::AllocPGamepadTestChannelParent() {
return dom::GamepadTestChannelParent::Create().take();
}
bool BackgroundParentImpl::DeallocPGamepadTestChannelParent(
dom::PGamepadTestChannelParent* aActor) {
MOZ_ASSERT(aActor);
RefPtr<dom::GamepadTestChannelParent> parent =
dont_AddRef(static_cast<dom::GamepadTestChannelParent*>(aActor));
return true;
return dom::GamepadTestChannelParent::Create();
}
dom::PWebAuthnTransactionParent*

Просмотреть файл

@ -336,10 +336,8 @@ class BackgroundParentImpl : public PBackgroundParent,
virtual already_AddRefed<PGamepadEventChannelParent>
AllocPGamepadEventChannelParent() override;
virtual PGamepadTestChannelParent* AllocPGamepadTestChannelParent() override;
virtual bool DeallocPGamepadTestChannelParent(
PGamepadTestChannelParent* aActor) override;
virtual already_AddRefed<PGamepadTestChannelParent>
AllocPGamepadTestChannelParent() override;
virtual PWebAuthnTransactionParent* AllocPWebAuthnTransactionParent()
override;