Ladybird+headless-browser: Make RequestServer single instance on Lagom

Co-Authored-By: Timothy Flynn <trflynn89@pm.me>
This commit is contained in:
Andrew Kaster
2024-04-15 17:39:48 -06:00
committed by Tim Flynn
parent 336b661835
commit c87e32154a
20 changed files with 308 additions and 75 deletions

View File

@@ -132,12 +132,17 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
initial_urls.append(ak_string_from_qstring(new_tab_page));
}
// NOTE: WebWorker *always* needs a request server connection, even if WebContent uses Qt Networking
// FIXME: Create an abstraction to re-spawn the RequestServer and re-hook up its client hooks to each tab on crash
auto request_server_paths = TRY(get_paths_for_helper_process("RequestServer"sv));
auto protocol_client = TRY(launch_request_server_process(request_server_paths, s_serenity_resource_root, certificates));
app.request_server_client = protocol_client;
StringBuilder command_line_builder;
command_line_builder.join(' ', arguments.strings);
Ladybird::WebContentOptions web_content_options {
.command_line = MUST(command_line_builder.to_string()),
.executable_path = MUST(String::from_byte_string(MUST(Core::System::current_executable_path()))),
.certificates = move(certificates),
.enable_callgrind_profiling = enable_callgrind_profiling ? Ladybird::EnableCallgrindProfiling::Yes : Ladybird::EnableCallgrindProfiling::No,
.enable_gpu_painting = use_gpu_painting ? Ladybird::EnableGPUPainting::Yes : Ladybird::EnableGPUPainting::No,
.use_lagom_networking = enable_qt_networking ? Ladybird::UseLagomNetworking::No : Ladybird::UseLagomNetworking::Yes,