1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:37:35 +00:00

Ladybird+WebContent: Add chrome command line and exe path passing

This commit is contained in:
Bastiaan van der Plaat 2024-01-16 18:55:40 +01:00 committed by Andreas Kling
parent c94fc7d3b0
commit dc2233ef7a
9 changed files with 54 additions and 8 deletions

View file

@ -68,7 +68,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (initial_urls.is_empty())
initial_urls.append(new_tab_page_url);
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()))),
.enable_gpu_painting = use_gpu_painting ? Ladybird::EnableGPUPainting::Yes : Ladybird::EnableGPUPainting::No,
.use_lagom_networking = Ladybird::UseLagomNetworking::Yes,
.wait_for_debugger = debug_web_content ? Ladybird::WaitForDebugger::Yes : Ladybird::WaitForDebugger::No,

View file

@ -44,6 +44,10 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
"--tool=callgrind"sv,
"--instr-atstart=no"sv,
path.bytes_as_string_view(),
"--command-line"sv,
web_content_options.command_line,
"--executable-path"sv,
web_content_options.executable_path,
"--webcontent-fd-passing-socket"sv,
webcontent_fd_passing_socket_string
};

View file

@ -143,7 +143,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
initial_urls.append(ak_string_from_qstring(new_tab_page));
}
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()))),
.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,

View file

@ -6,6 +6,8 @@
#pragma once
#include <AK/String.h>
namespace Ladybird {
enum class EnableCallgrindProfiling {
@ -34,6 +36,8 @@ enum class WaitForDebugger {
};
struct WebContentOptions {
String command_line;
String executable_path;
EnableCallgrindProfiling enable_callgrind_profiling { EnableCallgrindProfiling::No };
EnableGPUPainting enable_gpu_painting { EnableGPUPainting::No };
IsLayoutTestMode is_layout_test_mode { IsLayoutTestMode::No };

View file

@ -76,6 +76,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
#endif
});
StringView command_line {};
StringView executable_path {};
int webcontent_fd_passing_socket { -1 };
bool is_layout_test_mode = false;
bool use_lagom_networking = false;
@ -83,6 +85,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
bool wait_for_debugger = false;
Core::ArgsParser args_parser;
args_parser.add_option(command_line, "Chrome process command line", "command-line", 0, "command_line");
args_parser.add_option(executable_path, "Chrome process executable path", "executable-path", 0, "executable_path");
args_parser.add_option(webcontent_fd_passing_socket, "File descriptor of the passing socket for the WebContent connection", "webcontent-fd-passing-socket", 'c', "webcontent_fd_passing_socket");
args_parser.add_option(is_layout_test_mode, "Is layout test mode", "layout-test-mode", 0);
args_parser.add_option(use_lagom_networking, "Enable Lagom servers for networking", "use-lagom-networking", 0);
@ -95,6 +99,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Core::Process::wait_for_debugger_and_break();
}
Web::set_chrome_process_command_line(command_line);
Web::set_chrome_process_executable_path(executable_path);
if (use_gpu_painting) {
WebContent::PageClient::set_use_gpu_painter();
}