From ba4e6dc52bfe161290e32c0efb159e9e10e4a7f5 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Wed, 26 Jun 2024 12:57:15 -0600 Subject: [PATCH] Ladybird: Remove unnecessary RegisterWithProcessManager enum This was only put in place because on SerenityOS, we wanted to use the pid of the WebContent process, rather than the peer pid for the socket. When launching with SystemServer, this got annoying. However, now that we only have the case that the UI process spawns processes, we can get rid of this hack. This restores the ability to see WebContent processes' statistics in the task manager widget. --- Ladybird/HelperProcess.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Ladybird/HelperProcess.cpp b/Ladybird/HelperProcess.cpp index d577f4c123f..48b77a879f5 100644 --- a/Ladybird/HelperProcess.cpp +++ b/Ladybird/HelperProcess.cpp @@ -10,17 +10,11 @@ #include #include -enum class RegisterWithProcessManager { - No, - Yes, -}; - template static ErrorOr> launch_server_process( StringView server_name, ReadonlySpan candidate_server_paths, Vector arguments, - RegisterWithProcessManager register_with_process_manager, Ladybird::EnableCallgrindProfiling enable_callgrind_profiling, ClientArguments&&... client_arguments) { @@ -51,8 +45,7 @@ static ErrorOr> launch_server_process( if constexpr (requires { process.client->set_pid(pid_t {}); }) process.client->set_pid(process.process.pid()); - if (register_with_process_manager == RegisterWithProcessManager::Yes) - WebView::ProcessManager::the().add_process(WebView::process_type_from_name(server_name), process.process.pid()); + WebView::ProcessManager::the().add_process(WebView::process_type_from_name(server_name), process.process.pid()); if (enable_callgrind_profiling == Ladybird::EnableCallgrindProfiling::Yes) { dbgln(); @@ -117,7 +110,7 @@ ErrorOr> launch_web_content_process( arguments.append("--image-decoder-socket"sv); arguments.append(ByteString::number(image_decoder_socket.fd())); - return launch_server_process("WebContent"sv, candidate_web_content_paths, move(arguments), RegisterWithProcessManager::No, web_content_options.enable_callgrind_profiling, view); + return launch_server_process("WebContent"sv, candidate_web_content_paths, move(arguments), web_content_options.enable_callgrind_profiling, view); } ErrorOr> launch_image_decoder_process(ReadonlySpan candidate_image_decoder_paths) @@ -128,7 +121,7 @@ ErrorOr> launch_image_decoder_process( arguments.append(server.value()); } - return launch_server_process("ImageDecoder"sv, candidate_image_decoder_paths, arguments, RegisterWithProcessManager::Yes, Ladybird::EnableCallgrindProfiling::No); + return launch_server_process("ImageDecoder"sv, candidate_image_decoder_paths, arguments, Ladybird::EnableCallgrindProfiling::No); } ErrorOr> launch_web_worker_process(ReadonlySpan candidate_web_worker_paths, NonnullRefPtr request_client) @@ -140,7 +133,7 @@ ErrorOr> launch_web_worker_process(Rea ByteString::number(socket.fd()), }; - return launch_server_process("WebWorker"sv, candidate_web_worker_paths, move(arguments), RegisterWithProcessManager::Yes, Ladybird::EnableCallgrindProfiling::No); + return launch_server_process("WebWorker"sv, candidate_web_worker_paths, move(arguments), Ladybird::EnableCallgrindProfiling::No); } ErrorOr> launch_request_server_process(ReadonlySpan candidate_request_server_paths, StringView serenity_resource_root, Vector const& certificates) @@ -160,7 +153,7 @@ ErrorOr> launch_request_server_process(Re arguments.append(server.value()); } - return launch_server_process("RequestServer"sv, candidate_request_server_paths, move(arguments), RegisterWithProcessManager::Yes, Ladybird::EnableCallgrindProfiling::No); + return launch_server_process("RequestServer"sv, candidate_request_server_paths, move(arguments), Ladybird::EnableCallgrindProfiling::No); } ErrorOr connect_new_request_server_client(Protocol::RequestClient& client)