1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +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:
Timothy Flynn 2023-12-01 12:18:40 -05:00 committed by Tim Flynn
parent 8504d8f588
commit 07e9a8f79b
22 changed files with 104 additions and 74 deletions

View file

@ -53,9 +53,8 @@ namespace Ladybird {
bool is_using_dark_system_theme(QWidget&);
WebContentView::WebContentView(StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling, UseLagomNetworking use_lagom_networking, WebView::EnableGPUPainting enable_gpu_painting)
: m_use_lagom_networking(use_lagom_networking)
, m_use_gpu_painting(enable_gpu_painting)
WebContentView::WebContentView(WebContentOptions const& web_content_options, StringView webdriver_content_ipc_path)
: m_web_content_options(web_content_options)
, m_webdriver_content_ipc_path(webdriver_content_ipc_path)
{
setMouseTracking(true);
@ -76,7 +75,7 @@ WebContentView::WebContentView(StringView webdriver_content_ipc_path, WebView::E
update_viewport_rect();
});
create_client(enable_callgrind_profiling);
create_client();
on_did_layout = [this](auto content_size) {
verticalScrollBar()->setMinimum(0);
@ -600,12 +599,12 @@ void WebContentView::update_palette(PaletteMode mode)
client().async_update_system_theme(make_system_theme_from_qt_palette(*this, mode));
}
void WebContentView::create_client(WebView::EnableCallgrindProfiling enable_callgrind_profiling)
void WebContentView::create_client()
{
m_client_state = {};
auto candidate_web_content_paths = get_paths_for_helper_process("WebContent"sv).release_value_but_fixme_should_propagate_errors();
auto new_client = launch_web_content_process(*this, candidate_web_content_paths, enable_callgrind_profiling, WebView::IsLayoutTestMode::No, m_use_lagom_networking, m_use_gpu_painting).release_value_but_fixme_should_propagate_errors();
auto new_client = launch_web_content_process(*this, candidate_web_content_paths, m_web_content_options).release_value_but_fixme_should_propagate_errors();
m_client_state.client = new_client;
m_client_state.client->on_web_content_process_crash = [this] {