Copy as Markdown
Other Tools
//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/dom/notification/PNotificationChild.h"
#include "ipc/ErrorIPCUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/notification/NotificationChild.h"
#include "mozilla/ipc/PBackgroundChild.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 {
namespace notification {
auto PNotificationChild::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PNotificationChild::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PNotificationChild::PNotificationChild() :
mozilla::ipc::IToplevelProtocol("PNotificationChild", kProtocolId, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PNotificationChild);
}
PNotificationChild::~PNotificationChild()
{
MOZ_COUNT_DTOR(PNotificationChild);
}
auto PNotificationChild::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsParentProcess() || XRE_IsContentProcess(), "Invalid process for `PNotificationChild'");
AddRef();
}
auto PNotificationChild::ActorDealloc() -> void
{
Release();
}
auto PNotificationChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
return {};
}
auto PNotificationChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
default:
return nullptr;
}
}
auto PNotificationChild::RejectPendingResponses(ResponseRejectReason aReason) -> void
{
mAsyncCallbacks.RejectPendingResponses(aReason);
}
auto PNotificationChild::SendShow(
mozilla::ipc::ResolveCallback<CopyableErrorResult>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PNotification::Msg_Show(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PNotification", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PNotificationChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PNotification::Msg_Show", OTHER);
int32_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PNotification::Reply_Show__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__rv = IPC::ReadParam<CopyableErrorResult>(aReader);
if (!maybe__rv) {
(aReader)->FatalError("Error deserializing 'CopyableErrorResult'");
return MsgValueError;
}
auto& rv = *maybe__rv;
// Sentinel = 'rv'
if ((!((aReader)->ReadSentinel(22806761)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'CopyableErrorResult'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::move(rv));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PNotificationChild::SendShow() -> RefPtr<ShowPromise>
{
RefPtr<MozPromise<CopyableErrorResult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<CopyableErrorResult, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendShow([promise__](CopyableErrorResult&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PNotificationChild::SendClose() -> bool
{
UniquePtr<IPC::Message> msg__ = PNotification::Msg_Close(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PNotification", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PNotificationChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PNotification::Msg_Close", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PNotificationChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PNotificationChild::OnMessageReceived(const Message& msg__) -> PNotificationChild::Result
{
switch (msg__.type()) {
case PNotification::Reply_Show__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PNotification", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PNotificationChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PNotification::Msg_Show", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
case PNotification::Msg_NotifyClick__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PNotification", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PNotificationChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PNotification::Msg_NotifyClick", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<NotificationChild*>(this))->RecvNotifyClick();
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 PNotificationChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PNotificationChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
} // namespace notification
} // namespace dom
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::dom::notification::PNotificationChild*>::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::notification::PNotificationChild*>::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, "PNotification", PNotificationMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::dom::notification::PNotificationChild*>(actor.ref());
}
return {};
}
} // namespace IPC