mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibWeb: Post all MessagePort messages over their LocalSockets
This is to allow future changes to do cross-process MessagePorts in an implementation-agnostic way. Add some tests for this behavior. Delivering messages that were posted to a MessagePort just before it was transferred is not yet implemented still.
This commit is contained in:
parent
6e3b816763
commit
c0f50b12a4
Notes:
sideshowbarker
2024-07-16 22:11:09 +09:00
Author: https://github.com/ADKaster
Commit: c0f50b12a4
Pull-request: https://github.com/SerenityOS/serenity/pull/22361
7 changed files with 301 additions and 52 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -70,6 +71,10 @@ private:
|
|||
void disentangle();
|
||||
|
||||
WebIDL::ExceptionOr<void> message_port_post_message_steps(JS::GCPtr<MessagePort> target_port, JS::Value message, StructuredSerializeOptions const& options);
|
||||
void post_message_task_steps(SerializedTransferRecord&);
|
||||
void post_port_message(SerializedTransferRecord);
|
||||
ErrorOr<void> send_message_on_socket(SerializedTransferRecord const&);
|
||||
void read_from_socket();
|
||||
|
||||
// The HTML spec implies(!) that this is MessagePort.[[RemotePort]]
|
||||
JS::GCPtr<MessagePort> m_remote_port;
|
||||
|
@ -78,6 +83,14 @@ private:
|
|||
bool m_has_been_shipped { false };
|
||||
|
||||
OwnPtr<Core::LocalSocket> m_socket;
|
||||
OwnPtr<Core::LocalSocket> m_fd_passing_socket;
|
||||
|
||||
enum class SocketState : u8 {
|
||||
Header,
|
||||
Data,
|
||||
Error,
|
||||
} m_socket_state { SocketState::Header };
|
||||
size_t m_socket_incoming_message_size { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue