Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/gmp/PGMPServiceParent.h"
#include "GMPMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/gmp/PGMPContentParent.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 gmp {
auto PGMPServiceParent::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PGMPServiceParent::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PGMPServiceParent::PGMPServiceParent() :
mozilla::ipc::IToplevelProtocol("PGMPServiceParent", PGMPServiceMsgStart, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PGMPServiceParent);
}
PGMPServiceParent::~PGMPServiceParent()
{
MOZ_COUNT_DTOR(PGMPServiceParent);
}
auto PGMPServiceParent::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Invalid process for `PGMPServiceParent'");
AddRef();
}
auto PGMPServiceParent::ActorDealloc() -> void
{
Release();
}
auto PGMPServiceParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PGMPServiceParent::AllManagedActors(nsTArray<RefPtr<mozilla::ipc::ActorLifecycleProxy>>& arr__) const -> void
{
uint32_t total = 0;
arr__.SetCapacity(total);
}
auto PGMPServiceParent::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PGMPServiceParent::SendBeginShutdown() -> bool
{
UniquePtr<IPC::Message> msg__ = PGMPService::Msg_BeginShutdown(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PGMPService", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPServiceParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PGMPService::Msg_BeginShutdown", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PGMPServiceParent::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PGMPServiceParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PGMPServiceParent::OnMessageReceived(const Message& msg__) -> PGMPServiceParent::Result
{
switch (msg__.type()) {
case PGMPService::Msg_LaunchGMP__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPService", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPServiceParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPService::Msg_LaunchGMP", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__nodeIdVariant = IPC::ReadParam<NodeIdVariant>((&(reader__)));
if (!maybe__nodeIdVariant) {
FatalError("Error deserializing 'NodeIdVariant'");
return MsgValueError;
}
auto& nodeIdVariant = *maybe__nodeIdVariant;
// Sentinel = 'nodeIdVariant'
if ((!(((&(reader__)))->ReadSentinel(599196969)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'NodeIdVariant'");
return MsgValueError;
}
auto maybe__api = IPC::ReadParam<nsCString>((&(reader__)));
if (!maybe__api) {
FatalError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto& api = *maybe__api;
// Sentinel = 'api'
if ((!(((&(reader__)))->ReadSentinel(40829243)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto maybe__tags = IPC::ReadParam<nsTArray<nsCString>>((&(reader__)));
if (!maybe__tags) {
FatalError("Error deserializing 'nsCString[]'");
return MsgValueError;
}
auto& tags = *maybe__tags;
// Sentinel = 'tags'
if ((!(((&(reader__)))->ReadSentinel(70779312)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString[]'");
return MsgValueError;
}
auto maybe__alreadyBridgedTo = IPC::ReadParam<nsTArray<ProcessId>>((&(reader__)));
if (!maybe__alreadyBridgedTo) {
FatalError("Error deserializing 'ProcessId[]'");
return MsgValueError;
}
auto& alreadyBridgedTo = *maybe__alreadyBridgedTo;
// Sentinel = 'alreadyBridgedTo'
if ((!(((&(reader__)))->ReadSentinel(911607383)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'ProcessId[]'");
return MsgValueError;
}
reader__.EndRead();
int32_t id__ = MSG_ROUTING_CONTROL;
UniquePtr<IPC::Message> reply__(PGMPService::Reply_LaunchGMP(id__));
reply__->set_seqno(msg__.seqno());
RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);
LaunchGMPResolver resolver = [resolver__ = std::move(resolver__)](GMPLaunchResult&& aParam) {
resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
IPC::MessageWriter writer__(*reply__, self__);
IPC::WriteParam((&(writer__)), std::move(aParam));
// Sentinel = 'aResult'
((&(writer__)))->WriteSentinel(185205473);
if (mozilla::ipc::LoggingEnabledFor("PGMPService", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPServiceParent",
self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending reply ",
reply__->type(),
mozilla::ipc::MessageDirection::eSending);
}
});
};
mozilla::ipc::IPCResult __ok = (this)->RecvLaunchGMP(std::move(nodeIdVariant), std::move(api), std::move(tags), std::move(alreadyBridgedTo), std::move(resolver));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PGMPService::Msg_GetGMPNodeId__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPService", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPServiceParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPService::Msg_GetGMPNodeId", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__origin = IPC::ReadParam<nsString>((&(reader__)));
if (!maybe__origin) {
FatalError("Error deserializing 'nsString'");
return MsgValueError;
}
auto& origin = *maybe__origin;
// Sentinel = 'origin'
if ((!(((&(reader__)))->ReadSentinel(150143625)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
return MsgValueError;
}
auto maybe__topLevelOrigin = IPC::ReadParam<nsString>((&(reader__)));
if (!maybe__topLevelOrigin) {
FatalError("Error deserializing 'nsString'");
return MsgValueError;
}
auto& topLevelOrigin = *maybe__topLevelOrigin;
// Sentinel = 'topLevelOrigin'
if ((!(((&(reader__)))->ReadSentinel(720242100)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
return MsgValueError;
}
auto maybe__gmpName = IPC::ReadParam<nsString>((&(reader__)));
if (!maybe__gmpName) {
FatalError("Error deserializing 'nsString'");
return MsgValueError;
}
auto& gmpName = *maybe__gmpName;
// Sentinel = 'gmpName'
if ((!(((&(reader__)))->ReadSentinel(187695814)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
return MsgValueError;
}
reader__.EndRead();
int32_t id__ = MSG_ROUTING_CONTROL;
UniquePtr<IPC::Message> reply__(PGMPService::Reply_GetGMPNodeId(id__));
reply__->set_seqno(msg__.seqno());
RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);
GetGMPNodeIdResolver resolver = [resolver__ = std::move(resolver__)](const nsACString& aParam) {
resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
IPC::MessageWriter writer__(*reply__, self__);
IPC::WriteParam((&(writer__)), aParam);
// Sentinel = 'id'
((&(writer__)))->WriteSentinel(20447438);
if (mozilla::ipc::LoggingEnabledFor("PGMPService", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPServiceParent",
self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending reply ",
reply__->type(),
mozilla::ipc::MessageDirection::eSending);
}
});
};
mozilla::ipc::IPCResult __ok = (this)->RecvGetGMPNodeId(std::move(origin), std::move(topLevelOrigin), std::move(gmpName), std::move(resolver));
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 PGMPServiceParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PGMPServiceParent::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
auto PGMPServiceParent::OnChannelClose() -> void
{
DestroySubtree(NormalShutdown);
ClearSubtree();
DeallocShmems();
if (GetLifecycleProxy()) {
GetLifecycleProxy()->Release();
}
}
auto PGMPServiceParent::OnChannelError() -> void
{
DestroySubtree(AbnormalShutdown);
ClearSubtree();
DeallocShmems();
if (GetLifecycleProxy()) {
GetLifecycleProxy()->Release();
}
}
auto PGMPServiceParent::ClearSubtree() -> void
{
}
} // namespace gmp
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::gmp::PGMPServiceParent*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
MOZ_RELEASE_ASSERT(
aWriter->GetActor(),
"Cannot serialize managed actors without an actor");
int32_t id;
if (!aVar) {
id = 0; // kNullActorId
} else {
id = aVar->Id();
if (id == 1) { // kFreedActorId
aVar->FatalError("Actor has been |delete|d");
}
MOZ_RELEASE_ASSERT(
aWriter->GetActor()->GetIPCChannel() == aVar->GetIPCChannel(),
"Actor must be from the same channel as the"
" actor it's being sent over");
MOZ_RELEASE_ASSERT(
aVar->CanSend(),
"Actor must still be open when sending");
}
IPC::WriteParam(aWriter, id);
}
auto ParamTraits<::mozilla::gmp::PGMPServiceParent*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
MOZ_RELEASE_ASSERT(
aReader->GetActor(),
"Cannot deserialize managed actors without an actor");
mozilla::Maybe<mozilla::ipc::IProtocol*> actor = aReader->GetActor()
->ReadActor(aReader, true, "PGMPService", PGMPServiceMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::gmp::PGMPServiceParent*>(actor.ref());
}
return {};
}
} // namespace IPC