Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/dom/PMIDIPortParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/MIDIPortParent.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 PMIDIPortParent::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PMIDIPortParent::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PMIDIPortParent::PMIDIPortParent() :
mozilla::ipc::IToplevelProtocol("PMIDIPortParent", PMIDIPortMsgStart, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PMIDIPortParent);
}
PMIDIPortParent::~PMIDIPortParent()
{
MOZ_COUNT_DTOR(PMIDIPortParent);
}
auto PMIDIPortParent::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Invalid process for `PMIDIPortParent'");
AddRef();
}
auto PMIDIPortParent::ActorDealloc() -> void
{
Release();
}
auto PMIDIPortParent::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PMIDIPortParent::SendReceive(mozilla::Span<MIDIMessage const> msg) -> bool
{
UniquePtr<IPC::Message> msg__ = PMIDIPort::Msg_Receive(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), msg);
// Sentinel = 'msg'
((&(writer__)))->WriteSentinel(43450696);
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Receive", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PMIDIPortParent::SendUpdateStatus(
const uint32_t& deviceState,
const uint32_t& connectionState) -> bool
{
UniquePtr<IPC::Message> msg__ = PMIDIPort::Msg_UpdateStatus(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), deviceState);
// Sentinel = 'deviceState'
((&(writer__)))->WriteSentinel(447284338);
IPC::WriteParam((&(writer__)), connectionState);
// Sentinel = 'connectionState'
((&(writer__)))->WriteSentinel(834209330);
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_UpdateStatus", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PMIDIPortParent::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PMIDIPortParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PMIDIPortParent::OnMessageReceived(const Message& msg__) -> PMIDIPortParent::Result
{
switch (msg__.type()) {
case PMIDIPort::Msg_Shutdown__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Shutdown", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<MIDIPortParent*>(this))->RecvShutdown();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PMIDIPort::Msg_Send__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Send", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__msg = IPC::ReadParam<nsTArray<MIDIMessage>>((&(reader__)));
if (!maybe__msg) {
FatalError("Error deserializing 'MIDIMessage[]'");
return MsgValueError;
}
auto& msg = *maybe__msg;
// Sentinel = 'msg'
if ((!(((&(reader__)))->ReadSentinel(43450696)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'MIDIMessage[]'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<MIDIPortParent*>(this))->RecvSend(std::move(msg));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PMIDIPort::Msg_Open__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Open", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<MIDIPortParent*>(this))->RecvOpen();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PMIDIPort::Msg_Close__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Close", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<MIDIPortParent*>(this))->RecvClose();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PMIDIPort::Msg_Clear__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Clear", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<MIDIPortParent*>(this))->RecvClear();
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 PMIDIPortParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PMIDIPortParent::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
auto PMIDIPortParent::DoomSubtree() -> void
{
SetDoomed();
}
auto PMIDIPortParent::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace dom
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::dom::PMIDIPortParent*>::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::dom::PMIDIPortParent*>::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, "PMIDIPort", PMIDIPortMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::dom::PMIDIPortParent*>(actor.ref());
}
return {};
}
} // namespace IPC