Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/PBenchmarkStorageChild.h"
#include "mozilla/BenchmarkStorageChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/PContentChild.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 {
MOZ_IMPLICIT PBenchmarkStorageChild::PBenchmarkStorageChild() :
mozilla::ipc::IProtocol(PBenchmarkStorageMsgStart, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PBenchmarkStorageChild);
}
PBenchmarkStorageChild::~PBenchmarkStorageChild()
{
MOZ_COUNT_DTOR(PBenchmarkStorageChild);
}
auto PBenchmarkStorageChild::ActorAlloc() -> void
{
}
auto PBenchmarkStorageChild::ActorDealloc() -> void
{
if (Manager()) {
Manager()->DeallocManagee(PBenchmarkStorageMsgStart, this);
}
}
auto PBenchmarkStorageChild::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PBenchmarkStorageChild::Manager() const -> PContentChild*
{
return static_cast<PContentChild*>(IProtocol::Manager());
}
auto PBenchmarkStorageChild::AllManagedActors(nsTArray<RefPtr<mozilla::ipc::ActorLifecycleProxy>>& arr__) const -> void
{
uint32_t total = 0;
arr__.SetCapacity(total);
}
auto PBenchmarkStorageChild::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PBenchmarkStorageChild::SendPut(
const nsACString& aDbName,
const nsACString& aKey,
const int32_t& aValue) -> bool
{
UniquePtr<IPC::Message> msg__ = PBenchmarkStorage::Msg_Put(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aDbName);
// Sentinel = 'aDbName'
((&(writer__)))->WriteSentinel(164233865);
IPC::WriteParam((&(writer__)), aKey);
// Sentinel = 'aKey'
((&(writer__)))->WriteSentinel(61604235);
IPC::WriteParam((&(writer__)), aValue);
// Sentinel = 'aValue'
((&(writer__)))->WriteSentinel(135332447);
if (mozilla::ipc::LoggingEnabledFor("PBenchmarkStorage", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PBenchmarkStorageChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PBenchmarkStorage::Msg_Put", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PBenchmarkStorageChild::SendGet(
const nsACString& aDbName,
const nsACString& aKey,
mozilla::ipc::ResolveCallback<int32_t>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PBenchmarkStorage::Msg_Get(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aDbName);
// Sentinel = 'aDbName'
((&(writer__)))->WriteSentinel(164233865);
IPC::WriteParam((&(writer__)), aKey);
// Sentinel = 'aKey'
((&(writer__)))->WriteSentinel(61604235);
if (mozilla::ipc::LoggingEnabledFor("PBenchmarkStorage", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PBenchmarkStorageChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PBenchmarkStorage::Msg_Get", OTHER);
ChannelSend(std::move(msg__), PBenchmarkStorage::Reply_Get__ID, std::move(aResolve), std::move(aReject));
return;
}
auto PBenchmarkStorageChild::SendGet(
const nsACString& aDbName,
const nsACString& aKey) -> RefPtr<GetPromise>
{
RefPtr<MozPromise<int32_t, ResponseRejectReason, true>::Private> promise__ = new MozPromise<int32_t, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendGet(std::move(aDbName), std::move(aKey), [promise__](int32_t&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PBenchmarkStorageChild::SendCheckVersion(
const nsACString& aDbName,
const int32_t& aVersion) -> bool
{
UniquePtr<IPC::Message> msg__ = PBenchmarkStorage::Msg_CheckVersion(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aDbName);
// Sentinel = 'aDbName'
((&(writer__)))->WriteSentinel(164233865);
IPC::WriteParam((&(writer__)), aVersion);
// Sentinel = 'aVersion'
((&(writer__)))->WriteSentinel(240452424);
if (mozilla::ipc::LoggingEnabledFor("PBenchmarkStorage", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PBenchmarkStorageChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PBenchmarkStorage::Msg_CheckVersion", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PBenchmarkStorageChild::Send__delete__(PBenchmarkStorageChild* actor) -> bool
{
if (!actor || !actor->CanSend()) {
NS_WARNING("Attempt to __delete__ missing or closed actor");
return false;
}
UniquePtr<IPC::Message> msg__ = PBenchmarkStorage::Msg___delete__((actor)->Id());
IPC::MessageWriter writer__{
(*(msg__)),
actor};
if (mozilla::ipc::LoggingEnabledFor("PBenchmarkStorage", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PBenchmarkStorageChild",
actor->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PBenchmarkStorage::Msg___delete__", OTHER);
bool sendok__ = (actor)->ChannelSend(std::move(msg__));
IProtocol* mgr = actor->Manager();
actor->DestroySubtree(Deletion);
actor->ClearSubtree();
mgr->RemoveManagee(PBenchmarkStorageMsgStart, actor);
return sendok__;
}
auto PBenchmarkStorageChild::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PBenchmarkStorageChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PBenchmarkStorageChild::OnMessageReceived(const Message& msg__) -> PBenchmarkStorageChild::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;
IProtocol* mgr = this->Manager();
this->DestroySubtree(ManagedEndpointDropped);
this->ClearSubtree();
mgr->RemoveManagee(PBenchmarkStorageMsgStart, this);
return MsgProcessed;
}
case PBenchmarkStorage::Reply_Get__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PBenchmarkStorage", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PBenchmarkStorageChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PBenchmarkStorage::Msg_Get", 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<int32_t> CallbackHolder;
auto* callback = static_cast<CallbackHolder*>(untypedCallback.get());
if (!callback) {
FatalError("Error unknown callback");
return MsgProcessingError;
}
if (resolve__) {
auto maybe__aValue = IPC::ReadParam<int32_t>((&(reader__)));
if (!maybe__aValue) {
FatalError("Error deserializing 'int32_t'");
return MsgValueError;
}
auto& aValue = *maybe__aValue;
// Sentinel = 'aValue'
if ((!(((&(reader__)))->ReadSentinel(135332447)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'int32_t'");
return MsgValueError;
}
reader__.EndRead();
callback->Resolve(std::move(aValue));
} else {
ResponseRejectReason reason__{};
if (!IPC::ReadParam(&reader__, &reason__)) {
FatalError("Error deserializing ResponseRejectReason");
return MsgValueError;
}
reader__.EndRead();
callback->Reject(std::move(reason__));
}
return MsgProcessed;
}
case PBenchmarkStorage::Reply___delete____ID:
{
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PBenchmarkStorageChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PBenchmarkStorageChild::Result
{
return MsgNotKnown;
}
auto PBenchmarkStorageChild::ClearSubtree() -> void
{
}
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::PBenchmarkStorageChild*>::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::PBenchmarkStorageChild*>::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, "PBenchmarkStorage", PBenchmarkStorageMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::PBenchmarkStorageChild*>(actor.ref());
}
return {};
}
} // namespace IPC