From ef658594e494d34ed6af899b3524dc3b6aeed254 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 30 Dec 2019 02:41:45 +0100 Subject: 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, which means that messages smaller than 1 KB avoid heap allocation entirely. --- DevTools/IPCCompiler/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'DevTools/IPCCompiler') 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 "; dbg() << "#include "; dbg() << "#include "; + dbg() << "#include "; dbg() << "#include "; dbg() << "#include "; 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) { -- cgit v1.2.3