Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/gmp/PGMPServiceChild.h"
#include "GMPMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/gmp/PGMPContentChild.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 PGMPServiceChild::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PGMPServiceChild::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PGMPServiceChild::PGMPServiceChild() :
mozilla::ipc::IToplevelProtocol("PGMPServiceChild", PGMPServiceMsgStart, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PGMPServiceChild);
}
PGMPServiceChild::~PGMPServiceChild()
{
MOZ_COUNT_DTOR(PGMPServiceChild);
}
auto PGMPServiceChild::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsContentProcess(), "Invalid process for `PGMPServiceChild'");
AddRef();
}
auto PGMPServiceChild::ActorDealloc() -> void
{
Release();
}
auto PGMPServiceChild::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PGMPServiceChild::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PGMPServiceChild::SendLaunchGMP(
const NodeIdVariant& nodeIdVariant,
const nsACString& api,
mozilla::Span<nsCString const> tags,
mozilla::Span<ProcessId const> alreadyBridgedTo,
mozilla::ipc::ResolveCallback<GMPLaunchResult>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PGMPService::Msg_LaunchGMP(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), nodeIdVariant);
// Sentinel = 'nodeIdVariant'
((&(writer__)))->WriteSentinel(599196969);
IPC::WriteParam((&(writer__)), api);
// Sentinel = 'api'
((&(writer__)))->WriteSentinel(40829243);
IPC::WriteParam((&(writer__)), tags);
// Sentinel = 'tags'
((&(writer__)))->WriteSentinel(70779312);
IPC::WriteParam((&(writer__)), alreadyBridgedTo);
// Sentinel = 'alreadyBridgedTo'
((&(writer__)))->WriteSentinel(911607383);
if (mozilla::ipc::LoggingEnabledFor("PGMPService", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPServiceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PGMPService::Msg_LaunchGMP", OTHER);
ChannelSend(std::move(msg__), PGMPService::Reply_LaunchGMP__ID, std::move(aResolve), std::move(aReject));
return;
}
auto PGMPServiceChild::SendLaunchGMP(
const NodeIdVariant& nodeIdVariant,
const nsACString& api,
mozilla::Span<nsCString const> tags,
mozilla::Span<ProcessId const> alreadyBridgedTo) -> RefPtr<LaunchGMPPromise>
{
RefPtr<MozPromise<GMPLaunchResult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<GMPLaunchResult, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendLaunchGMP(std::move(nodeIdVariant), std::move(api), std::move(tags), std::move(alreadyBridgedTo), [promise__](GMPLaunchResult&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PGMPServiceChild::SendGetGMPNodeId(
const nsAString& origin,
const nsAString& topLevelOrigin,
const nsAString& gmpName,
mozilla::ipc::ResolveCallback<nsCString>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PGMPService::Msg_GetGMPNodeId(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), origin);
// Sentinel = 'origin'
((&(writer__)))->WriteSentinel(150143625);
IPC::WriteParam((&(writer__)), topLevelOrigin);
// Sentinel = 'topLevelOrigin'
((&(writer__)))->WriteSentinel(720242100);
IPC::WriteParam((&(writer__)), gmpName);
// Sentinel = 'gmpName'
((&(writer__)))->WriteSentinel(187695814);
if (mozilla::ipc::LoggingEnabledFor("PGMPService", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPServiceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PGMPService::Msg_GetGMPNodeId", OTHER);
ChannelSend(std::move(msg__), PGMPService::Reply_GetGMPNodeId__ID, std::move(aResolve), std::move(aReject));
return;
}
auto PGMPServiceChild::SendGetGMPNodeId(
const nsAString& origin,
const nsAString& topLevelOrigin,
const nsAString& gmpName) -> RefPtr<GetGMPNodeIdPromise>
{
RefPtr<MozPromise<nsCString, ResponseRejectReason, true>::Private> promise__ = new MozPromise<nsCString, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendGetGMPNodeId(std::move(origin), std::move(topLevelOrigin), std::move(gmpName), [promise__](nsCString&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PGMPServiceChild::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PGMPServiceChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PGMPServiceChild::OnMessageReceived(const Message& msg__) -> PGMPServiceChild::Result
{
switch (msg__.type()) {
case PGMPService::Reply_LaunchGMP__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPService", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPServiceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPService::Msg_LaunchGMP", OTHER);
IPC::MessageReader reader__{
msg__,
this};
bool resolve__ = false;
if (!IPC::ReadParam(&reader__, &resolve__)) {
FatalError("Error deserializing bool");
return MsgValueError;
}
UniquePtr<MessageChannel::UntypedCallbackHolder> untypedCallback =
GetIPCChannel()->PopCallback(msg__, Id());
typedef MessageChannel::CallbackHolder<GMPLaunchResult> CallbackHolder;
auto* callback = static_cast<CallbackHolder*>(untypedCallback.get());
if (!callback) {
FatalError("Error unknown callback");
return MsgProcessingError;
}
if (resolve__) {
auto maybe__aResult = IPC::ReadParam<GMPLaunchResult>((&(reader__)));
if (!maybe__aResult) {
FatalError("Error deserializing 'GMPLaunchResult'");
return MsgValueError;
}
auto& aResult = *maybe__aResult;
// Sentinel = 'aResult'
if ((!(((&(reader__)))->ReadSentinel(185205473)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'GMPLaunchResult'");
return MsgValueError;
}
reader__.EndRead();
callback->Resolve(std::move(aResult));
} else {
ResponseRejectReason reason__{};
if (!IPC::ReadParam(&reader__, &reason__)) {
FatalError("Error deserializing ResponseRejectReason");
return MsgValueError;
}
reader__.EndRead();
callback->Reject(std::move(reason__));
}
return MsgProcessed;
}
case PGMPService::Reply_GetGMPNodeId__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPService", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPServiceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPService::Msg_GetGMPNodeId", OTHER);
IPC::MessageReader reader__{
msg__,
this};
bool resolve__ = false;
if (!IPC::ReadParam(&reader__, &resolve__)) {
FatalError("Error deserializing bool");
return MsgValueError;
}
UniquePtr<MessageChannel::UntypedCallbackHolder> untypedCallback =
GetIPCChannel()->PopCallback(msg__, Id());
typedef MessageChannel::CallbackHolder<nsCString> CallbackHolder;
auto* callback = static_cast<CallbackHolder*>(untypedCallback.get());
if (!callback) {
FatalError("Error unknown callback");
return MsgProcessingError;
}
if (resolve__) {
auto maybe__id = IPC::ReadParam<nsCString>((&(reader__)));
if (!maybe__id) {
FatalError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto& id = *maybe__id;
// Sentinel = 'id'
if ((!(((&(reader__)))->ReadSentinel(20447438)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
return MsgValueError;
}
reader__.EndRead();
callback->Resolve(std::move(id));
} else {
ResponseRejectReason reason__{};
if (!IPC::ReadParam(&reader__, &reason__)) {
FatalError("Error deserializing ResponseRejectReason");
return MsgValueError;
}
reader__.EndRead();
callback->Reject(std::move(reason__));
}
return MsgProcessed;
}
case PGMPService::Msg_BeginShutdown__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPService", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPServiceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPService::Msg_BeginShutdown", OTHER);
mozilla::ipc::IPCResult __ok = (this)->RecvBeginShutdown();
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 PGMPServiceChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PGMPServiceChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
auto PGMPServiceChild::DoomSubtree() -> void
{
SetDoomed();
}
auto PGMPServiceChild::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace gmp
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::gmp::PGMPServiceChild*>::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::PGMPServiceChild*>::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::PGMPServiceChild*>(actor.ref());
}
return {};
}
} // namespace IPC