diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-12-30 02:41:45 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-30 02:41:45 +0100 |
commit | ef658594e494d34ed6af899b3524dc3b6aeed254 (patch) | |
tree | 55f49aa34df36b1d3bae3768dad151631ffa8bd0 /DevTools | |
parent | 00d26457c5390237f0c88a5f55ffc0c24aa6d6e8 (diff) | |
download | serenity-ef658594e494d34ed6af899b3524dc3b6aeed254.zip |
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.
Diffstat (limited to 'DevTools')
-rw-r--r-- | DevTools/IPCCompiler/main.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/DevTools/IPCCompiler/main.cpp b/DevTools/IPCCompiler/main.cpp index 711f782a7d..9e9ab7664b 100644 --- a/DevTools/IPCCompiler/main.cpp +++ b/DevTools/IPCCompiler/main.cpp @@ -201,6 +201,7 @@ int main(int argc, char** argv) dbg() << "#include <AK/OwnPtr.h>"; dbg() << "#include <LibDraw/Color.h>"; dbg() << "#include <LibDraw/Rect.h>"; + dbg() << "#include <LibIPC/IEncoder.h>"; dbg() << "#include <LibIPC/IEndpoint.h>"; dbg() << "#include <LibIPC/IMessage.h>"; dbg(); @@ -358,11 +359,11 @@ int main(int argc, char** argv) dbg() << " size_in_bytes = stream.offset();"; dbg() << " return make<" << name << ">(" << builder.to_string() << ");"; dbg() << " }"; - dbg() << " virtual ByteBuffer encode() const override"; + dbg() << " virtual IMessageBuffer encode() const override"; dbg() << " {"; // FIXME: Support longer messages: - dbg() << " auto buffer = ByteBuffer::create_uninitialized(4096);"; - dbg() << " BufferStream stream(buffer);"; + dbg() << " IMessageBuffer buffer;"; + dbg() << " IEncoder stream(buffer);"; dbg() << " stream << endpoint_magic();"; dbg() << " stream << (int)MessageID::" << name << ";"; for (auto& parameter : parameters) { @@ -398,7 +399,6 @@ int main(int argc, char** argv) dbg() << " stream << m_" << parameter.name << ";"; } } - dbg() << " stream.snip();"; dbg() << " return buffer;"; dbg() << " }"; for (auto& parameter : parameters) { |