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", kProtocolId, 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::OtherChildID() const -> ::GeckoChildID
{
::GeckoChildID childID =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid();
MOZ_RELEASE_ASSERT(childID != -1);
return childID;
}
auto PGMPServiceChild::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo
{
return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()};
}
auto PGMPServiceChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
return {};
}
auto PGMPServiceChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
default:
return nullptr;
}
}
auto PGMPServiceChild::RejectPendingResponses(ResponseRejectReason aReason) -> void
{
mAsyncCallbacks.RejectPendingResponses(aReason);
}
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);
int32_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PGMPService::Reply_LaunchGMP__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__aResult = IPC::ReadParam<GMPLaunchResult>(aReader);
if (!maybe__aResult) {
(aReader)->FatalError("Error deserializing 'GMPLaunchResult'");
return MsgValueError;
}
auto& aResult = *maybe__aResult;
// Sentinel = 'aResult'
if ((!((aReader)->ReadSentinel(185205473)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'GMPLaunchResult'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(aResult));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
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);
int32_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PGMPService::Reply_GetGMPNodeId__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__id = IPC::ReadParam<nsCString>(aReader);
if (!maybe__id) {
(aReader)->FatalError("Error deserializing 'nsCString'");
return MsgValueError;
}
auto& id = *maybe__id;
// Sentinel = 'id'
if ((!((aReader)->ReadSentinel(20447438)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(id));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
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::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);
return mAsyncCallbacks.GotReply(this, msg__);
}
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);
return mAsyncCallbacks.GotReply(this, msg__);
}
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;
}
} // 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