From ca51378bac3826b4a1eeb5e240bab63010ac8a4a Mon Sep 17 00:00:00 2001 From: stasoid Date: Sat, 21 Dec 2024 10:03:51 +0500 Subject: [PATCH] LibWeb: Port to Windows --- Libraries/LibWeb/HTML/MessagePort.cpp | 30 +++++++++++---------------- Libraries/LibWeb/HTML/WorkerAgent.cpp | 2 +- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Libraries/LibWeb/HTML/MessagePort.cpp b/Libraries/LibWeb/HTML/MessagePort.cpp index cd528fe74401..7920c80fe6d9 100644 --- a/Libraries/LibWeb/HTML/MessagePort.cpp +++ b/Libraries/LibWeb/HTML/MessagePort.cpp @@ -97,14 +97,11 @@ WebIDL::ExceptionOr MessagePort::transfer_steps(HTML::TransferDataHolder& m_remote_port->m_has_been_shipped = true; // 2. Set dataHolder.[[RemotePort]] to remotePort. - if constexpr (IsSame) { - auto fd = MUST(m_transport->release_underlying_transport_for_transfer()); - m_transport = {}; - data_holder.fds.append(IPC::File::adopt_fd(fd)); - data_holder.data.append(IPC_FILE_TAG); - } else { - VERIFY(false && "Don't know how to transfer IPC::Transport type"); - } + // TODO: Mach IPC + auto fd = MUST(m_transport->release_underlying_transport_for_transfer()); + m_transport = {}; + data_holder.fds.append(IPC::File::adopt_fd(fd)); + data_holder.data.append(IPC_FILE_TAG); } // 4. Otherwise, set dataHolder.[[RemotePort]] to null. @@ -128,16 +125,13 @@ WebIDL::ExceptionOr MessagePort::transfer_receiving_steps(HTML::TransferDa // (This will disentangle dataHolder.[[RemotePort]] from the original port that was transferred.) auto fd_tag = data_holder.data.take_first(); if (fd_tag == IPC_FILE_TAG) { - if constexpr (IsSame) { - auto fd = data_holder.fds.take_first(); - m_transport = IPC::Transport(MUST(Core::LocalSocket::adopt_fd(fd.take_fd()))); - - m_transport->set_up_read_hook([strong_this = GC::make_root(this)]() { - strong_this->read_from_transport(); - }); - } else { - VERIFY(false && "Don't know how to receive IPC::Transport type"); - } + // TODO: Mach IPC + auto fd = data_holder.fds.take_first(); + m_transport = IPC::Transport(MUST(Core::LocalSocket::adopt_fd(fd.take_fd()))); + + m_transport->set_up_read_hook([strong_this = GC::make_root(this)]() { + strong_this->read_from_transport(); + }); } else if (fd_tag != 0) { dbgln("Unexpected byte {:x} in MessagePort transfer data", fd_tag); VERIFY_NOT_REACHED(); diff --git a/Libraries/LibWeb/HTML/WorkerAgent.cpp b/Libraries/LibWeb/HTML/WorkerAgent.cpp index 67923c006c89..3a011770deed 100644 --- a/Libraries/LibWeb/HTML/WorkerAgent.cpp +++ b/Libraries/LibWeb/HTML/WorkerAgent.cpp @@ -38,8 +38,8 @@ void WorkerAgent::initialize(JS::Realm& realm) auto worker_socket = MUST(Core::LocalSocket::adopt_fd(worker_socket_file.take_fd())); MUST(worker_socket->set_blocking(true)); - static_assert(IsSame, "Handle other IPC::Transport types here"); + // TODO: Mach IPC auto transport = IPC::Transport(move(worker_socket)); m_worker_ipc = make_ref_counted(move(transport));