Copy as Markdown
Other Tools
//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/dom/cache/PBoundStorageKeyChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/cache/BoundStorageKeyChild.h"
#include "mozilla/dom/cache/IPCUtils.h"
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/dom/cache/PCacheChild.h"
#include "mozilla/dom/cache/PCacheStorageChild.h"
#include "mozilla/dom/cache/PCacheStreamControlChild.h"
#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"
namespace mozilla {
namespace dom {
namespace cache {
auto PBoundStorageKeyChild::RecvPCacheConstructor(PCacheChild* actor) -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
auto PBoundStorageKeyChild::RecvPCacheStreamControlConstructor(PCacheStreamControlChild* actor) -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
auto PBoundStorageKeyChild::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PBoundStorageKeyChild::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PBoundStorageKeyChild::PBoundStorageKeyChild() :
mozilla::ipc::IToplevelProtocol("PBoundStorageKeyChild", kProtocolId, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PBoundStorageKeyChild);
}
PBoundStorageKeyChild::~PBoundStorageKeyChild()
{
MOZ_COUNT_DTOR(PBoundStorageKeyChild);
}
auto PBoundStorageKeyChild::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsParentProcess() || XRE_IsContentProcess(), "Invalid process for `PBoundStorageKeyChild'");
AddRef();
}
auto PBoundStorageKeyChild::ActorDealloc() -> void
{
Release();
}
auto PBoundStorageKeyChild::ManagedPCacheStorageChild(nsTArray<PCacheStorageChild*>& aArr) const -> void
{
mManagedPCacheStorageChild.ToArray(aArr);
}
auto PBoundStorageKeyChild::ManagedPCacheStorageChild() const -> const ManagedContainer<PCacheStorageChild>&
{
return mManagedPCacheStorageChild;
}
auto PBoundStorageKeyChild::ManagedPCacheChild(nsTArray<PCacheChild*>& aArr) const -> void
{
mManagedPCacheChild.ToArray(aArr);
}
auto PBoundStorageKeyChild::ManagedPCacheChild() const -> const ManagedContainer<PCacheChild>&
{
return mManagedPCacheChild;
}
auto PBoundStorageKeyChild::ManagedPCacheStreamControlChild(nsTArray<PCacheStreamControlChild*>& aArr) const -> void
{
mManagedPCacheStreamControlChild.ToArray(aArr);
}
auto PBoundStorageKeyChild::ManagedPCacheStreamControlChild() const -> const ManagedContainer<PCacheStreamControlChild>&
{
return mManagedPCacheStreamControlChild;
}
auto PBoundStorageKeyChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
static constexpr ::mozilla::ipc::ProtocolId sIds[] = {
PCacheStorageMsgStart,
PCacheMsgStart,
PCacheStreamControlMsgStart
};
return sIds;
}
auto PBoundStorageKeyChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
case PCacheStorageMsgStart:
return (&(mManagedPCacheStorageChild));
case PCacheMsgStart:
return (&(mManagedPCacheChild));
case PCacheStreamControlMsgStart:
return (&(mManagedPCacheStreamControlChild));
default:
return nullptr;
}
}
auto PBoundStorageKeyChild::OpenPCacheStorageEndpoint(PCacheStorageChild* aActor) -> ManagedEndpoint<PCacheStorageParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PCacheStorageChild actor");
return ManagedEndpoint<PCacheStorageParent>();
}
if (!aActor->SetManagerAndRegister(this)) {
NS_WARNING("Failed to bind PCacheStorageChild actor");
return ManagedEndpoint<PCacheStorageParent>();
}
// Mark our actor as awaiting the other side to be bound. This will
// be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is
// received.
aActor->mAwaitingManagedEndpointBind = true;
return ManagedEndpoint<PCacheStorageParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PBoundStorageKeyChild::BindPCacheStorageEndpoint(
ManagedEndpoint<PCacheStorageChild> aEndpoint,
PCacheStorageChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}
auto PBoundStorageKeyChild::OpenPCacheEndpoint(PCacheChild* aActor) -> ManagedEndpoint<PCacheParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PCacheChild actor");
return ManagedEndpoint<PCacheParent>();
}
if (!aActor->SetManagerAndRegister(this)) {
NS_WARNING("Failed to bind PCacheChild actor");
return ManagedEndpoint<PCacheParent>();
}
// Mark our actor as awaiting the other side to be bound. This will
// be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is
// received.
aActor->mAwaitingManagedEndpointBind = true;
return ManagedEndpoint<PCacheParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PBoundStorageKeyChild::BindPCacheEndpoint(
ManagedEndpoint<PCacheChild> aEndpoint,
PCacheChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}
auto PBoundStorageKeyChild::OpenPCacheStreamControlEndpoint(PCacheStreamControlChild* aActor) -> ManagedEndpoint<PCacheStreamControlParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PCacheStreamControlChild actor");
return ManagedEndpoint<PCacheStreamControlParent>();
}
if (!aActor->SetManagerAndRegister(this)) {
NS_WARNING("Failed to bind PCacheStreamControlChild actor");
return ManagedEndpoint<PCacheStreamControlParent>();
}
// Mark our actor as awaiting the other side to be bound. This will
// be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is
// received.
aActor->mAwaitingManagedEndpointBind = true;
return ManagedEndpoint<PCacheStreamControlParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PBoundStorageKeyChild::BindPCacheStreamControlEndpoint(
ManagedEndpoint<PCacheStreamControlChild> aEndpoint,
PCacheStreamControlChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}
auto PBoundStorageKeyChild::SendPCacheStorageConstructor(
PCacheStorageChild* actor,
const Namespace& aNamespace,
const PrincipalInfo& aPrincipalInfo) -> PCacheStorageChild*
{
if (!actor) {
NS_WARNING("Cannot bind null PCacheStorageChild actor");
return nullptr;
}
if (!actor->SetManagerAndRegister(this)) {
NS_WARNING("Failed to bind PCacheStorageChild actor");
return nullptr;
}
// Build our constructor message.
UniquePtr<IPC::Message> msg__ = PBoundStorageKey::Msg_PCacheStorageConstructor(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), (actor)->Id());
// Sentinel = 'actorid'
((&(writer__)))->WriteSentinel(193725159);
IPC::WriteParam((&(writer__)), aNamespace);
// Sentinel = 'aNamespace'
((&(writer__)))->WriteSentinel(356516847);
IPC::WriteParam((&(writer__)), aPrincipalInfo);
// Sentinel = 'aPrincipalInfo'
((&(writer__)))->WriteSentinel(695272848);
// Notify the other side about the newly created actor. This can
// fail if our manager has already been destroyed.
//
// NOTE: If the send call fails due to toplevel channel teardown,
// the `IProtocol::ChannelSend` wrapper absorbs the error for us,
// so we don't tear down actors unexpectedly.
if (mozilla::ipc::LoggingEnabledFor("PBoundStorageKey", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PBoundStorageKeyChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PBoundStorageKey::Msg_PCacheStorageConstructor", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
// Warn, destroy the actor, and return null if the message failed to
// send. Otherwise, return the successfully created actor reference.
if (!sendok__) {
NS_WARNING("Error sending PCacheStorageChild constructor");
actor->ActorDisconnected(FailedConstructor);
return nullptr;
}
return actor;
}
auto PBoundStorageKeyChild::DeallocManagee(
mozilla::ipc::ProtocolId aProtocolId,
IProtocol* aListener) -> void
{
switch (aProtocolId) {
default:
FatalError("unreached");
return;
}
}
auto PBoundStorageKeyChild::OnMessageReceived(const Message& msg__) -> PBoundStorageKeyChild::Result
{
IPC::Message::routeid_t route__ = msg__.routing_id();
if (MSG_ROUTING_CONTROL != route__) {
IProtocol* routed__ = Lookup(route__);
if (!routed__ || !routed__->GetLifecycleProxy()) {
if (mozilla::ipc::LoggingEnabledFor("PBoundStorageKey", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PBoundStorageKeyChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Ignored message for dead actor",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eSending);
}
return MsgProcessed;
}
RefPtr<mozilla::ipc::ActorLifecycleProxy> proxy__ =
routed__->GetLifecycleProxy();
return proxy__->Get()->OnMessageReceived(msg__);
}
switch (msg__.type()) {
case PBoundStorageKey::Reply_PCacheStorageConstructor__ID:
{
return MsgProcessed;
}
case PBoundStorageKey::Msg_PCacheConstructor__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PBoundStorageKey", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PBoundStorageKeyChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PBoundStorageKey::Msg_PCacheConstructor", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__actorid__ = IPC::ReadParam<mozilla::ipc::ActorId>((&(reader__)));
if (!maybe__actorid__) {
FatalError("Error deserializing 'mozilla::ipc::ActorId'");
return MsgValueError;
}
auto& actorid__ = *maybe__actorid__;
// Sentinel = 'actorid'
if ((!(((&(reader__)))->ReadSentinel(193725159)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'mozilla::ipc::ActorId'");
return MsgValueError;
}
reader__.EndRead();
RefPtr<PCacheChild> actor = (static_cast<BoundStorageKeyChild*>(this))->AllocPCacheChild();
if (!actor) {
NS_WARNING("Cannot bind null PCacheChild actor");
return MsgValueError;
}
if (!actor->SetManagerAndRegister(this, actorid__)) {
NS_WARNING("Failed to bind PCacheChild actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (static_cast<BoundStorageKeyChild*>(this))->RecvPCacheConstructor(actor);
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PBoundStorageKey::Msg_PCacheStreamControlConstructor__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PBoundStorageKey", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PBoundStorageKeyChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PBoundStorageKey::Msg_PCacheStreamControlConstructor", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__actorid__ = IPC::ReadParam<mozilla::ipc::ActorId>((&(reader__)));
if (!maybe__actorid__) {
FatalError("Error deserializing 'mozilla::ipc::ActorId'");
return MsgValueError;
}
auto& actorid__ = *maybe__actorid__;
// Sentinel = 'actorid'
if ((!(((&(reader__)))->ReadSentinel(193725159)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'mozilla::ipc::ActorId'");
return MsgValueError;
}
reader__.EndRead();
RefPtr<PCacheStreamControlChild> actor = (static_cast<BoundStorageKeyChild*>(this))->AllocPCacheStreamControlChild();
if (!actor) {
NS_WARNING("Cannot bind null PCacheStreamControlChild actor");
return MsgValueError;
}
if (!actor->SetManagerAndRegister(this, actorid__)) {
NS_WARNING("Failed to bind PCacheStreamControlChild actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (static_cast<BoundStorageKeyChild*>(this))->RecvPCacheStreamControlConstructor(actor);
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
default:
return MsgNotKnown;
case SHMEM_CREATED_MESSAGE_TYPE:
{
if (!ShmemCreated(msg__)) {
return MsgPayloadError;
}
return MsgProcessed;
}
case SHMEM_DESTROYED_MESSAGE_TYPE:
{
if (!ShmemDestroyed(msg__)) {
return MsgPayloadError;
}
return MsgProcessed;
}
}
}
auto PBoundStorageKeyChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PBoundStorageKeyChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
} // namespace cache
} // namespace dom
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::dom::cache::PBoundStorageKeyChild*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, static_cast<mozilla::ipc::IProtocol*>(aVar));
// Sentinel = 'PBoundStorageKey'
(aWriter)->WriteSentinel(877528647);
}
auto ParamTraits<::mozilla::dom::cache::PBoundStorageKeyChild*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe__actor = IPC::ReadParam<mozilla::ipc::IProtocol*>(aReader);
if (!maybe__actor) {
aReader->FatalError("Error deserializing managed PBoundStorageKey actor");
return {};
}
auto& actor = *maybe__actor;
// Sentinel = 'PBoundStorageKey'
if ((!((aReader)->ReadSentinel(877528647)))) {
mozilla::ipc::SentinelReadError("Error deserializing managed PBoundStorageKey actor");
return {};
}
if (actor && actor->GetProtocolId() != PBoundStorageKeyMsgStart) {
aReader->FatalError("Unexpected actor type (expected PBoundStorageKey)");
return {};
}
return static_cast<::mozilla::dom::cache::PBoundStorageKeyChild*>(actor);
}
} // namespace IPC