зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1657404 - Prepare GamepadTestChannelParent for "refcounted protocol" r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D93021
This commit is contained in:
Родитель
a09ab4afe6
Коммит
54487648eb
|
@ -12,18 +12,21 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
bool GamepadTestChannelParent::Init() {
|
||||
already_AddRefed<GamepadTestChannelParent> GamepadTestChannelParent::Create() {
|
||||
return RefPtr<GamepadTestChannelParent>(new GamepadTestChannelParent())
|
||||
.forget();
|
||||
}
|
||||
|
||||
GamepadTestChannelParent::GamepadTestChannelParent() {
|
||||
AssertIsOnBackgroundThread();
|
||||
RefPtr<GamepadPlatformService> service =
|
||||
GamepadPlatformService::GetParentService();
|
||||
MOZ_ASSERT(service);
|
||||
|
||||
service->GetMonitoringState().AddObserver(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GamepadTestChannelParent::ActorDestroy(ActorDestroyReason aWhy) {
|
||||
GamepadTestChannelParent::~GamepadTestChannelParent() {
|
||||
AssertIsOnBackgroundThread();
|
||||
RefPtr<GamepadPlatformService> service =
|
||||
GamepadPlatformService::GetParentService();
|
||||
|
|
|
@ -18,24 +18,30 @@ class GamepadTestChannelParent final : public PGamepadTestChannelParent,
|
|||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GamepadTestChannelParent)
|
||||
|
||||
GamepadTestChannelParent() = default;
|
||||
|
||||
bool Init();
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
static already_AddRefed<GamepadTestChannelParent> Create();
|
||||
|
||||
mozilla::ipc::IPCResult RecvGamepadTestEvent(
|
||||
const uint32_t& aID, const GamepadChangeEvent& aGamepadEvent);
|
||||
|
||||
void OnMonitoringStateChanged(bool aNewState);
|
||||
|
||||
GamepadTestChannelParent(const GamepadTestChannelParent&) = delete;
|
||||
GamepadTestChannelParent(GamepadTestChannelParent&&) = delete;
|
||||
GamepadTestChannelParent& operator=(const GamepadTestChannelParent&) = delete;
|
||||
GamepadTestChannelParent& operator=(GamepadTestChannelParent&&) = delete;
|
||||
|
||||
private:
|
||||
struct DeferredGamepadAdded {
|
||||
uint32_t promiseId;
|
||||
GamepadAdded gamepadAdded;
|
||||
};
|
||||
|
||||
GamepadTestChannelParent();
|
||||
~GamepadTestChannelParent();
|
||||
|
||||
void AddGamepadToPlatformService(uint32_t aPromiseId,
|
||||
const GamepadAdded& aGamepadAdded);
|
||||
~GamepadTestChannelParent() = default;
|
||||
|
||||
nsTArray<DeferredGamepadAdded> mDeferredGamepadAdded;
|
||||
};
|
||||
|
||||
|
|
|
@ -1142,20 +1142,7 @@ BackgroundParentImpl::AllocPGamepadEventChannelParent() {
|
|||
|
||||
dom::PGamepadTestChannelParent*
|
||||
BackgroundParentImpl::AllocPGamepadTestChannelParent() {
|
||||
RefPtr<dom::GamepadTestChannelParent> parent =
|
||||
new dom::GamepadTestChannelParent();
|
||||
|
||||
return parent.forget().take();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
BackgroundParentImpl::RecvPGamepadTestChannelConstructor(
|
||||
PGamepadTestChannelParent* aActor) {
|
||||
MOZ_ASSERT(aActor);
|
||||
if (!static_cast<dom::GamepadTestChannelParent*>(aActor)->Init()) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
return dom::GamepadTestChannelParent::Create().take();
|
||||
}
|
||||
|
||||
bool BackgroundParentImpl::DeallocPGamepadTestChannelParent(
|
||||
|
|
|
@ -338,9 +338,6 @@ class BackgroundParentImpl : public PBackgroundParent,
|
|||
|
||||
virtual PGamepadTestChannelParent* AllocPGamepadTestChannelParent() override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvPGamepadTestChannelConstructor(
|
||||
PGamepadTestChannelParent* aActor) override;
|
||||
|
||||
virtual bool DeallocPGamepadTestChannelParent(
|
||||
PGamepadTestChannelParent* aActor) override;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче