LibWebView: Implement stubbed out BrowserProcess methods on Windows

This commit is contained in:
ayeteadoe 2025-08-23 23:47:03 -07:00 committed by Andrew Kaster
parent 231336f137
commit 6261c433a3
Notes: github-actions[bot] 2025-10-30 03:09:32 +00:00

View file

@ -45,9 +45,8 @@ ErrorOr<BrowserProcess::ProcessDisposition> BrowserProcess::connect(Vector<ByteS
return ProcessDisposition::ContinueMainProcess; return ProcessDisposition::ContinueMainProcess;
} }
ErrorOr<void> BrowserProcess::connect_as_client([[maybe_unused]] ByteString const& socket_path, [[maybe_unused]] Vector<ByteString> const& raw_urls, [[maybe_unused]] NewWindow new_window) ErrorOr<void> BrowserProcess::connect_as_client(ByteString const& socket_path, Vector<ByteString> const& raw_urls, NewWindow new_window)
{ {
#if !defined(AK_OS_WINDOWS)
// TODO: Mach IPC // TODO: Mach IPC
auto socket = TRY(Core::LocalSocket::connect(socket_path)); auto socket = TRY(Core::LocalSocket::connect(socket_path));
auto client = UIProcessClient::construct(make<IPC::Transport>(move(socket))); auto client = UIProcessClient::construct(make<IPC::Transport>(move(socket)));
@ -61,14 +60,10 @@ ErrorOr<void> BrowserProcess::connect_as_client([[maybe_unused]] ByteString cons
} }
return {}; return {};
#else
return Error::from_string_literal("BrowserProcess::connect_as_client() is not implemented on Windows");
#endif
} }
ErrorOr<void> BrowserProcess::connect_as_server([[maybe_unused]] ByteString const& socket_path) ErrorOr<void> BrowserProcess::connect_as_server(ByteString const& socket_path)
{ {
#if !defined(AK_OS_WINDOWS)
// TODO: Mach IPC // TODO: Mach IPC
auto socket_fd = TRY(Process::create_ipc_socket(socket_path)); auto socket_fd = TRY(Process::create_ipc_socket(socket_path));
m_socket_path = socket_path; m_socket_path = socket_path;
@ -90,15 +85,18 @@ ErrorOr<void> BrowserProcess::connect_as_server([[maybe_unused]] ByteString cons
}; };
return {}; return {};
#else
return Error::from_string_literal("BrowserProcess::connect_as_server() is not implemented on Windows");
#endif
} }
BrowserProcess::~BrowserProcess() BrowserProcess::~BrowserProcess()
{ {
if (m_pid_file) { if (m_pid_file) {
MUST(m_pid_file->truncate(0)); MUST(m_pid_file->truncate(0));
#if defined(AK_OS_WINDOWS)
// NOTE: On Windows, System::open() duplicates the underlying OS file handle,
// so we need to explicitly close said handle, otherwise the unlink() call fails due
// to permission errors and we crash on shutdown.
m_pid_file->close();
#endif
MUST(Core::System::unlink(m_pid_path)); MUST(Core::System::unlink(m_pid_path));
} }