1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +00:00

Userland: Get rid of the OwnPtr<...> boilerplate code for IPC handlers

This commit is contained in:
Gunnar Beutner 2021-05-02 04:39:36 +02:00 committed by Andreas Kling
parent 1a015dc379
commit 7cf2839a26
33 changed files with 389 additions and 385 deletions

View file

@ -48,13 +48,18 @@ public:
}
void post_message(const Message& message)
{
post_message(message.encode());
}
// FIXME: unnecessary copy
void post_message(MessageBuffer buffer)
{
// NOTE: If this connection is being shut down, but has not yet been destroyed,
// the socket will be closed. Don't try to send more messages.
if (!m_socket->is_open())
return;
auto buffer = message.encode();
// Prepend the message size.
uint32_t message_size = buffer.data.size();
buffer.data.prepend(reinterpret_cast<const u8*>(&message_size), sizeof(message_size));