Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/net/PWebSocketConnectionChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/ipc/TransportSecurityInfoUtils.h"
#include "mozilla/net/WebSocketConnectionChild.h"
#include "nsITransportSecurityInfo.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 net {
auto PWebSocketConnectionChild::Recv__delete__() -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
auto PWebSocketConnectionChild::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PWebSocketConnectionChild::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PWebSocketConnectionChild::PWebSocketConnectionChild() :
mozilla::ipc::IToplevelProtocol("PWebSocketConnectionChild", PWebSocketConnectionMsgStart, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PWebSocketConnectionChild);
}
PWebSocketConnectionChild::~PWebSocketConnectionChild()
{
MOZ_COUNT_DTOR(PWebSocketConnectionChild);
}
auto PWebSocketConnectionChild::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsSocketProcess(), "Invalid process for `PWebSocketConnectionChild'");
AddRef();
}
auto PWebSocketConnectionChild::ActorDealloc() -> void
{
Release();
}
auto PWebSocketConnectionChild::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PWebSocketConnectionChild::SendOnTransportAvailable(nsITransportSecurityInfo* aSecurityInfo) -> bool
{
UniquePtr<IPC::Message> msg__ = PWebSocketConnection::Msg_OnTransportAvailable(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aSecurityInfo);
// Sentinel = 'aSecurityInfo'
((&(writer__)))->WriteSentinel(610075974);
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_OnTransportAvailable", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebSocketConnectionChild::SendOnError(const nsresult& aStatus) -> bool
{
UniquePtr<IPC::Message> msg__ = PWebSocketConnection::Msg_OnError(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aStatus);
// Sentinel = 'aStatus'
((&(writer__)))->WriteSentinel(186712806);
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_OnError", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebSocketConnectionChild::SendOnTCPClosed() -> bool
{
UniquePtr<IPC::Message> msg__ = PWebSocketConnection::Msg_OnTCPClosed(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_OnTCPClosed", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebSocketConnectionChild::SendOnDataReceived(mozilla::Span<uint8_t const> aData) -> bool
{
UniquePtr<IPC::Message> msg__ = PWebSocketConnection::Msg_OnDataReceived(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aData);
// Sentinel = 'aData'
((&(writer__)))->WriteSentinel(90571228);
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_OnDataReceived", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebSocketConnectionChild::SendOnUpgradeFailed(const nsresult& aReason) -> bool
{
UniquePtr<IPC::Message> msg__ = PWebSocketConnection::Msg_OnUpgradeFailed(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aReason);
// Sentinel = 'aReason'
((&(writer__)))->WriteSentinel(180093642);
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_OnUpgradeFailed", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PWebSocketConnectionChild::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PWebSocketConnectionChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PWebSocketConnectionChild::OnMessageReceived(const Message& msg__) -> PWebSocketConnectionChild::Result
{
switch (msg__.type()) {
case PWebSocketConnection::Msg_WriteOutputData__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_WriteOutputData", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aData = IPC::ReadParam<nsTArray<uint8_t>>((&(reader__)));
if (!maybe__aData) {
FatalError("Error deserializing 'uint8_t[]'");
return MsgValueError;
}
auto& aData = *maybe__aData;
// Sentinel = 'aData'
if ((!(((&(reader__)))->ReadSentinel(90571228)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint8_t[]'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<WebSocketConnectionChild*>(this))->RecvWriteOutputData(std::move(aData));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PWebSocketConnection::Msg_StartReading__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_StartReading", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<WebSocketConnectionChild*>(this))->RecvStartReading();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PWebSocketConnection::Msg_DrainSocketData__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PWebSocketConnection", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PWebSocketConnectionChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PWebSocketConnection::Msg_DrainSocketData", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<WebSocketConnectionChild*>(this))->RecvDrainSocketData();
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 PWebSocketConnectionChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PWebSocketConnectionChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
auto PWebSocketConnectionChild::DoomSubtree() -> void
{
SetDoomed();
}
auto PWebSocketConnectionChild::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace net
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::net::PWebSocketConnectionChild*>::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::net::PWebSocketConnectionChild*>::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, "PWebSocketConnection", PWebSocketConnectionMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::net::PWebSocketConnectionChild*>(actor.ref());
}
return {};
}
} // namespace IPC