//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/dom/PSerialManagerChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/SerialManagerChild.h"
#include "mozilla/dom/SerialPortIPCTypes.h"
#include "mozilla/dom/PWindowGlobalChild.h"
#include "mozilla/dom/PSerialPortChild.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 PSerialManagerChild::Recv__delete__() -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
MOZ_IMPLICIT PSerialManagerChild::PSerialManagerChild() :
mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PSerialManagerChild);
}
PSerialManagerChild::~PSerialManagerChild()
{
MOZ_COUNT_DTOR(PSerialManagerChild);
}
auto PSerialManagerChild::ActorAlloc() -> void
{
AddRef();
}
auto PSerialManagerChild::ActorDealloc() -> void
{
Release();
}
auto PSerialManagerChild::Manager() const -> PWindowGlobalChild*
{
return static_cast<PWindowGlobalChild*>(IProtocol::Manager());
}
auto PSerialManagerChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
return {};
}
auto PSerialManagerChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
default:
return nullptr;
}
}
auto PSerialManagerChild::RejectPendingResponses(ResponseRejectReason aReason) -> void
{
mAsyncCallbacks.RejectPendingResponses(aReason);
}
auto PSerialManagerChild::SendGetAvailablePorts(
mozilla::ipc::ResolveCallback<nsTArray<IPCSerialPortInfo>>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PSerialManager::Msg_GetAvailablePorts(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_GetAvailablePorts", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PSerialManager::Reply_GetAvailablePorts__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__ports = IPC::ReadParam<nsTArray<IPCSerialPortInfo>>(aReader);
if (!maybe__ports) {
(aReader)->FatalError("Error deserializing 'IPCSerialPortInfo[]'");
return MsgValueError;
}
auto& ports = *maybe__ports;
// Sentinel = 'ports'
if ((!((aReader)->ReadSentinel(111280697)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'IPCSerialPortInfo[]'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(ports));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PSerialManagerChild::SendGetAvailablePorts() -> RefPtr<GetAvailablePortsPromise>
{
RefPtr<MozPromise<nsTArray<IPCSerialPortInfo>, ResponseRejectReason, true>::Private> promise__ = new MozPromise<nsTArray<IPCSerialPortInfo>, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendGetAvailablePorts([promise__](nsTArray<IPCSerialPortInfo>&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PSerialManagerChild::SendCreatePort(
const nsAString& portId,
Endpoint<::mozilla::dom::PSerialPortParent>&& parentEndpoint) -> bool
{
UniquePtr<IPC::Message> msg__ = PSerialManager::Msg_CreatePort(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), portId);
// Sentinel = 'portId'
((&(writer__)))->WriteSentinel(149619315);
IPC::WriteParam((&(writer__)), std::move(parentEndpoint));
// Sentinel = 'parentEndpoint'
((&(writer__)))->WriteSentinel(723715532);
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_CreatePort", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PSerialManagerChild::SendSimulateDeviceConnection(
const nsAString& deviceId,
const nsAString& devicePath,
const uint16_t& vendorId,
const uint16_t& productId,
mozilla::ipc::ResolveCallback<nsresult>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PSerialManager::Msg_SimulateDeviceConnection(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), deviceId);
// Sentinel = 'deviceId'
((&(writer__)))->WriteSentinel(242025246);
IPC::WriteParam((&(writer__)), devicePath);
// Sentinel = 'devicePath'
((&(writer__)))->WriteSentinel(369886206);
IPC::WriteParam((&(writer__)), vendorId);
// Sentinel = 'vendorId'
((&(writer__)))->WriteSentinel(252379964);
IPC::WriteParam((&(writer__)), productId);
// Sentinel = 'productId'
((&(writer__)))->WriteSentinel(319882159);
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_SimulateDeviceConnection", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PSerialManager::Reply_SimulateDeviceConnection__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__rv = IPC::ReadParam<nsresult>(aReader);
if (!maybe__rv) {
(aReader)->FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& rv = *maybe__rv;
// Sentinel = 'rv'
if ((!((aReader)->ReadSentinel(22806761)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(rv));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PSerialManagerChild::SendSimulateDeviceConnection(
const nsAString& deviceId,
const nsAString& devicePath,
const uint16_t& vendorId,
const uint16_t& productId) -> RefPtr<SimulateDeviceConnectionPromise>
{
RefPtr<MozPromise<nsresult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<nsresult, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendSimulateDeviceConnection(std::move(deviceId), std::move(devicePath), std::move(vendorId), std::move(productId), [promise__](nsresult&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PSerialManagerChild::SendSimulateDeviceDisconnection(
const nsAString& deviceId,
mozilla::ipc::ResolveCallback<nsresult>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PSerialManager::Msg_SimulateDeviceDisconnection(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), deviceId);
// Sentinel = 'deviceId'
((&(writer__)))->WriteSentinel(242025246);
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_SimulateDeviceDisconnection", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PSerialManager::Reply_SimulateDeviceDisconnection__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__rv = IPC::ReadParam<nsresult>(aReader);
if (!maybe__rv) {
(aReader)->FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& rv = *maybe__rv;
// Sentinel = 'rv'
if ((!((aReader)->ReadSentinel(22806761)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(rv));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PSerialManagerChild::SendSimulateDeviceDisconnection(const nsAString& deviceId) -> RefPtr<SimulateDeviceDisconnectionPromise>
{
RefPtr<MozPromise<nsresult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<nsresult, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendSimulateDeviceDisconnection(std::move(deviceId), [promise__](nsresult&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PSerialManagerChild::SendRemoveAllMockDevices(
mozilla::ipc::ResolveCallback<nsresult>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PSerialManager::Msg_RemoveAllMockDevices(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_RemoveAllMockDevices", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PSerialManager::Reply_RemoveAllMockDevices__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__rv = IPC::ReadParam<nsresult>(aReader);
if (!maybe__rv) {
(aReader)->FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& rv = *maybe__rv;
// Sentinel = 'rv'
if ((!((aReader)->ReadSentinel(22806761)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(rv));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PSerialManagerChild::SendRemoveAllMockDevices() -> RefPtr<RemoveAllMockDevicesPromise>
{
RefPtr<MozPromise<nsresult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<nsresult, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendRemoveAllMockDevices([promise__](nsresult&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PSerialManagerChild::SendResetToDefaultMockDevices(
mozilla::ipc::ResolveCallback<nsresult>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PSerialManager::Msg_ResetToDefaultMockDevices(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_ResetToDefaultMockDevices", OTHER);
IPC::Message::seqno_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PSerialManager::Reply_ResetToDefaultMockDevices__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__rv = IPC::ReadParam<nsresult>(aReader);
if (!maybe__rv) {
(aReader)->FatalError("Error deserializing 'nsresult'");
return MsgValueError;
}
auto& rv = *maybe__rv;
// Sentinel = 'rv'
if ((!((aReader)->ReadSentinel(22806761)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(rv));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PSerialManagerChild::SendResetToDefaultMockDevices() -> RefPtr<ResetToDefaultMockDevicesPromise>
{
RefPtr<MozPromise<nsresult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<nsresult, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendResetToDefaultMockDevices([promise__](nsresult&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PSerialManagerChild::DeallocManagee(
mozilla::ipc::ProtocolId aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PSerialManagerChild::OnMessageReceived(const Message& msg__) -> PSerialManagerChild::Result
{
switch (msg__.type()) {
case MANAGED_ENDPOINT_BOUND_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
return MsgProcessed;
}
case MANAGED_ENDPOINT_DROPPED_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
this->ActorDisconnected(ManagedEndpointDropped);
return MsgProcessed;
}
case PSerialManager::Reply_GetAvailablePorts__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_GetAvailablePorts", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PSerialManager::Reply_SimulateDeviceConnection__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_SimulateDeviceConnection", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PSerialManager::Reply_SimulateDeviceDisconnection__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_SimulateDeviceDisconnection", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PSerialManager::Reply_RemoveAllMockDevices__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_RemoveAllMockDevices", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PSerialManager::Reply_ResetToDefaultMockDevices__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg_ResetToDefaultMockDevices", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PSerialManager::Msg___delete____ID:
{
if (mozilla::ipc::LoggingEnabledFor("PSerialManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PSerialManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PSerialManager::Msg___delete__", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<SerialManagerChild*>(this))->Recv__delete__();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
this->ActorDisconnected(Deletion);
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PSerialManagerChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PSerialManagerChild::Result
{
return MsgNotKnown;
}
} // namespace dom
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::dom::PSerialManagerChild*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, static_cast<mozilla::ipc::IProtocol*>(aVar));
// Sentinel = 'PSerialManager'
(aWriter)->WriteSentinel(665191788);
}
auto ParamTraits<::mozilla::dom::PSerialManagerChild*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe__actor = IPC::ReadParam<mozilla::ipc::IProtocol*>(aReader);
if (!maybe__actor) {
aReader->FatalError("Error deserializing managed PSerialManager actor");
return {};
}
auto& actor = *maybe__actor;
// Sentinel = 'PSerialManager'
if ((!((aReader)->ReadSentinel(665191788)))) {
mozilla::ipc::SentinelReadError("Error deserializing managed PSerialManager actor");
return {};
}
if (actor && actor->GetProtocolId() != PSerialManagerMsgStart) {
aReader->FatalError("Unexpected actor type (expected PSerialManager)");
return {};
}
return static_cast<::mozilla::dom::PSerialManagerChild*>(actor);
}
} // namespace IPC