1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 02:13:56 +09:00

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
parent af2dae63d1
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

@ -43,16 +43,7 @@ ErrorOr<void> MessageBuffer::transfer_message(Transport& transport)
return Error::from_string_literal("Message is too large for IPC encoding");
}
auto raw_fds = Vector<int, 1> {};
auto num_fds_to_transfer = m_fds.size();
if (num_fds_to_transfer > 0) {
raw_fds.ensure_capacity(num_fds_to_transfer);
for (auto& owned_fd : m_fds) {
raw_fds.unchecked_append(owned_fd->value());
}
}
TRY(transport.transfer_message(m_data.span(), raw_fds));
transport.post_message(m_data, m_fds);
return {};
}