1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +00:00

LibIPC: Let's start building custom message codecs for LibIPC

Instead of using ByteBuffer (which always malloc() their storage) for
IPC message encoding, we now use a Vector<u8, 1024>, which means that
messages smaller than 1 KB avoid heap allocation entirely.
This commit is contained in:
Andreas Kling 2019-12-30 02:41:45 +01:00
parent 00d26457c5
commit ef658594e4
3 changed files with 102 additions and 6 deletions

View file

@ -1,7 +1,8 @@
#pragma once
#include <AK/String.h>
#include <AK/ByteBuffer.h>
typedef Vector<u8, 1024> IMessageBuffer;
class IMessage {
public:
@ -10,7 +11,7 @@ public:
virtual int endpoint_magic() const = 0;
virtual int message_id() const = 0;
virtual String message_name() const = 0;
virtual ByteBuffer encode() const = 0;
virtual IMessageBuffer encode() const = 0;
protected:
IMessage();