// // Automatically generated by ipdlc. // Edit at your own risk // #include "mozilla/hwinference/PHWInferenceParent.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/hwinference/HWInferenceParent.h" #include "mozilla/hwinference/PSpeechRecognitionParent.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 PHWInferenceParent::ProcessingError( Result aCode, const char* aReason) -> void { } auto PHWInferenceParent::ShouldContinueFromReplyTimeout() -> bool { return true; } MOZ_IMPLICIT PHWInferenceParent::PHWInferenceParent() : mozilla::ipc::IToplevelProtocol("PHWInferenceParent", kProtocolId, mozilla::ipc::ParentSide) { MOZ_COUNT_CTOR(PHWInferenceParent); } PHWInferenceParent::~PHWInferenceParent() { MOZ_COUNT_DTOR(PHWInferenceParent); } auto PHWInferenceParent::ActorAlloc() -> void { MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Invalid process for `PHWInferenceParent'"); AddRef(); } auto PHWInferenceParent::ActorDealloc() -> void { Release(); } auto PHWInferenceParent::ManagedProtocolIds() const -> mozilla::Span { return {}; } auto PHWInferenceParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer* { switch (aProtocol) { default: return nullptr; } } auto PHWInferenceParent::RejectPendingResponses(ResponseRejectReason aReason) -> void { mAsyncCallbacks.RejectPendingResponses(aReason); } auto PHWInferenceParent::SendNewContentSpeechRecognition( Endpoint<::mozilla::hwinference::PSpeechRecognitionParent>&& endpoint, const ContentParentId& contentId) -> bool { UniquePtr msg__ = PHWInference::Msg_NewContentSpeechRecognition(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), std::move(endpoint)); // Sentinel = 'endpoint' ((&(writer__)))->WriteSentinel(251724642); IPC::WriteParam((&(writer__)), contentId); // Sentinel = 'contentId' ((&(writer__)))->WriteSentinel(314114985); if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PHWInferenceParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PHWInference::Msg_NewContentSpeechRecognition", OTHER); bool sendok__ = ChannelSend(std::move(msg__)); return sendok__; } auto PHWInferenceParent::DeallocManagee( mozilla::ipc::ProtocolId aProtocolId, IProtocol* aListener) -> void { FatalError("unreached"); return; } auto PHWInferenceParent::OnMessageReceived(const Message& msg__) -> PHWInferenceParent::Result { if (!CanSend()) { if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PHWInferenceParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Ignored message for dead actor", (&(msg__))->type(), mozilla::ipc::MessageDirection::eSending); } return MsgProcessed; } switch (msg__.type()) { case PHWInference::Msg_IsModelAvailable__ID: { if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PHWInferenceParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PHWInference::Msg_IsModelAvailable", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__task = IPC::ReadParam((&(reader__))); if (!maybe__task) { FatalError("Error deserializing 'nsCString'"); return MsgValueError; } auto& task = *maybe__task; // Sentinel = 'task' if ((!(((&(reader__)))->ReadSentinel(71827892)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'"); return MsgValueError; } auto maybe__id = IPC::ReadParam((&(reader__))); if (!maybe__id) { FatalError("Error deserializing 'nsCString'"); return MsgValueError; } auto& id = *maybe__id; // Sentinel = 'id' if ((!(((&(reader__)))->ReadSentinel(20447438)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'"); return MsgValueError; } reader__.EndRead(); mozilla::ipc::ActorId id__ = MSG_ROUTING_CONTROL; UniquePtr reply__(PHWInference::Reply_IsModelAvailable(id__)); reply__->set_seqno(msg__.seqno()); RefPtr resolver__ = new mozilla::ipc::IPDLResolverInner(std::move(reply__), this); IsModelAvailableResolver 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 = 'available' ((&(writer__)))->WriteSentinel(306316194); if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PHWInferenceParent", self__->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending reply ", reply__->type(), mozilla::ipc::MessageDirection::eSending); } }); }; mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::hwinference::HWInferenceParent*>(this))->RecvIsModelAvailable(std::move(task), std::move(id), std::move(resolver)); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PHWInference::Msg_IsModelInstalled__ID: { if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PHWInferenceParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PHWInference::Msg_IsModelInstalled", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__task = IPC::ReadParam((&(reader__))); if (!maybe__task) { FatalError("Error deserializing 'nsCString'"); return MsgValueError; } auto& task = *maybe__task; // Sentinel = 'task' if ((!(((&(reader__)))->ReadSentinel(71827892)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'"); return MsgValueError; } auto maybe__id = IPC::ReadParam((&(reader__))); if (!maybe__id) { FatalError("Error deserializing 'nsCString'"); return MsgValueError; } auto& id = *maybe__id; // Sentinel = 'id' if ((!(((&(reader__)))->ReadSentinel(20447438)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'"); return MsgValueError; } reader__.EndRead(); mozilla::ipc::ActorId id__ = MSG_ROUTING_CONTROL; UniquePtr reply__(PHWInference::Reply_IsModelInstalled(id__)); reply__->set_seqno(msg__.seqno()); RefPtr resolver__ = new mozilla::ipc::IPDLResolverInner(std::move(reply__), this); IsModelInstalledResolver 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 = 'installed' ((&(writer__)))->WriteSentinel(319685569); if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PHWInferenceParent", self__->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending reply ", reply__->type(), mozilla::ipc::MessageDirection::eSending); } }); }; mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::hwinference::HWInferenceParent*>(this))->RecvIsModelInstalled(std::move(task), std::move(id), std::move(resolver)); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PHWInference::Msg_InstallModel__ID: { if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PHWInferenceParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PHWInference::Msg_InstallModel", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__task = IPC::ReadParam((&(reader__))); if (!maybe__task) { FatalError("Error deserializing 'nsCString'"); return MsgValueError; } auto& task = *maybe__task; // Sentinel = 'task' if ((!(((&(reader__)))->ReadSentinel(71827892)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'"); return MsgValueError; } auto maybe__id = IPC::ReadParam((&(reader__))); if (!maybe__id) { FatalError("Error deserializing 'nsCString'"); return MsgValueError; } auto& id = *maybe__id; // Sentinel = 'id' if ((!(((&(reader__)))->ReadSentinel(20447438)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'"); return MsgValueError; } auto maybe__innerWindowId = IPC::ReadParam((&(reader__))); if (!maybe__innerWindowId) { FatalError("Error deserializing 'uint64_t'"); return MsgValueError; } auto& innerWindowId = *maybe__innerWindowId; // Sentinel = 'innerWindowId' if ((!(((&(reader__)))->ReadSentinel(627967298)))) { mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'"); return MsgValueError; } auto maybe__contentId = IPC::ReadParam((&(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::ActorId id__ = MSG_ROUTING_CONTROL; UniquePtr reply__(PHWInference::Reply_InstallModel(id__)); reply__->set_seqno(msg__.seqno()); RefPtr resolver__ = new mozilla::ipc::IPDLResolverInner(std::move(reply__), this); InstallModelResolver resolver = [resolver__ = std::move(resolver__)](const ModelInstallResult& aParam) { resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) { IPC::MessageWriter writer__(*reply__, self__); IPC::WriteParam((&(writer__)), aParam); // Sentinel = 'result' ((&(writer__)))->WriteSentinel(153223840); if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PHWInferenceParent", self__->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending reply ", reply__->type(), mozilla::ipc::MessageDirection::eSending); } }); }; mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::hwinference::HWInferenceParent*>(this))->RecvInstallModel(std::move(task), std::move(id), std::move(innerWindowId), std::move(contentId), std::move(resolver)); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PHWInference::Msg_GetModelFile__ID: { if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PHWInferenceParent", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PHWInference::Msg_GetModelFile", OTHER); IPC::MessageReader reader__{ msg__, this}; auto maybe__task = IPC::ReadParam((&(reader__))); if (!maybe__task) { FatalError("Error deserializing 'nsCString'"); return MsgValueError; } auto& task = *maybe__task; // Sentinel = 'task' if ((!(((&(reader__)))->ReadSentinel(71827892)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'"); return MsgValueError; } auto maybe__id = IPC::ReadParam((&(reader__))); if (!maybe__id) { FatalError("Error deserializing 'nsCString'"); return MsgValueError; } auto& id = *maybe__id; // Sentinel = 'id' if ((!(((&(reader__)))->ReadSentinel(20447438)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'"); return MsgValueError; } reader__.EndRead(); mozilla::ipc::ActorId id__ = MSG_ROUTING_CONTROL; UniquePtr reply__(PHWInference::Reply_GetModelFile(id__)); reply__->set_seqno(msg__.seqno()); RefPtr resolver__ = new mozilla::ipc::IPDLResolverInner(std::move(reply__), this); GetModelFileResolver resolver = [resolver__ = std::move(resolver__)](const GetModelFileResult& aParam) { resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) { IPC::MessageWriter writer__(*reply__, self__); IPC::WriteParam((&(writer__)), aParam); // Sentinel = 'result' ((&(writer__)))->WriteSentinel(153223840); if (mozilla::ipc::LoggingEnabledFor("PHWInference", mozilla::ipc::ParentSide)) { mozilla::ipc::LogMessageForProtocol( "PHWInferenceParent", self__->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending reply ", reply__->type(), mozilla::ipc::MessageDirection::eSending); } }); }; mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::hwinference::HWInferenceParent*>(this))->RecvGetModelFile(std::move(task), std::move(id), std::move(resolver)); 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 PHWInferenceParent::OnMessageReceived( const Message& msg__, UniquePtr& reply__) -> PHWInferenceParent::Result { if (!CanSend()) { return MsgDropped; } MOZ_ASSERT_UNREACHABLE("message protocol not supported"); return MsgNotKnown; } } // namespace hwinference } // namespace mozilla