1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

LibIPC+LibWeb: Add an IPC helper to transfer an IPC message buffer

This large block of code is repeated nearly verbatim in LibWeb. Move it
to a helper function that both LibIPC and LibWeb can defer to. This will
let us make changes to this method in a singular location going forward.

Note this is a bit of a regression for the MessagePort. It now suffers
from the same performance issue that IPC messages face - we prepend the
meessage size to the message buffer. This degredation is very temporary
though, as a fix is imminent, and this change makes that fix easier.
This commit is contained in:
Timothy Flynn 2024-01-02 20:14:18 -05:00 committed by Andreas Kling
parent bf15b66117
commit 91558fa381
6 changed files with 72 additions and 91 deletions

View file

@ -10,6 +10,8 @@
#include <AK/Error.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/Vector.h>
#include <LibCore/Forward.h>
#include <unistd.h>
namespace IPC {
@ -34,6 +36,8 @@ private:
};
struct MessageBuffer {
ErrorOr<void> transfer_message(Core::LocalSocket& fd_passing_socket, Core::LocalSocket& data_socket);
Vector<u8, 1024> data;
Vector<NonnullRefPtr<AutoCloseFileDescriptor>, 1> fds;
};