mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
Ladybird+LibWebView: Move options used to launch WebContent to a struct
It is currently a bit messy to pass these options along from main() to where WebContent is actually launched. If a new flag were to be added, there are a couple dozen files that need to be updated to pass that flag along. With this change, the flag can just be added to the struct, set in main(), and handled in launch_web_content_process().
This commit is contained in:
parent
8504d8f588
commit
07e9a8f79b
22 changed files with 104 additions and 74 deletions
|
@ -6,12 +6,10 @@
|
|||
|
||||
#include "HelperProcess.h"
|
||||
|
||||
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(WebView::ViewImplementation& view,
|
||||
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
|
||||
WebView::ViewImplementation& view,
|
||||
ReadonlySpan<String> candidate_web_content_paths,
|
||||
WebView::EnableCallgrindProfiling enable_callgrind_profiling,
|
||||
WebView::IsLayoutTestMode is_layout_test_mode,
|
||||
Ladybird::UseLagomNetworking use_lagom_networking,
|
||||
WebView::EnableGPUPainting enable_gpu_painting)
|
||||
Ladybird::WebContentOptions const& web_content_options)
|
||||
{
|
||||
int socket_fds[2] {};
|
||||
TRY(Core::System::socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fds));
|
||||
|
@ -49,13 +47,13 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(Web
|
|||
"--webcontent-fd-passing-socket"sv,
|
||||
webcontent_fd_passing_socket_string
|
||||
};
|
||||
if (enable_callgrind_profiling == WebView::EnableCallgrindProfiling::No)
|
||||
if (web_content_options.enable_callgrind_profiling == Ladybird::EnableCallgrindProfiling::No)
|
||||
arguments.remove(0, callgrind_prefix_length);
|
||||
if (is_layout_test_mode == WebView::IsLayoutTestMode::Yes)
|
||||
if (web_content_options.is_layout_test_mode == Ladybird::IsLayoutTestMode::Yes)
|
||||
arguments.append("--layout-test-mode"sv);
|
||||
if (use_lagom_networking == Ladybird::UseLagomNetworking::Yes)
|
||||
if (web_content_options.use_lagom_networking == Ladybird::UseLagomNetworking::Yes)
|
||||
arguments.append("--use-lagom-networking"sv);
|
||||
if (enable_gpu_painting == WebView::EnableGPUPainting::Yes)
|
||||
if (web_content_options.enable_gpu_painting == Ladybird::EnableGPUPainting::Yes)
|
||||
arguments.append("--use-gpu-painting"sv);
|
||||
|
||||
result = Core::System::exec(arguments[0], arguments.span(), Core::System::SearchInPath::Yes);
|
||||
|
@ -77,7 +75,7 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(Web
|
|||
auto new_client = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) WebView::WebContentClient(move(socket), view)));
|
||||
new_client->set_fd_passing_socket(TRY(Core::LocalSocket::adopt_fd(ui_fd_passing_fd)));
|
||||
|
||||
if (enable_callgrind_profiling == WebView::EnableCallgrindProfiling::Yes) {
|
||||
if (web_content_options.enable_callgrind_profiling == Ladybird::EnableCallgrindProfiling::Yes) {
|
||||
dbgln();
|
||||
dbgln("\033[1;45mLaunched WebContent process under callgrind!\033[0m");
|
||||
dbgln("\033[100mRun `\033[4mcallgrind_control -i on\033[24m` to start instrumentation and `\033[4mcallgrind_control -i off\033[24m` stop it again.\033[0m");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue