// // Automatically generated by ipdlc. // Edit at your own risk // #include "mozilla/dom/PSerialPortChild.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/dom/SerialPortChild.h" #include "mozilla/dom/SerialPortIPCTypes.h" #include "mozilla/ipc/DataPipe.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 dom { auto PSerialPortChild::ProcessingError( Result aCode, const char* aReason) -> void { } auto PSerialPortChild::ShouldContinueFromReplyTimeout() -> bool { return true; } MOZ_IMPLICIT PSerialPortChild::PSerialPortChild() : mozilla::ipc::IToplevelProtocol("PSerialPortChild", kProtocolId, mozilla::ipc::ChildSide) { MOZ_COUNT_CTOR(PSerialPortChild); } PSerialPortChild::~PSerialPortChild() { MOZ_COUNT_DTOR(PSerialPortChild); } auto PSerialPortChild::ActorAlloc() -> void { MOZ_RELEASE_ASSERT(XRE_IsParentProcess() || XRE_IsContentProcess(), "Invalid process for `PSerialPortChild'"); AddRef(); } auto PSerialPortChild::ActorDealloc() -> void { Release(); } auto PSerialPortChild::ManagedProtocolIds() const -> mozilla::Span { return {}; } auto PSerialPortChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer* { switch (aProtocol) { default: return nullptr; } } auto PSerialPortChild::RejectPendingResponses(ResponseRejectReason aReason) -> void { mAsyncCallbacks.RejectPendingResponses(aReason); } auto PSerialPortChild::SendOpen( const IPCSerialOptions& options, mozilla::ipc::ResolveCallback&& aResolve, mozilla::ipc::RejectCallback&& aReject) -> void { UniquePtr msg__ = PSerialPort::Msg_Open(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), options); // Sentinel = 'options' ((&(writer__)))->WriteSentinel(204735245); if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Open", OTHER); IPC::Message::seqno_t seqno__ = 0; if (ChannelSend(std::move(msg__), (&(seqno__)))) { mAsyncCallbacks.AddCallback(seqno__, PSerialPort::Reply_Open__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable { auto maybe__result = IPC::ReadParam(aReader); if (!maybe__result) { (aReader)->FatalError("Error deserializing 'nsresult'"); return MsgValueError; } auto& result = *maybe__result; // Sentinel = 'result' if ((!((aReader)->ReadSentinel(153223840)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'"); return MsgValueError; } aReader->EndRead(); resolve(std::move(result)); return MsgProcessed; }, std::move(aReject)); } else { aReject(::mozilla::ipc::ResponseRejectReason::SendError); } return; } auto PSerialPortChild::SendOpen(const IPCSerialOptions& options) -> RefPtr { RefPtr::Private> promise__ = new MozPromise::Private(__func__); promise__->UseDirectTaskDispatch(__func__); SendOpen(std::forward(options), [promise__](nsresult&& aValue) { promise__->Resolve(std::move(aValue), __func__); }, [promise__](ResponseRejectReason&& aReason) { promise__->Reject(std::move(aReason), __func__); }); return promise__; } auto PSerialPortChild::SendClose( mozilla::ipc::ResolveCallback&& aResolve, mozilla::ipc::RejectCallback&& aReject) -> void { UniquePtr msg__ = PSerialPort::Msg_Close(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Close", OTHER); IPC::Message::seqno_t seqno__ = 0; if (ChannelSend(std::move(msg__), (&(seqno__)))) { mAsyncCallbacks.AddCallback(seqno__, PSerialPort::Reply_Close__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable { auto maybe__result = IPC::ReadParam(aReader); if (!maybe__result) { (aReader)->FatalError("Error deserializing 'nsresult'"); return MsgValueError; } auto& result = *maybe__result; // Sentinel = 'result' if ((!((aReader)->ReadSentinel(153223840)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'"); return MsgValueError; } aReader->EndRead(); resolve(std::move(result)); return MsgProcessed; }, std::move(aReject)); } else { aReject(::mozilla::ipc::ResponseRejectReason::SendError); } return; } auto PSerialPortChild::SendClose() -> RefPtr { RefPtr::Private> promise__ = new MozPromise::Private(__func__); promise__->UseDirectTaskDispatch(__func__); SendClose([promise__](nsresult&& aValue) { promise__->Resolve(std::move(aValue), __func__); }, [promise__](ResponseRejectReason&& aReason) { promise__->Reject(std::move(aReason), __func__); }); return promise__; } auto PSerialPortChild::SendSetSignals( const IPCSerialOutputSignals& signals, mozilla::ipc::ResolveCallback&& aResolve, mozilla::ipc::RejectCallback&& aReject) -> void { UniquePtr msg__ = PSerialPort::Msg_SetSignals(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), signals); // Sentinel = 'signals' ((&(writer__)))->WriteSentinel(197853938); if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PSerialPort::Msg_SetSignals", OTHER); IPC::Message::seqno_t seqno__ = 0; if (ChannelSend(std::move(msg__), (&(seqno__)))) { mAsyncCallbacks.AddCallback(seqno__, PSerialPort::Reply_SetSignals__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable { auto maybe__result = IPC::ReadParam(aReader); if (!maybe__result) { (aReader)->FatalError("Error deserializing 'nsresult'"); return MsgValueError; } auto& result = *maybe__result; // Sentinel = 'result' if ((!((aReader)->ReadSentinel(153223840)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'"); return MsgValueError; } aReader->EndRead(); resolve(std::move(result)); return MsgProcessed; }, std::move(aReject)); } else { aReject(::mozilla::ipc::ResponseRejectReason::SendError); } return; } auto PSerialPortChild::SendSetSignals(const IPCSerialOutputSignals& signals) -> RefPtr { RefPtr::Private> promise__ = new MozPromise::Private(__func__); promise__->UseDirectTaskDispatch(__func__); SendSetSignals(std::forward(signals), [promise__](nsresult&& aValue) { promise__->Resolve(std::move(aValue), __func__); }, [promise__](ResponseRejectReason&& aReason) { promise__->Reject(std::move(aReason), __func__); }); return promise__; } auto PSerialPortChild::SendGetSignals( mozilla::ipc::ResolveCallback>&& aResolve, mozilla::ipc::RejectCallback&& aReject) -> void { UniquePtr msg__ = PSerialPort::Msg_GetSignals(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PSerialPort::Msg_GetSignals", OTHER); IPC::Message::seqno_t seqno__ = 0; if (ChannelSend(std::move(msg__), (&(seqno__)))) { mAsyncCallbacks.AddCallback(seqno__, PSerialPort::Reply_GetSignals__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable { auto maybe__result = IPC::ReadParam(aReader); if (!maybe__result) { (aReader)->FatalError("Error deserializing 'nsresult'"); return MsgValueError; } auto& result = *maybe__result; // Sentinel = 'result' if ((!((aReader)->ReadSentinel(153223840)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'"); return MsgValueError; } auto maybe__signals = IPC::ReadParam(aReader); if (!maybe__signals) { (aReader)->FatalError("Error deserializing 'IPCSerialInputSignals'"); return MsgValueError; } auto& signals = *maybe__signals; // Sentinel = 'signals' if ((!((aReader)->ReadSentinel(197853938)))) { mozilla::ipc::SentinelReadError("Error deserializing 'IPCSerialInputSignals'"); return MsgValueError; } aReader->EndRead(); resolve(std::make_tuple(std::move(result), std::move(signals))); return MsgProcessed; }, std::move(aReject)); } else { aReject(::mozilla::ipc::ResponseRejectReason::SendError); } return; } auto PSerialPortChild::SendGetSignals() -> RefPtr { RefPtr, ResponseRejectReason, true>::Private> promise__ = new MozPromise, ResponseRejectReason, true>::Private(__func__); promise__->UseDirectTaskDispatch(__func__); SendGetSignals([promise__](std::tuple&& aValue) { promise__->Resolve(std::move(aValue), __func__); }, [promise__](ResponseRejectReason&& aReason) { promise__->Reject(std::move(aReason), __func__); }); return promise__; } auto PSerialPortChild::SendDrain( mozilla::ipc::ResolveCallback&& aResolve, mozilla::ipc::RejectCallback&& aReject) -> void { UniquePtr msg__ = PSerialPort::Msg_Drain(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Drain", OTHER); IPC::Message::seqno_t seqno__ = 0; if (ChannelSend(std::move(msg__), (&(seqno__)))) { mAsyncCallbacks.AddCallback(seqno__, PSerialPort::Reply_Drain__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable { auto maybe__result = IPC::ReadParam(aReader); if (!maybe__result) { (aReader)->FatalError("Error deserializing 'nsresult'"); return MsgValueError; } auto& result = *maybe__result; // Sentinel = 'result' if ((!((aReader)->ReadSentinel(153223840)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'"); return MsgValueError; } aReader->EndRead(); resolve(std::move(result)); return MsgProcessed; }, std::move(aReject)); } else { aReject(::mozilla::ipc::ResponseRejectReason::SendError); } return; } auto PSerialPortChild::SendDrain() -> RefPtr { RefPtr::Private> promise__ = new MozPromise::Private(__func__); promise__->UseDirectTaskDispatch(__func__); SendDrain([promise__](nsresult&& aValue) { promise__->Resolve(std::move(aValue), __func__); }, [promise__](ResponseRejectReason&& aReason) { promise__->Reject(std::move(aReason), __func__); }); return promise__; } auto PSerialPortChild::SendFlush( const bool& receive, mozilla::ipc::ResolveCallback&& aResolve, mozilla::ipc::RejectCallback&& aReject) -> void { UniquePtr msg__ = PSerialPort::Msg_Flush(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), receive); // Sentinel = 'receive' ((&(writer__)))->WriteSentinel(194118372); if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Flush", OTHER); IPC::Message::seqno_t seqno__ = 0; if (ChannelSend(std::move(msg__), (&(seqno__)))) { mAsyncCallbacks.AddCallback(seqno__, PSerialPort::Reply_Flush__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable { auto maybe__result = IPC::ReadParam(aReader); if (!maybe__result) { (aReader)->FatalError("Error deserializing 'nsresult'"); return MsgValueError; } auto& result = *maybe__result; // Sentinel = 'result' if ((!((aReader)->ReadSentinel(153223840)))) { mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'"); return MsgValueError; } aReader->EndRead(); resolve(std::move(result)); return MsgProcessed; }, std::move(aReject)); } else { aReject(::mozilla::ipc::ResponseRejectReason::SendError); } return; } auto PSerialPortChild::SendFlush(const bool& receive) -> RefPtr { RefPtr::Private> promise__ = new MozPromise::Private(__func__); promise__->UseDirectTaskDispatch(__func__); SendFlush(std::forward(receive), [promise__](nsresult&& aValue) { promise__->Resolve(std::move(aValue), __func__); }, [promise__](ResponseRejectReason&& aReason) { promise__->Reject(std::move(aReason), __func__); }); return promise__; } auto PSerialPortChild::SendAttachReadPipe(DataPipeSender* readPipeSender) -> bool { UniquePtr msg__ = PSerialPort::Msg_AttachReadPipe(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), readPipeSender); // Sentinel = 'readPipeSender' ((&(writer__)))->WriteSentinel(694289804); if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PSerialPort::Msg_AttachReadPipe", OTHER); bool sendok__ = ChannelSend(std::move(msg__)); return sendok__; } auto PSerialPortChild::SendAttachWritePipe(DataPipeReceiver* writePipeReceiver) -> bool { UniquePtr msg__ = PSerialPort::Msg_AttachWritePipe(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), writePipeReceiver); // Sentinel = 'writePipeReceiver' ((&(writer__)))->WriteSentinel(1053296367); if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PSerialPort::Msg_AttachWritePipe", OTHER); bool sendok__ = ChannelSend(std::move(msg__)); return sendok__; } auto PSerialPortChild::SendClone(Endpoint<::mozilla::dom::PSerialPortParent>&& aEndpoint) -> bool { UniquePtr msg__ = PSerialPort::Msg_Clone(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), std::move(aEndpoint)); // Sentinel = 'aEndpoint' ((&(writer__)))->WriteSentinel(292225955); if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Clone", OTHER); bool sendok__ = ChannelSend(std::move(msg__)); return sendok__; } auto PSerialPortChild::DeallocManagee( mozilla::ipc::ProtocolId aProtocolId, IProtocol* aListener) -> void { FatalError("unreached"); return; } auto PSerialPortChild::OnMessageReceived(const Message& msg__) -> PSerialPortChild::Result { if (!CanSend()) { if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Ignored message for dead actor", (&(msg__))->type(), mozilla::ipc::MessageDirection::eSending); } return MsgProcessed; } switch (msg__.type()) { case PSerialPort::Reply_Open__ID: { if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Open", OTHER); return mAsyncCallbacks.GotReply(this, msg__); } case PSerialPort::Reply_Close__ID: { if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Close", OTHER); return mAsyncCallbacks.GotReply(this, msg__); } case PSerialPort::Reply_SetSignals__ID: { if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PSerialPort::Msg_SetSignals", OTHER); return mAsyncCallbacks.GotReply(this, msg__); } case PSerialPort::Reply_GetSignals__ID: { if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PSerialPort::Msg_GetSignals", OTHER); return mAsyncCallbacks.GotReply(this, msg__); } case PSerialPort::Reply_Drain__ID: { if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Drain", OTHER); return mAsyncCallbacks.GotReply(this, msg__); } case PSerialPort::Reply_Flush__ID: { if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Flush", OTHER); return mAsyncCallbacks.GotReply(this, msg__); } case PSerialPort::Reply___delete____ID: { return MsgProcessed; } case PSerialPort::Msg_Connected__ID: { if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Connected", OTHER); mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::dom::SerialPortChild*>(this))->RecvConnected(); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PSerialPort::Msg_Disconnected__ID: { if (mozilla::ipc::LoggingEnabledFor("PSerialPort", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PSerialPortChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PSerialPort::Msg_Disconnected", OTHER); mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::dom::SerialPortChild*>(this))->RecvDisconnected(); 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 PSerialPortChild::OnMessageReceived( const Message& msg__, UniquePtr& reply__) -> PSerialPortChild::Result { if (!CanSend()) { return MsgDropped; } MOZ_ASSERT_UNREACHABLE("message protocol not supported"); return MsgNotKnown; } } // namespace dom } // namespace mozilla