Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/dom/PFileSystemWritableFileStreamChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/FileSystemWritableFileStreamChild.h"
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/dom/PFileSystemManagerChild.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 {
MOZ_IMPLICIT PFileSystemWritableFileStreamChild::PFileSystemWritableFileStreamChild() :
mozilla::ipc::IRefCountedProtocol(PFileSystemWritableFileStreamMsgStart, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PFileSystemWritableFileStreamChild);
}
PFileSystemWritableFileStreamChild::~PFileSystemWritableFileStreamChild()
{
MOZ_COUNT_DTOR(PFileSystemWritableFileStreamChild);
}
auto PFileSystemWritableFileStreamChild::ActorAlloc() -> void
{
AddRef();
}
auto PFileSystemWritableFileStreamChild::ActorDealloc() -> void
{
Release();
}
auto PFileSystemWritableFileStreamChild::Manager() const -> PFileSystemManagerChild*
{
return static_cast<PFileSystemManagerChild*>(IProtocol::Manager());
}
auto PFileSystemWritableFileStreamChild::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PFileSystemWritableFileStreamChild::SendClose(
const bool& aAbort,
mozilla::ipc::ResolveCallback<void_t>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PFileSystemWritableFileStream::Msg_Close(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aAbort);
// Sentinel = 'aAbort'
((&(writer__)))->WriteSentinel(129892954);
if (mozilla::ipc::LoggingEnabledFor("PFileSystemWritableFileStream", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PFileSystemWritableFileStreamChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PFileSystemWritableFileStream::Msg_Close", OTHER);
ChannelSend(std::move(msg__), PFileSystemWritableFileStream::Reply_Close__ID, std::move(aResolve), std::move(aReject));
return;
}
auto PFileSystemWritableFileStreamChild::SendClose(const bool& aAbort) -> RefPtr<ClosePromise>
{
RefPtr<MozPromise<void_t, ResponseRejectReason, true>::Private> promise__ = new MozPromise<void_t, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendClose(std::move(aAbort), [promise__](void_t&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PFileSystemWritableFileStreamChild::Send__delete__(PFileSystemWritableFileStreamChild* actor) -> bool
{
if (!actor || !actor->CanSend()) {
NS_WARNING("Attempt to __delete__ missing or closed actor");
return false;
}
UniquePtr<IPC::Message> msg__ = PFileSystemWritableFileStream::Msg___delete__((actor)->Id());
IPC::MessageWriter writer__{
(*(msg__)),
actor};
if (mozilla::ipc::LoggingEnabledFor("PFileSystemWritableFileStream", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PFileSystemWritableFileStreamChild",
actor->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PFileSystemWritableFileStream::Msg___delete__", OTHER);
bool sendok__ = (actor)->ChannelSend(std::move(msg__));
actor->ActorDisconnected(Deletion);
return sendok__;
}
auto PFileSystemWritableFileStreamChild::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PFileSystemWritableFileStreamChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PFileSystemWritableFileStreamChild::OnMessageReceived(const Message& msg__) -> PFileSystemWritableFileStreamChild::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 PFileSystemWritableFileStream::Reply_Close__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PFileSystemWritableFileStream", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PFileSystemWritableFileStreamChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PFileSystemWritableFileStream::Msg_Close", OTHER);
IPC::MessageReader reader__{
msg__,
this};
bool resolve__ = false;
if (!IPC::ReadParam(&reader__, &resolve__)) {
FatalError("Error deserializing bool");
return MsgValueError;
}
UniquePtr<MessageChannel::UntypedCallbackHolder> untypedCallback =
GetIPCChannel()->PopCallback(msg__, Id());
typedef MessageChannel::CallbackHolder<void_t> CallbackHolder;
auto* callback = static_cast<CallbackHolder*>(untypedCallback.get());
if (!callback) {
FatalError("Error unknown callback");
return MsgProcessingError;
}
if (resolve__) {
auto maybe__ok = IPC::ReadParam<void_t>((&(reader__)));
if (!maybe__ok) {
FatalError("Error deserializing 'void_t'");
return MsgValueError;
}
auto& ok = *maybe__ok;
// Sentinel = 'ok'
if ((!(((&(reader__)))->ReadSentinel(21692635)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'void_t'");
return MsgValueError;
}
reader__.EndRead();
callback->Resolve(std::move(ok));
} else {
ResponseRejectReason reason__{};
if (!IPC::ReadParam(&reader__, &reason__)) {
FatalError("Error deserializing ResponseRejectReason");
return MsgValueError;
}
reader__.EndRead();
callback->Reject(std::move(reason__));
}
return MsgProcessed;
}
case PFileSystemWritableFileStream::Reply___delete____ID:
{
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PFileSystemWritableFileStreamChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PFileSystemWritableFileStreamChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
auto PFileSystemWritableFileStreamChild::DoomSubtree() -> void
{
SetDoomed();
}
auto PFileSystemWritableFileStreamChild::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace dom
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::dom::PFileSystemWritableFileStreamChild*>::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::PFileSystemWritableFileStreamChild*>::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, "PFileSystemWritableFileStream", PFileSystemWritableFileStreamMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::dom::PFileSystemWritableFileStreamChild*>(actor.ref());
}
return {};
}
} // namespace IPC