Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/layers/PCanvasParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/layers/CanvasTranslator.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/gfx/PCanvasManagerParent.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 layers {
auto PCanvasParent::Recv__delete__() -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
MOZ_IMPLICIT PCanvasParent::PCanvasParent() :
mozilla::ipc::IRefCountedProtocol(PCanvasMsgStart, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PCanvasParent);
}
PCanvasParent::~PCanvasParent()
{
MOZ_COUNT_DTOR(PCanvasParent);
}
auto PCanvasParent::ActorAlloc() -> void
{
AddRef();
}
auto PCanvasParent::ActorDealloc() -> void
{
Release();
}
auto PCanvasParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PCanvasParent::Manager() const -> PCanvasManagerParent*
{
return static_cast<PCanvasManagerParent*>(IProtocol::Manager());
}
auto PCanvasParent::AllManagedActors(nsTArray<RefPtr<mozilla::ipc::ActorLifecycleProxy>>& arr__) const -> void
{
uint32_t total = 0;
arr__.SetCapacity(total);
}
auto PCanvasParent::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PCanvasParent::SendNotifyDeviceChanged() -> bool
{
UniquePtr<IPC::Message> msg__ = PCanvas::Msg_NotifyDeviceChanged(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_NotifyDeviceChanged", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PCanvasParent::SendDeactivate() -> bool
{
UniquePtr<IPC::Message> msg__ = PCanvas::Msg_Deactivate(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_Deactivate", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PCanvasParent::SendBlockCanvas() -> bool
{
UniquePtr<IPC::Message> msg__ = PCanvas::Msg_BlockCanvas(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_BlockCanvas", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PCanvasParent::SendNotifyRequiresRefresh(const int64_t& aTextureId) -> bool
{
UniquePtr<IPC::Message> msg__ = PCanvas::Msg_NotifyRequiresRefresh(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aTextureId);
// Sentinel = 'aTextureId'
((&(writer__)))->WriteSentinel(371590144);
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_NotifyRequiresRefresh", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PCanvasParent::SendSnapshotShmem(
const int64_t& aTextureId,
Handle&& aShmemHandle,
const uint32_t& aShmemSize,
mozilla::ipc::ResolveCallback<bool>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PCanvas::Msg_SnapshotShmem(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aTextureId);
// Sentinel = 'aTextureId'
((&(writer__)))->WriteSentinel(371590144);
IPC::WriteParam((&(writer__)), std::move(aShmemHandle));
// Sentinel = 'aShmemHandle'
((&(writer__)))->WriteSentinel(501679272);
IPC::WriteParam((&(writer__)), aShmemSize);
// Sentinel = 'aShmemSize'
((&(writer__)))->WriteSentinel(358155255);
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_SnapshotShmem", OTHER);
ChannelSend(std::move(msg__), PCanvas::Reply_SnapshotShmem__ID, std::move(aResolve), std::move(aReject));
return;
}
auto PCanvasParent::SendSnapshotShmem(
const int64_t& aTextureId,
Handle&& aShmemHandle,
const uint32_t& aShmemSize) -> RefPtr<SnapshotShmemPromise>
{
RefPtr<MozPromise<bool, ResponseRejectReason, true>::Private> promise__ = new MozPromise<bool, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendSnapshotShmem(std::move(aTextureId), std::move(aShmemHandle), std::move(aShmemSize), [promise__](bool&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PCanvasParent::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PCanvasParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PCanvasParent::OnMessageReceived(const Message& msg__) -> PCanvasParent::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;
IProtocol* mgr = this->Manager();
this->DestroySubtree(ManagedEndpointDropped);
this->ClearSubtree();
mgr->RemoveManagee(PCanvasMsgStart, this);
return MsgProcessed;
}
case PCanvas::Msg_InitTranslator__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_InitTranslator", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aTextureType = IPC::ReadParam<TextureType>((&(reader__)));
if (!maybe__aTextureType) {
FatalError("Error deserializing 'TextureType'");
return MsgValueError;
}
auto& aTextureType = *maybe__aTextureType;
// Sentinel = 'aTextureType'
if ((!(((&(reader__)))->ReadSentinel(534119669)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'TextureType'");
return MsgValueError;
}
auto maybe__aWebglTextureType = IPC::ReadParam<TextureType>((&(reader__)));
if (!maybe__aWebglTextureType) {
FatalError("Error deserializing 'TextureType'");
return MsgValueError;
}
auto& aWebglTextureType = *maybe__aWebglTextureType;
// Sentinel = 'aWebglTextureType'
if ((!(((&(reader__)))->ReadSentinel(1019348710)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'TextureType'");
return MsgValueError;
}
auto maybe__aBackendType = IPC::ReadParam<BackendType>((&(reader__)));
if (!maybe__aBackendType) {
FatalError("Error deserializing 'BackendType'");
return MsgValueError;
}
auto& aBackendType = *maybe__aBackendType;
// Sentinel = 'aBackendType'
if ((!(((&(reader__)))->ReadSentinel(492176556)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'BackendType'");
return MsgValueError;
}
auto maybe__aHeaderHandle = IPC::ReadParam<Handle>((&(reader__)));
if (!maybe__aHeaderHandle) {
FatalError("Error deserializing 'Handle'");
return MsgValueError;
}
auto& aHeaderHandle = *maybe__aHeaderHandle;
// Sentinel = 'aHeaderHandle'
if ((!(((&(reader__)))->ReadSentinel(570098935)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'Handle'");
return MsgValueError;
}
auto maybe__aBufferHandles = IPC::ReadParam<nsTArray<Handle>>((&(reader__)));
if (!maybe__aBufferHandles) {
FatalError("Error deserializing 'Handle[]'");
return MsgValueError;
}
auto& aBufferHandles = *maybe__aBufferHandles;
// Sentinel = 'aBufferHandles'
if ((!(((&(reader__)))->ReadSentinel(673318267)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'Handle[]'");
return MsgValueError;
}
auto maybe__aBufferSize = IPC::ReadParam<uint64_t>((&(reader__)));
if (!maybe__aBufferSize) {
FatalError("Error deserializing 'uint64_t'");
return MsgValueError;
}
auto& aBufferSize = *maybe__aBufferSize;
// Sentinel = 'aBufferSize'
if ((!(((&(reader__)))->ReadSentinel(425264215)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
return MsgValueError;
}
auto maybe__aReaderSem = IPC::ReadParam<CrossProcessSemaphoreHandle>((&(reader__)));
if (!maybe__aReaderSem) {
FatalError("Error deserializing 'CrossProcessSemaphoreHandle'");
return MsgValueError;
}
auto& aReaderSem = *maybe__aReaderSem;
// Sentinel = 'aReaderSem'
if ((!(((&(reader__)))->ReadSentinel(349045722)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'CrossProcessSemaphoreHandle'");
return MsgValueError;
}
auto maybe__aWriterSem = IPC::ReadParam<CrossProcessSemaphoreHandle>((&(reader__)));
if (!maybe__aWriterSem) {
FatalError("Error deserializing 'CrossProcessSemaphoreHandle'");
return MsgValueError;
}
auto& aWriterSem = *maybe__aWriterSem;
// Sentinel = 'aWriterSem'
if ((!(((&(reader__)))->ReadSentinel(368772100)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'CrossProcessSemaphoreHandle'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<CanvasTranslator*>(this))->RecvInitTranslator(std::move(aTextureType), std::move(aWebglTextureType), std::move(aBackendType), std::move(aHeaderHandle), std::move(aBufferHandles), std::move(aBufferSize), std::move(aReaderSem), std::move(aWriterSem));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PCanvas::Msg_RestartTranslation__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_RestartTranslation", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<CanvasTranslator*>(this))->RecvRestartTranslation();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PCanvas::Msg_AddBuffer__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_AddBuffer", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aBufferHandle = IPC::ReadParam<Handle>((&(reader__)));
if (!maybe__aBufferHandle) {
FatalError("Error deserializing 'Handle'");
return MsgValueError;
}
auto& aBufferHandle = *maybe__aBufferHandle;
// Sentinel = 'aBufferHandle'
if ((!(((&(reader__)))->ReadSentinel(581371144)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'Handle'");
return MsgValueError;
}
auto maybe__aBufferSize = IPC::ReadParam<uint64_t>((&(reader__)));
if (!maybe__aBufferSize) {
FatalError("Error deserializing 'uint64_t'");
return MsgValueError;
}
auto& aBufferSize = *maybe__aBufferSize;
// Sentinel = 'aBufferSize'
if ((!(((&(reader__)))->ReadSentinel(425264215)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<CanvasTranslator*>(this))->RecvAddBuffer(std::move(aBufferHandle), std::move(aBufferSize));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PCanvas::Msg_SetDataSurfaceBuffer__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_SetDataSurfaceBuffer", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aBufferHandle = IPC::ReadParam<Handle>((&(reader__)));
if (!maybe__aBufferHandle) {
FatalError("Error deserializing 'Handle'");
return MsgValueError;
}
auto& aBufferHandle = *maybe__aBufferHandle;
// Sentinel = 'aBufferHandle'
if ((!(((&(reader__)))->ReadSentinel(581371144)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'Handle'");
return MsgValueError;
}
auto maybe__aBufferSize = IPC::ReadParam<uint64_t>((&(reader__)));
if (!maybe__aBufferSize) {
FatalError("Error deserializing 'uint64_t'");
return MsgValueError;
}
auto& aBufferSize = *maybe__aBufferSize;
// Sentinel = 'aBufferSize'
if ((!(((&(reader__)))->ReadSentinel(425264215)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<CanvasTranslator*>(this))->RecvSetDataSurfaceBuffer(std::move(aBufferHandle), std::move(aBufferSize));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PCanvas::Msg_ClearCachedResources__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_ClearCachedResources", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<CanvasTranslator*>(this))->RecvClearCachedResources();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PCanvas::Msg___delete____ID:
{
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PCanvas::Msg___delete__", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<CanvasTranslator*>(this))->Recv__delete__();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
IProtocol* mgr = this->Manager();
this->DestroySubtree(Deletion);
this->ClearSubtree();
mgr->RemoveManagee(PCanvasMsgStart, this);
return MsgProcessed;
}
case PCanvas::Reply_SnapshotShmem__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PCanvas", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PCanvasParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PCanvas::Msg_SnapshotShmem", 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<bool> CallbackHolder;
auto* callback = static_cast<CallbackHolder*>(untypedCallback.get());
if (!callback) {
FatalError("Error unknown callback");
return MsgProcessingError;
}
if (resolve__) {
auto maybe__aSuccess = IPC::ReadParam<bool>((&(reader__)));
if (!maybe__aSuccess) {
FatalError("Error deserializing 'bool'");
return MsgValueError;
}
auto& aSuccess = *maybe__aSuccess;
// Sentinel = 'aSuccess'
if ((!(((&(reader__)))->ReadSentinel(236323643)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
return MsgValueError;
}
reader__.EndRead();
callback->Resolve(std::move(aSuccess));
} else {
ResponseRejectReason reason__{};
if (!IPC::ReadParam(&reader__, &reason__)) {
FatalError("Error deserializing ResponseRejectReason");
return MsgValueError;
}
reader__.EndRead();
callback->Reject(std::move(reason__));
}
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PCanvasParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PCanvasParent::Result
{
return MsgNotKnown;
}
auto PCanvasParent::ClearSubtree() -> void
{
}
} // namespace layers
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::layers::PCanvasParent*>::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::layers::PCanvasParent*>::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, "PCanvas", PCanvasMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::layers::PCanvasParent*>(actor.ref());
}
return {};
}
} // namespace IPC