Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/net/PSocketProcessBridgeParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/net/SocketProcessBridgeParent.h"
#include "mozilla/net/PBackgroundDataBridgeParent.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 net {
auto PSocketProcessBridgeParent::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PSocketProcessBridgeParent::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PSocketProcessBridgeParent::PSocketProcessBridgeParent() :
mozilla::ipc::IToplevelProtocol("PSocketProcessBridgeParent", kProtocolId, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PSocketProcessBridgeParent);
}
PSocketProcessBridgeParent::~PSocketProcessBridgeParent()
{
MOZ_COUNT_DTOR(PSocketProcessBridgeParent);
}
auto PSocketProcessBridgeParent::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsSocketProcess(), "Invalid process for `PSocketProcessBridgeParent'");
AddRef();
}
auto PSocketProcessBridgeParent::ActorDealloc() -> void
{
Release();
}
auto PSocketProcessBridgeParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PSocketProcessBridgeParent::OtherChildID() const -> ::GeckoChildID
{
::GeckoChildID childID =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid();
MOZ_RELEASE_ASSERT(childID != -1);
return childID;
}
auto PSocketProcessBridgeParent::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo
{
return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()};
}
auto PSocketProcessBridgeParent::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
return {};
}
auto PSocketProcessBridgeParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
default:
return nullptr;
}
}
auto PSocketProcessBridgeParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PSocketProcessBridgeParent::OnMessageReceived(const Message& msg__) -> PSocketProcessBridgeParent::Result
{
switch (msg__.type()) {
case PSocketProcessBridge::Msg_InitBackgroundDataBridge__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PSocketProcessBridge", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSocketProcessBridgeParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PSocketProcessBridge::Msg_InitBackgroundDataBridge", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aEndpoint = IPC::ReadParam<Endpoint<::mozilla::net::PBackgroundDataBridgeParent>>((&(reader__)));
if (!maybe__aEndpoint) {
FatalError("Error deserializing 'Endpoint<::mozilla::net::PBackgroundDataBridgeParent>'");
return MsgValueError;
}
auto& aEndpoint = *maybe__aEndpoint;
// Sentinel = 'aEndpoint'
if ((!(((&(reader__)))->ReadSentinel(292225955)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'Endpoint<::mozilla::net::PBackgroundDataBridgeParent>'");
return MsgValueError;
}
auto maybe__aChannelID = IPC::ReadParam<uint64_t>((&(reader__)));
if (!maybe__aChannelID) {
FatalError("Error deserializing 'uint64_t'");
return MsgValueError;
}
auto& aChannelID = *maybe__aChannelID;
// Sentinel = 'aChannelID'
if ((!(((&(reader__)))->ReadSentinel(343802792)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<SocketProcessBridgeParent*>(this))->RecvInitBackgroundDataBridge(std::move(aEndpoint), std::move(aChannelID));
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 PSocketProcessBridgeParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PSocketProcessBridgeParent::Result
{
return MsgNotKnown;
}
} // namespace net
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::net::PSocketProcessBridgeParent*>::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::net::PSocketProcessBridgeParent*>::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, "PSocketProcessBridge", PSocketProcessBridgeMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::net::PSocketProcessBridgeParent*>(actor.ref());
}
return {};
}
} // namespace IPC