diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/clients/manager/ClientManagerParent.cpp | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/clients/manager/ClientManagerParent.cpp')
-rw-r--r-- | dom/clients/manager/ClientManagerParent.cpp | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/dom/clients/manager/ClientManagerParent.cpp b/dom/clients/manager/ClientManagerParent.cpp new file mode 100644 index 0000000000..1ee0eddcb0 --- /dev/null +++ b/dom/clients/manager/ClientManagerParent.cpp @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "ClientManagerParent.h" + +#include "mozilla/ipc/BackgroundParent.h" +#include "ClientHandleParent.h" +#include "ClientManagerOpParent.h" +#include "ClientManagerService.h" +#include "ClientSourceParent.h" +#include "ClientValidation.h" +#include "mozilla/dom/PClientNavigateOpParent.h" +#include "mozilla/Unused.h" + +namespace mozilla::dom { + +using mozilla::ipc::IPCResult; + +IPCResult ClientManagerParent::RecvTeardown() { + Unused << Send__delete__(this); + return IPC_OK(); +} + +void ClientManagerParent::ActorDestroy(ActorDestroyReason aReason) {} + +PClientHandleParent* ClientManagerParent::AllocPClientHandleParent( + const IPCClientInfo& aClientInfo) { + return new ClientHandleParent(); +} + +bool ClientManagerParent::DeallocPClientHandleParent( + PClientHandleParent* aActor) { + delete aActor; + return true; +} + +IPCResult ClientManagerParent::RecvPClientHandleConstructor( + PClientHandleParent* aActor, const IPCClientInfo& aClientInfo) { + ClientHandleParent* actor = static_cast<ClientHandleParent*>(aActor); + actor->Init(aClientInfo); + return IPC_OK(); +} + +PClientManagerOpParent* ClientManagerParent::AllocPClientManagerOpParent( + const ClientOpConstructorArgs& aArgs) { + return new ClientManagerOpParent(mService); +} + +bool ClientManagerParent::DeallocPClientManagerOpParent( + PClientManagerOpParent* aActor) { + delete aActor; + return true; +} + +IPCResult ClientManagerParent::RecvPClientManagerOpConstructor( + PClientManagerOpParent* aActor, const ClientOpConstructorArgs& aArgs) { + ClientManagerOpParent* actor = static_cast<ClientManagerOpParent*>(aActor); + actor->Init(aArgs); + return IPC_OK(); +} + +PClientNavigateOpParent* ClientManagerParent::AllocPClientNavigateOpParent( + const ClientNavigateOpConstructorArgs& aArgs) { + MOZ_ASSERT_UNREACHABLE( + "ClientNavigateOpParent should be explicitly constructed."); + return nullptr; +} + +bool ClientManagerParent::DeallocPClientNavigateOpParent( + PClientNavigateOpParent* aActor) { + delete aActor; + return true; +} + +PClientSourceParent* ClientManagerParent::AllocPClientSourceParent( + const ClientSourceConstructorArgs& aArgs) { + Maybe<ContentParentId> contentParentId; + + uint64_t childID = ::mozilla::ipc::BackgroundParent::GetChildID(Manager()); + if (childID) { + contentParentId = Some(ContentParentId(childID)); + } + + return new ClientSourceParent(aArgs, contentParentId); +} + +bool ClientManagerParent::DeallocPClientSourceParent( + PClientSourceParent* aActor) { + delete aActor; + return true; +} + +IPCResult ClientManagerParent::RecvPClientSourceConstructor( + PClientSourceParent* aActor, const ClientSourceConstructorArgs& aArgs) { + ClientSourceParent* actor = static_cast<ClientSourceParent*>(aActor); + actor->Init(); + return IPC_OK(); +} + +ClientManagerParent::ClientManagerParent() + : mService(ClientManagerService::GetOrCreateInstance()) {} + +ClientManagerParent::~ClientManagerParent() { mService->RemoveManager(this); } + +void ClientManagerParent::Init() { mService->AddManager(this); } + +IPCResult ClientManagerParent::RecvExpectFutureClientSource( + const IPCClientInfo& aClientInfo) { + RefPtr<ClientManagerService> cms = + ClientManagerService::GetOrCreateInstance(); + Unused << NS_WARN_IF(!cms->ExpectFutureSource(aClientInfo)); + return IPC_OK(); +} + +IPCResult ClientManagerParent::RecvForgetFutureClientSource( + const IPCClientInfo& aClientInfo) { + RefPtr<ClientManagerService> cms = ClientManagerService::GetInstance(); + cms->ForgetFutureSource(aClientInfo); + return IPC_OK(); +} + +} // namespace mozilla::dom |