зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1874739 - Part 3: Make PClientSource refcounted, r=dom-worker-reviewers,janv,asuth
This is part of removing [ManualDealloc] from all protocols which manage other protocols. Differential Revision: https://phabricator.services.mozilla.com/D198613
This commit is contained in:
Родитель
be638e433f
Коммит
bbe8741d2d
|
@ -60,16 +60,6 @@ mozilla::ipc::IPCResult ClientManagerChild::RecvPClientNavigateOpConstructor(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
PClientSourceChild* ClientManagerChild::AllocPClientSourceChild(
|
||||
const ClientSourceConstructorArgs& aArgs) {
|
||||
return new ClientSourceChild(aArgs);
|
||||
}
|
||||
|
||||
bool ClientManagerChild::DeallocPClientSourceChild(PClientSourceChild* aActor) {
|
||||
delete aActor;
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<ClientManagerChild> ClientManagerChild::Create() {
|
||||
RefPtr<ClientManagerChild> actor = new ClientManagerChild();
|
||||
|
|
|
@ -40,11 +40,6 @@ class ClientManagerChild final : public PClientManagerChild {
|
|||
PClientNavigateOpChild* aActor,
|
||||
const ClientNavigateOpConstructorArgs& aArgs) override;
|
||||
|
||||
PClientSourceChild* AllocPClientSourceChild(
|
||||
const ClientSourceConstructorArgs& aArgs) override;
|
||||
|
||||
bool DeallocPClientSourceChild(PClientSourceChild* aActor) override;
|
||||
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(ClientManagerChild, override)
|
||||
|
||||
|
|
|
@ -72,7 +72,8 @@ bool ClientManagerParent::DeallocPClientNavigateOpParent(
|
|||
return true;
|
||||
}
|
||||
|
||||
PClientSourceParent* ClientManagerParent::AllocPClientSourceParent(
|
||||
already_AddRefed<PClientSourceParent>
|
||||
ClientManagerParent::AllocPClientSourceParent(
|
||||
const ClientSourceConstructorArgs& aArgs) {
|
||||
Maybe<ContentParentId> contentParentId;
|
||||
|
||||
|
@ -81,13 +82,7 @@ PClientSourceParent* ClientManagerParent::AllocPClientSourceParent(
|
|||
contentParentId = Some(ContentParentId(childID));
|
||||
}
|
||||
|
||||
return new ClientSourceParent(aArgs, contentParentId);
|
||||
}
|
||||
|
||||
bool ClientManagerParent::DeallocPClientSourceParent(
|
||||
PClientSourceParent* aActor) {
|
||||
delete aActor;
|
||||
return true;
|
||||
return MakeAndAddRef<ClientSourceParent>(aArgs, contentParentId);
|
||||
}
|
||||
|
||||
IPCResult ClientManagerParent::RecvPClientSourceConstructor(
|
||||
|
|
|
@ -42,11 +42,9 @@ class ClientManagerParent final : public PClientManagerParent {
|
|||
|
||||
bool DeallocPClientNavigateOpParent(PClientNavigateOpParent* aActor) override;
|
||||
|
||||
PClientSourceParent* AllocPClientSourceParent(
|
||||
already_AddRefed<PClientSourceParent> AllocPClientSourceParent(
|
||||
const ClientSourceConstructorArgs& aArgs) override;
|
||||
|
||||
bool DeallocPClientSourceParent(PClientSourceParent* aActor) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvPClientSourceConstructor(
|
||||
PClientSourceParent* aActor,
|
||||
const ClientSourceConstructorArgs& aArgs) override;
|
||||
|
|
|
@ -281,7 +281,7 @@ bool ClientManagerService::AddSource(ClientSourceParent* aSource) {
|
|||
return true;
|
||||
}
|
||||
if (!mSourceTable.WithEntryHandle(aSource->Info().Id(),
|
||||
[aSource](auto&& entry) {
|
||||
[&aSource](auto&& entry) {
|
||||
if (NS_WARN_IF(entry.HasEntry())) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -189,13 +189,13 @@ void ClientSource::Activate(PClientManagerChild* aActor) {
|
|||
ClientSourceConstructorArgs args(mClientInfo.Id(), mClientInfo.Type(),
|
||||
mClientInfo.PrincipalInfo(),
|
||||
mClientInfo.CreationTime());
|
||||
PClientSourceChild* actor = aActor->SendPClientSourceConstructor(args);
|
||||
if (!actor) {
|
||||
RefPtr<ClientSourceChild> actor = new ClientSourceChild(args);
|
||||
if (!aActor->SendPClientSourceConstructor(actor, args)) {
|
||||
Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
ActivateThing(static_cast<ClientSourceChild*>(actor));
|
||||
ActivateThing(actor);
|
||||
}
|
||||
|
||||
ClientSource::~ClientSource() { Shutdown(); }
|
||||
|
|
|
@ -19,6 +19,8 @@ class ClientSourceChild final : public PClientSourceChild {
|
|||
ClientSource* mSource;
|
||||
bool mTeardownStarted;
|
||||
|
||||
~ClientSourceChild() = default;
|
||||
|
||||
// PClientSourceChild interface
|
||||
void ActorDestroy(ActorDestroyReason aReason) override;
|
||||
|
||||
|
@ -34,6 +36,8 @@ class ClientSourceChild final : public PClientSourceChild {
|
|||
mozilla::ipc::IPCResult RecvEvictFromBFCache() override;
|
||||
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(ClientSourceChild, override)
|
||||
|
||||
explicit ClientSourceChild(const ClientSourceConstructorArgs& aArgs);
|
||||
|
||||
void SetOwner(ClientThing<ClientSourceChild>* aThing);
|
||||
|
|
|
@ -30,6 +30,8 @@ class ClientSourceParent final : public PClientSourceParent {
|
|||
|
||||
void KillInvalidChild();
|
||||
|
||||
~ClientSourceParent();
|
||||
|
||||
// PClientSourceParent
|
||||
mozilla::ipc::IPCResult RecvWorkerSyncPing() override;
|
||||
|
||||
|
@ -55,9 +57,10 @@ class ClientSourceParent final : public PClientSourceParent {
|
|||
bool DeallocPClientSourceOpParent(PClientSourceOpParent* aActor) override;
|
||||
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(ClientSourceParent, override)
|
||||
|
||||
explicit ClientSourceParent(const ClientSourceConstructorArgs& aArgs,
|
||||
const Maybe<ContentParentId>& aContentParentId);
|
||||
~ClientSourceParent();
|
||||
|
||||
void Init();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ include ClientIPCTypes;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
[ManualDealloc, ChildImpl=virtual, ParentImpl=virtual]
|
||||
[ChildImpl=virtual, ParentImpl=virtual]
|
||||
sync protocol PClientSource
|
||||
{
|
||||
manager PClientManager;
|
||||
|
|
Загрузка…
Ссылка в новой задаче