Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/dom/PMIDIPortChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/MIDIPortChild.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 PMIDIPortChild::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PMIDIPortChild::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PMIDIPortChild::PMIDIPortChild() :
mozilla::ipc::IToplevelProtocol("PMIDIPortChild", PMIDIPortMsgStart, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PMIDIPortChild);
}
PMIDIPortChild::~PMIDIPortChild()
{
MOZ_COUNT_DTOR(PMIDIPortChild);
}
auto PMIDIPortChild::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsParentProcess() || XRE_IsContentProcess(), "Invalid process for `PMIDIPortChild'");
AddRef();
}
auto PMIDIPortChild::ActorDealloc() -> void
{
Release();
}
auto PMIDIPortChild::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PMIDIPortChild::SendShutdown() -> bool
{
UniquePtr<IPC::Message> msg__ = PMIDIPort::Msg_Shutdown(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Shutdown", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PMIDIPortChild::SendSend(mozilla::Span<MIDIMessage const> msg) -> bool
{
UniquePtr<IPC::Message> msg__ = PMIDIPort::Msg_Send(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), msg);
// Sentinel = 'msg'
((&(writer__)))->WriteSentinel(43450696);
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Send", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PMIDIPortChild::SendOpen() -> bool
{
UniquePtr<IPC::Message> msg__ = PMIDIPort::Msg_Open(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Open", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PMIDIPortChild::SendClose() -> bool
{
UniquePtr<IPC::Message> msg__ = PMIDIPort::Msg_Close(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Close", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PMIDIPortChild::SendClear() -> bool
{
UniquePtr<IPC::Message> msg__ = PMIDIPort::Msg_Clear(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Clear", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PMIDIPortChild::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PMIDIPortChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PMIDIPortChild::OnMessageReceived(const Message& msg__) -> PMIDIPortChild::Result
{
switch (msg__.type()) {
case PMIDIPort::Msg_Receive__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_Receive", 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<MIDIPortChild*>(this))->RecvReceive(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_UpdateStatus__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PMIDIPort", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PMIDIPortChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PMIDIPort::Msg_UpdateStatus", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__deviceState = IPC::ReadParam<uint32_t>((&(reader__)));
if (!maybe__deviceState) {
FatalError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto& deviceState = *maybe__deviceState;
// Sentinel = 'deviceState'
if ((!(((&(reader__)))->ReadSentinel(447284338)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto maybe__connectionState = IPC::ReadParam<uint32_t>((&(reader__)));
if (!maybe__connectionState) {
FatalError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto& connectionState = *maybe__connectionState;
// Sentinel = 'connectionState'
if ((!(((&(reader__)))->ReadSentinel(834209330)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<MIDIPortChild*>(this))->RecvUpdateStatus(std::move(deviceState), std::move(connectionState));
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 PMIDIPortChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PMIDIPortChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
auto PMIDIPortChild::DoomSubtree() -> void
{
SetDoomed();
}
auto PMIDIPortChild::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace dom
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::dom::PMIDIPortChild*>::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::PMIDIPortChild*>::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::PMIDIPortChild*>(actor.ref());
}
return {};
}
} // namespace IPC