Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/ipc/PIdleSchedulerParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/ipc/IdleSchedulerParent.h"
#include "mozilla/ipc/PBackgroundParent.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 ipc {
auto PIdleSchedulerParent::Recv__delete__() -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
MOZ_IMPLICIT PIdleSchedulerParent::PIdleSchedulerParent() :
mozilla::ipc::IRefCountedProtocol(PIdleSchedulerMsgStart, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PIdleSchedulerParent);
}
PIdleSchedulerParent::~PIdleSchedulerParent()
{
MOZ_COUNT_DTOR(PIdleSchedulerParent);
}
auto PIdleSchedulerParent::ActorAlloc() -> void
{
AddRef();
}
auto PIdleSchedulerParent::ActorDealloc() -> void
{
Release();
}
auto PIdleSchedulerParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PIdleSchedulerParent::Manager() const -> PBackgroundParent*
{
return static_cast<PBackgroundParent*>(IProtocol::Manager());
}
auto PIdleSchedulerParent::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PIdleSchedulerParent::SendIdleTime(
const uint64_t& id,
const TimeDuration& budget) -> bool
{
UniquePtr<IPC::Message> msg__ = PIdleScheduler::Msg_IdleTime(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), id);
// Sentinel = 'id'
((&(writer__)))->WriteSentinel(20447438);
IPC::WriteParam((&(writer__)), budget);
// Sentinel = 'budget'
((&(writer__)))->WriteSentinel(144573052);
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg_IdleTime", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PIdleSchedulerParent::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PIdleSchedulerParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PIdleSchedulerParent::OnMessageReceived(const Message& msg__) -> PIdleSchedulerParent::Result
{
switch (msg__.type()) {
case MANAGED_ENDPOINT_BOUND_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
return MsgProcessed;
}
case MANAGED_ENDPOINT_DROPPED_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
this->ActorDisconnected(ManagedEndpointDropped);
return MsgProcessed;
}
case PIdleScheduler::Msg_InitForIdleUse__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg_InitForIdleUse", OTHER);
int32_t id__ = Id();
UniquePtr<IPC::Message> reply__(PIdleScheduler::Reply_InitForIdleUse(id__));
reply__->set_seqno(msg__.seqno());
RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);
InitForIdleUseResolver resolver = [resolver__ = std::move(resolver__)](std::tuple<mozilla::Maybe<SharedMemoryHandle>&&, const uint32_t&> aParam) {
resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
IPC::MessageWriter writer__(*reply__, self__);
IPC::WriteParam((&(writer__)), std::move(std::get<0>(aParam)));
// Sentinel = 'state'
((&(writer__)))->WriteSentinel(109314594);
IPC::WriteParam((&(writer__)), std::get<1>(aParam));
// Sentinel = 'childId'
((&(writer__)))->WriteSentinel(185270962);
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending reply ",
reply__->type(),
mozilla::ipc::MessageDirection::eSending);
}
});
};
mozilla::ipc::IPCResult __ok = (static_cast<IdleSchedulerParent*>(this))->RecvInitForIdleUse(std::move(resolver));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PIdleScheduler::Msg_RequestIdleTime__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg_RequestIdleTime", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__id = IPC::ReadParam<uint64_t>((&(reader__)));
if (!maybe__id) {
FatalError("Error deserializing 'uint64_t'");
return MsgValueError;
}
auto& id = *maybe__id;
// Sentinel = 'id'
if ((!(((&(reader__)))->ReadSentinel(20447438)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
return MsgValueError;
}
auto maybe__budget = IPC::ReadParam<TimeDuration>((&(reader__)));
if (!maybe__budget) {
FatalError("Error deserializing 'TimeDuration'");
return MsgValueError;
}
auto& budget = *maybe__budget;
// Sentinel = 'budget'
if ((!(((&(reader__)))->ReadSentinel(144573052)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'TimeDuration'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<IdleSchedulerParent*>(this))->RecvRequestIdleTime(std::move(id), std::move(budget));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PIdleScheduler::Msg_IdleTimeUsed__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg_IdleTimeUsed", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__id = IPC::ReadParam<uint64_t>((&(reader__)));
if (!maybe__id) {
FatalError("Error deserializing 'uint64_t'");
return MsgValueError;
}
auto& id = *maybe__id;
// Sentinel = 'id'
if ((!(((&(reader__)))->ReadSentinel(20447438)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<IdleSchedulerParent*>(this))->RecvIdleTimeUsed(std::move(id));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PIdleScheduler::Msg_Schedule__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg_Schedule", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<IdleSchedulerParent*>(this))->RecvSchedule();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PIdleScheduler::Msg_RunningPrioritizedOperation__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg_RunningPrioritizedOperation", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<IdleSchedulerParent*>(this))->RecvRunningPrioritizedOperation();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PIdleScheduler::Msg_PrioritizedOperationDone__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg_PrioritizedOperationDone", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<IdleSchedulerParent*>(this))->RecvPrioritizedOperationDone();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PIdleScheduler::Msg_RequestGC__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg_RequestGC", OTHER);
int32_t id__ = Id();
UniquePtr<IPC::Message> reply__(PIdleScheduler::Reply_RequestGC(id__));
reply__->set_seqno(msg__.seqno());
RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);
RequestGCResolver resolver = [resolver__ = std::move(resolver__)](const bool& aParam) {
resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
IPC::MessageWriter writer__(*reply__, self__);
IPC::WriteParam((&(writer__)), aParam);
// Sentinel = 'may_gc'
((&(writer__)))->WriteSentinel(145425009);
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending reply ",
reply__->type(),
mozilla::ipc::MessageDirection::eSending);
}
});
};
mozilla::ipc::IPCResult __ok = (static_cast<IdleSchedulerParent*>(this))->RecvRequestGC(std::move(resolver));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PIdleScheduler::Msg_StartedGC__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg_StartedGC", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<IdleSchedulerParent*>(this))->RecvStartedGC();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PIdleScheduler::Msg_DoneGC__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg_DoneGC", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<IdleSchedulerParent*>(this))->RecvDoneGC();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PIdleScheduler::Msg___delete____ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIdleScheduler", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIdleSchedulerParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIdleScheduler::Msg___delete__", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<IdleSchedulerParent*>(this))->Recv__delete__();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
this->ActorDisconnected(Deletion);
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PIdleSchedulerParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PIdleSchedulerParent::Result
{
return MsgNotKnown;
}
auto PIdleSchedulerParent::DoomSubtree() -> void
{
SetDoomed();
}
auto PIdleSchedulerParent::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace ipc
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::ipc::PIdleSchedulerParent*>::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::ipc::PIdleSchedulerParent*>::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, "PIdleScheduler", PIdleSchedulerMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::ipc::PIdleSchedulerParent*>(actor.ref());
}
return {};
}
} // namespace IPC