//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/hwinference/PHWInferenceChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/hwinference/HWInferenceChild.h"
#include "mozilla/hwinference/PHWInferenceManagerChild.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 hwinference {
auto PHWInferenceChild::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PHWInferenceChild::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PHWInferenceChild::PHWInferenceChild() :
mozilla::ipc::IToplevelProtocol("PHWInferenceChild", kProtocolId, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PHWInferenceChild);
}
PHWInferenceChild::~PHWInferenceChild()
{
MOZ_COUNT_DTOR(PHWInferenceChild);
}
auto PHWInferenceChild::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsUtilityProcess(), "Invalid process for `PHWInferenceChild'");
AddRef();
}
auto PHWInferenceChild::ActorDealloc() -> void
{
Release();
}
auto PHWInferenceChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
return {};
}
auto PHWInferenceChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
default:
return nullptr;
}
}
auto PHWInferenceChild::RejectPendingResponses(ResponseRejectReason aReason) -> void
{
mAsyncCallbacks.RejectPendingResponses(aReason);
}
auto PHWInferenceChild::SendIsModelAvailable(
const nsACString& task,
const nsACString& id,
mozilla::ipc::ResolveCallback<bool>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PHWInference::Msg_IsModelAvailable(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), task);
// Sentinel = 'task'
((&(writer__)))->WriteSentinel(71827892);
IPC::WriteParam((&(writer__)), id);
// Sentinel = 'id'
((&(writer__)))->WriteSentinel(20447438);
if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PHWInferenceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PHWInference::Msg_IsModelAvailable", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PHWInference::Reply_IsModelAvailable__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__available = IPC::ReadParam<bool>(aReader);
if (!maybe__available) {
(aReader)->FatalError("Error deserializing 'bool'");
return MsgValueError;
}
auto& available = *maybe__available;
// Sentinel = 'available'
if ((!((aReader)->ReadSentinel(306316194)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(available));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PHWInferenceChild::SendIsModelAvailable(
const nsACString& task,
const nsACString& id) -> RefPtr<IsModelAvailablePromise>
{
RefPtr<MozPromise<bool, ResponseRejectReason, true>::Private> promise__ = new MozPromise<bool, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendIsModelAvailable(std::forward<const nsACString&>(task), std::forward<const nsACString&>(id), [promise__](bool&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PHWInferenceChild::SendIsModelInstalled(
const nsACString& task,
const nsACString& id,
mozilla::ipc::ResolveCallback<bool>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PHWInference::Msg_IsModelInstalled(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), task);
// Sentinel = 'task'
((&(writer__)))->WriteSentinel(71827892);
IPC::WriteParam((&(writer__)), id);
// Sentinel = 'id'
((&(writer__)))->WriteSentinel(20447438);
if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PHWInferenceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PHWInference::Msg_IsModelInstalled", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PHWInference::Reply_IsModelInstalled__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__installed = IPC::ReadParam<bool>(aReader);
if (!maybe__installed) {
(aReader)->FatalError("Error deserializing 'bool'");
return MsgValueError;
}
auto& installed = *maybe__installed;
// Sentinel = 'installed'
if ((!((aReader)->ReadSentinel(319685569)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(installed));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PHWInferenceChild::SendIsModelInstalled(
const nsACString& task,
const nsACString& id) -> RefPtr<IsModelInstalledPromise>
{
RefPtr<MozPromise<bool, ResponseRejectReason, true>::Private> promise__ = new MozPromise<bool, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendIsModelInstalled(std::forward<const nsACString&>(task), std::forward<const nsACString&>(id), [promise__](bool&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PHWInferenceChild::SendInstallModel(
const nsACString& task,
const nsACString& id,
const uint64_t& innerWindowId,
const ContentParentId& contentId,
mozilla::ipc::ResolveCallback<bool>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PHWInference::Msg_InstallModel(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), task);
// Sentinel = 'task'
((&(writer__)))->WriteSentinel(71827892);
IPC::WriteParam((&(writer__)), id);
// Sentinel = 'id'
((&(writer__)))->WriteSentinel(20447438);
IPC::WriteParam((&(writer__)), innerWindowId);
// Sentinel = 'innerWindowId'
((&(writer__)))->WriteSentinel(627967298);
IPC::WriteParam((&(writer__)), contentId);
// Sentinel = 'contentId'
((&(writer__)))->WriteSentinel(314114985);
if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PHWInferenceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PHWInference::Msg_InstallModel", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PHWInference::Reply_InstallModel__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__success = IPC::ReadParam<bool>(aReader);
if (!maybe__success) {
(aReader)->FatalError("Error deserializing 'bool'");
return MsgValueError;
}
auto& success = *maybe__success;
// Sentinel = 'success'
if ((!((aReader)->ReadSentinel(200082170)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(success));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PHWInferenceChild::SendInstallModel(
const nsACString& task,
const nsACString& id,
const uint64_t& innerWindowId,
const ContentParentId& contentId) -> RefPtr<InstallModelPromise>
{
RefPtr<MozPromise<bool, ResponseRejectReason, true>::Private> promise__ = new MozPromise<bool, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendInstallModel(std::forward<const nsACString&>(task), std::forward<const nsACString&>(id), std::forward<const uint64_t&>(innerWindowId), std::forward<const ContentParentId&>(contentId), [promise__](bool&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PHWInferenceChild::SendGetModelFile(
const nsACString& task,
const nsACString& id,
mozilla::ipc::ResolveCallback<GetModelFileResult>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PHWInference::Msg_GetModelFile(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), task);
// Sentinel = 'task'
((&(writer__)))->WriteSentinel(71827892);
IPC::WriteParam((&(writer__)), id);
// Sentinel = 'id'
((&(writer__)))->WriteSentinel(20447438);
if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PHWInferenceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PHWInference::Msg_GetModelFile", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PHWInference::Reply_GetModelFile__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__result = IPC::ReadParam<GetModelFileResult>(aReader);
if (!maybe__result) {
(aReader)->FatalError("Error deserializing 'GetModelFileResult'");
return MsgValueError;
}
auto& result = *maybe__result;
// Sentinel = 'result'
if ((!((aReader)->ReadSentinel(153223840)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'GetModelFileResult'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(result));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PHWInferenceChild::SendGetModelFile(
const nsACString& task,
const nsACString& id) -> RefPtr<GetModelFilePromise>
{
RefPtr<MozPromise<GetModelFileResult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<GetModelFileResult, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendGetModelFile(std::forward<const nsACString&>(task), std::forward<const nsACString&>(id), [promise__](GetModelFileResult&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PHWInferenceChild::DeallocManagee(
mozilla::ipc::ProtocolId aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PHWInferenceChild::OnMessageReceived(const Message& msg__) -> PHWInferenceChild::Result
{
if (!CanSend()) {
if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PHWInferenceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Ignored message for dead actor",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eSending);
}
return MsgProcessed;
}
switch (msg__.type()) {
case PHWInference::Reply_IsModelAvailable__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PHWInferenceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PHWInference::Msg_IsModelAvailable", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PHWInference::Reply_IsModelInstalled__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PHWInferenceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PHWInference::Msg_IsModelInstalled", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PHWInference::Reply_InstallModel__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PHWInferenceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PHWInference::Msg_InstallModel", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PHWInference::Reply_GetModelFile__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PHWInferenceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PHWInference::Msg_GetModelFile", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PHWInference::Msg_NewContentHWInferenceManager__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PHWInferenceChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PHWInference::Msg_NewContentHWInferenceManager", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__endpoint = IPC::ReadParam<Endpoint<::mozilla::hwinference::PHWInferenceManagerParent>>((&(reader__)));
if (!maybe__endpoint) {
FatalError("Error deserializing 'Endpoint<::mozilla::hwinference::PHWInferenceManagerParent>'");
return MsgValueError;
}
auto& endpoint = *maybe__endpoint;
// Sentinel = 'endpoint'
if ((!(((&(reader__)))->ReadSentinel(251724642)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'Endpoint<::mozilla::hwinference::PHWInferenceManagerParent>'");
return MsgValueError;
}
auto maybe__contentId = IPC::ReadParam<ContentParentId>((&(reader__)));
if (!maybe__contentId) {
FatalError("Error deserializing 'ContentParentId'");
return MsgValueError;
}
auto& contentId = *maybe__contentId;
// Sentinel = 'contentId'
if ((!(((&(reader__)))->ReadSentinel(314114985)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'ContentParentId'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::hwinference::HWInferenceChild*>(this))->RecvNewContentHWInferenceManager(std::move(endpoint), std::move(contentId));
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 PHWInferenceChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PHWInferenceChild::Result
{
if (!CanSend()) {
return MsgDropped;
}
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
} // namespace hwinference
} // namespace mozilla