mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
LibIPC: Make TransportSocket responsible for reading entire messages
With this change, the responsibility for prepending messages with their size and ensuring the entire message is received before returning it to the caller is moved to TransportSocket. This removes the need to duplicate this logic in both LibIPC and MessagePort. Another advantage of reducing message granularity at IPC::Transport layer is that it will make it easier to support alternative transport implementations (like Mach ports, which unlike Unix domain sockets are not stream oriented).
This commit is contained in:
parent
0a58497ab9
commit
a371f849e3
Notes:
github-actions[bot]
2025-04-07 15:00:45 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: a371f849e3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4260
7 changed files with 130 additions and 204 deletions
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
||||
* Copyright (c) 2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -79,12 +80,6 @@ private:
|
|||
ErrorOr<void> send_message_on_transport(SerializedTransferRecord const&);
|
||||
void read_from_transport();
|
||||
|
||||
enum class ParseDecision {
|
||||
NotEnoughData,
|
||||
ParseNextMessage,
|
||||
};
|
||||
ErrorOr<ParseDecision> parse_message();
|
||||
|
||||
// The HTML spec implies(!) that this is MessagePort.[[RemotePort]]
|
||||
GC::Ptr<MessagePort> m_remote_port;
|
||||
|
||||
|
@ -93,15 +88,6 @@ private:
|
|||
|
||||
Optional<IPC::Transport> m_transport;
|
||||
|
||||
enum class SocketState : u8 {
|
||||
Header,
|
||||
Data,
|
||||
Error,
|
||||
} m_socket_state { SocketState::Header };
|
||||
size_t m_socket_incoming_message_size { 0 };
|
||||
IPC::UnprocessedFileDescriptors m_unprocessed_fds;
|
||||
Vector<u8> m_buffered_data;
|
||||
|
||||
GC::Ptr<DOM::EventTarget> m_worker_event_target;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue