// // Automatically generated by ipdlc. // Edit at your own risk // #include "mozilla/layers/PVideoBridgeChild.h" #include "gfxipc/ShadowLayerUtils.h" #include "mozilla/GfxMessageUtils.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/TimeStamp.h" #include "mozilla/gfx/2D.h" #include "mozilla/ipc/IPCCore.h" #include "mozilla/layers/CompositorTypes.h" #include "mozilla/layers/LayersMessageUtils.h" #include "mozilla/layers/VideoBridgeChild.h" #include "mozilla/layers/WebRenderMessageUtils.h" #include "nsPoint.h" #include "nsRect.h" #include "mozilla/layers/PTextureChild.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 PVideoBridgeChild::ProcessingError( Result aCode, const char* aReason) -> void { } auto PVideoBridgeChild::ShouldContinueFromReplyTimeout() -> bool { return true; } MOZ_IMPLICIT PVideoBridgeChild::PVideoBridgeChild() : mozilla::ipc::IToplevelProtocol("PVideoBridgeChild", kProtocolId, mozilla::ipc::ChildSide) { MOZ_COUNT_CTOR(PVideoBridgeChild); } PVideoBridgeChild::~PVideoBridgeChild() { MOZ_COUNT_DTOR(PVideoBridgeChild); } auto PVideoBridgeChild::ActorAlloc() -> void { AddRef(); } auto PVideoBridgeChild::ActorDealloc() -> void { Release(); } auto PVideoBridgeChild::OtherPid() const -> ::base::ProcessId { ::base::ProcessId pid = ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid(); MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId); return pid; } auto PVideoBridgeChild::OtherChildID() const -> ::GeckoChildID { ::GeckoChildID childID = ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid(); MOZ_RELEASE_ASSERT(childID != -1); return childID; } auto PVideoBridgeChild::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo { return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()}; } auto PVideoBridgeChild::ManagedPTextureChild(nsTArray& aArr) const -> void { mManagedPTextureChild.ToArray(aArr); } auto PVideoBridgeChild::ManagedPTextureChild() const -> const ManagedContainer& { return mManagedPTextureChild; } auto PVideoBridgeChild::ManagedProtocolIds() const -> mozilla::Span { static constexpr ::mozilla::ipc::ProtocolId sIds[] = { PTextureMsgStart }; return sIds; } auto PVideoBridgeChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer* { switch (aProtocol) { case PTextureMsgStart: return (&(mManagedPTextureChild)); default: return nullptr; } } auto PVideoBridgeChild::RejectPendingResponses(ResponseRejectReason aReason) -> void { mAsyncCallbacks.RejectPendingResponses(aReason); } auto PVideoBridgeChild::OpenPTextureEndpoint(PTextureChild* aActor) -> ManagedEndpoint { if (!aActor) { NS_WARNING("Cannot bind null PTextureChild actor"); return ManagedEndpoint(); } if (!aActor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PTextureChild actor"); return ManagedEndpoint(); } // Mark our actor as awaiting the other side to be bound. This will // be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is // received. aActor->mAwaitingManagedEndpointBind = true; return ManagedEndpoint(mozilla::ipc::PrivateIPDLInterface(), aActor); } auto PVideoBridgeChild::BindPTextureEndpoint( ManagedEndpoint aEndpoint, PTextureChild* aActor) -> bool { return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this); } auto PVideoBridgeChild::SendPTextureConstructor( PTextureChild* actor, const SurfaceDescriptor& aSharedData, ReadLockDescriptor&& aReadLock, const LayersBackend& aBackend, const TextureFlags& aTextureFlags, const ContentParentId& aContentId, const uint64_t& aSerial) -> PTextureChild* { if (!actor) { NS_WARNING("Cannot bind null PTextureChild actor"); return nullptr; } if (!actor->SetManagerAndRegister(this)) { NS_WARNING("Failed to bind PTextureChild actor"); return nullptr; } // Build our constructor message. UniquePtr msg__ = PVideoBridge::Msg_PTextureConstructor(MSG_ROUTING_CONTROL); IPC::MessageWriter writer__{ (*(msg__)), this}; IPC::WriteParam((&(writer__)), (actor)->Id()); // Sentinel = 'actorid' ((&(writer__)))->WriteSentinel(193725159); IPC::WriteParam((&(writer__)), aSharedData); // Sentinel = 'aSharedData' ((&(writer__)))->WriteSentinel(420480051); IPC::WriteParam((&(writer__)), std::move(aReadLock)); // Sentinel = 'aReadLock' ((&(writer__)))->WriteSentinel(279774055); IPC::WriteParam((&(writer__)), aBackend); // Sentinel = 'aBackend' ((&(writer__)))->WriteSentinel(221119242); IPC::WriteParam((&(writer__)), aTextureFlags); // Sentinel = 'aTextureFlags' ((&(writer__)))->WriteSentinel(614139200); IPC::WriteParam((&(writer__)), aContentId); // Sentinel = 'aContentId' ((&(writer__)))->WriteSentinel(358876138); IPC::WriteParam((&(writer__)), aSerial); // Sentinel = 'aSerial' ((&(writer__)))->WriteSentinel(181011138); // Notify the other side about the newly created actor. This can // fail if our manager has already been destroyed. // // NOTE: If the send call fails due to toplevel channel teardown, // the `IProtocol::ChannelSend` wrapper absorbs the error for us, // so we don't tear down actors unexpectedly. if (mozilla::ipc::LoggingEnabledFor("PVideoBridge", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PVideoBridgeChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending ", msg__->type(), mozilla::ipc::MessageDirection::eSending); } AUTO_PROFILER_LABEL("PVideoBridge::Msg_PTextureConstructor", OTHER); bool sendok__ = ChannelSend(std::move(msg__)); // Warn, destroy the actor, and return null if the message failed to // send. Otherwise, return the successfully created actor reference. if (!sendok__) { NS_WARNING("Error sending PTextureChild constructor"); actor->ActorDisconnected(FailedConstructor); return nullptr; } return actor; } auto PVideoBridgeChild::DeallocManagee( mozilla::ipc::ProtocolId aProtocolId, IProtocol* aListener) -> void { switch (aProtocolId) { default: FatalError("unreached"); return; } } auto PVideoBridgeChild::OnMessageReceived(const Message& msg__) -> PVideoBridgeChild::Result { if (!CanSend()) { if (mozilla::ipc::LoggingEnabledFor("PVideoBridge", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PVideoBridgeChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Ignored message for dead actor", (&(msg__))->type(), mozilla::ipc::MessageDirection::eSending); } return MsgProcessed; } IPC::Message::routeid_t route__ = msg__.routing_id(); if (MSG_ROUTING_CONTROL != route__) { IProtocol* routed__ = Lookup(route__); if (!routed__ || !routed__->GetLifecycleProxy()) { if (mozilla::ipc::LoggingEnabledFor("PVideoBridge", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PVideoBridgeChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Ignored message for dead actor", (&(msg__))->type(), mozilla::ipc::MessageDirection::eSending); } return MsgProcessed; } RefPtr proxy__ = routed__->GetLifecycleProxy(); return proxy__->Get()->OnMessageReceived(msg__); } switch (msg__.type()) { case PVideoBridge::Msg_Ping__ID: { if (mozilla::ipc::LoggingEnabledFor("PVideoBridge", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PVideoBridgeChild", this->ToplevelProtocol()->OtherPidMaybeInvalid(), "Received ", (&(msg__))->type(), mozilla::ipc::MessageDirection::eReceiving); } AUTO_PROFILER_LABEL("PVideoBridge::Msg_Ping", OTHER); mozilla::ipc::ActorId id__ = MSG_ROUTING_CONTROL; UniquePtr reply__(PVideoBridge::Reply_Ping(id__)); reply__->set_seqno(msg__.seqno()); RefPtr resolver__ = new mozilla::ipc::IPDLResolverInner(std::move(reply__), this); PingResolver resolver = [resolver__ = std::move(resolver__)](const void_t& aParam) { resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) { IPC::MessageWriter writer__(*reply__, self__); IPC::WriteParam((&(writer__)), aParam); // Sentinel = 'ok' ((&(writer__)))->WriteSentinel(21692635); if (mozilla::ipc::LoggingEnabledFor("PVideoBridge", mozilla::ipc::ChildSide)) { mozilla::ipc::LogMessageForProtocol( "PVideoBridgeChild", self__->ToplevelProtocol()->OtherPidMaybeInvalid(), "Sending reply ", reply__->type(), mozilla::ipc::MessageDirection::eSending); } }); }; mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::layers::VideoBridgeChild*>(this))->RecvPing(std::move(resolver)); if ((!(__ok))) { mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); // Error handled in mozilla::ipc::IPCResult return MsgProcessingError; } return MsgProcessed; } case PVideoBridge::Reply_PTextureConstructor__ID: { 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 PVideoBridgeChild::OnMessageReceived( const Message& msg__, UniquePtr& reply__) -> PVideoBridgeChild::Result { if (!CanSend()) { return MsgDropped; } IPC::Message::routeid_t route__ = msg__.routing_id(); if (MSG_ROUTING_CONTROL != route__) { IProtocol* routed__ = Lookup(route__); if (!routed__ || !routed__->GetLifecycleProxy()) { return MsgDropped; } RefPtr proxy__ = routed__->GetLifecycleProxy(); return proxy__->Get()->OnMessageReceived(msg__, reply__); } return MsgNotKnown; } } // namespace layers } // namespace mozilla