LibIPC: Move send thread from IPC connection to the transport layer

By doing this we also make MessagePort, that relies on IPC transport,
to send messages from separate thread, which solves the problem when
WebWorker and WebContent could deadlock if both were trying to post
messages at the same time.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/4254
This commit is contained in:
Aliaksandr Kalenik 2025-04-08 04:55:50 +02:00 committed by Alexander Kalenik
commit 14bac7b287
Notes: github-actions[bot] 2025-04-08 19:10:29 +00:00
6 changed files with 118 additions and 111 deletions

View file

@ -19,32 +19,6 @@
namespace IPC {
class AutoCloseFileDescriptor : public RefCounted<AutoCloseFileDescriptor> {
public:
AutoCloseFileDescriptor(int fd)
: m_fd(fd)
{
}
~AutoCloseFileDescriptor()
{
if (m_fd != -1)
(void)Core::System::close(m_fd);
}
int value() const { return m_fd; }
int take_fd()
{
int fd = m_fd;
m_fd = -1;
return fd;
}
private:
int m_fd;
};
class MessageBuffer {
public:
MessageBuffer();