LibIPC+Everywhere: Introduce an IPC Transport abstraction

This abstraction will help us to support multiple IPC transport
mechanisms going forward. For now, we only have a TransportSocket that
implements the same behavior we previously had, using Unix Sockets for
IPC.
This commit is contained in:
Andrew Kaster 2024-10-22 15:47:33 -06:00 committed by Andrew Kaster
commit 7372b2af48
Notes: github-actions[bot] 2024-10-23 19:14:14 +00:00
45 changed files with 415 additions and 234 deletions

View file

@ -35,10 +35,14 @@ void WorkerAgent::initialize(JS::Realm& realm)
// NOTE: This blocking IPC call may launch another process.
// If spinning the event loop for this can cause other javascript to execute, we're in trouble.
auto worker_socket_file = Bindings::host_defined_page(realm).client().request_worker_agent();
auto worker_socket = MUST(Core::LocalSocket::adopt_fd(worker_socket_file.take_fd()));
MUST(worker_socket->set_blocking(true));
static_assert(IsSame<IPC::Transport, IPC::TransportSocket>, "Handle other IPC::Transport types here");
m_worker_ipc = make_ref_counted<WebWorkerClient>(move(worker_socket));
auto transport = IPC::Transport(move(worker_socket));
m_worker_ipc = make_ref_counted<WebWorkerClient>(move(transport));
m_worker_ipc->async_start_dedicated_worker(m_url, m_worker_options.type, m_worker_options.credentials, m_worker_options.name, move(data_holder), m_outside_settings->serialize());
}