mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibCore+LibIPC: Add Core::AnonymousBuffer, an IPC-friendly buffer class
This will be used to migrate remaining clients off of shbufs.
This commit is contained in:
parent
a7f63eab84
commit
9c6c18d9b6
6 changed files with 243 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/AnonymousBuffer.h>
|
||||
#include <LibIPC/Dictionary.h>
|
||||
#include <LibIPC/Encoder.h>
|
||||
#include <LibIPC/File.h>
|
||||
|
@ -170,4 +171,13 @@ Encoder& Encoder::operator<<(const File& file)
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool encode(Encoder& encoder, const Core::AnonymousBuffer& buffer)
|
||||
{
|
||||
encoder << buffer.is_valid();
|
||||
if (buffer.is_valid()) {
|
||||
encoder << (u32)buffer.size();
|
||||
encoder << IPC::File(buffer.fd());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue