mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:17:44 +00:00
Userland: Get rid of the OwnPtr<...> boilerplate code for IPC handlers
This commit is contained in:
parent
1a015dc379
commit
7cf2839a26
33 changed files with 389 additions and 385 deletions
|
@ -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));
|
||||
|
|
|
@ -16,6 +16,7 @@ class BufferStream;
|
|||
namespace IPC {
|
||||
|
||||
class Message;
|
||||
class MessageBuffer;
|
||||
|
||||
class Endpoint {
|
||||
public:
|
||||
|
@ -23,7 +24,7 @@ public:
|
|||
|
||||
virtual u32 magic() const = 0;
|
||||
virtual String name() const = 0;
|
||||
virtual OwnPtr<Message> handle(const Message&) = 0;
|
||||
virtual OwnPtr<MessageBuffer> handle(const Message&) = 0;
|
||||
|
||||
protected:
|
||||
Endpoint();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue