mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWebView: Create a spare WebContent process
Since cross-site navigation is a pretty frequent task, creating a spare process is commonplace in other browsers to reduce the overhead of directing the target site to a new process. We store this process on the WebView application. If it is unavailable, we queue a task to create it later.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
5810c8073e
commit
aca4385daf
Notes:
github-actions[bot]
2025-03-11 11:11:42 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/aca4385daf6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3882 Reviewed-by: https://github.com/gmta ✅
@@ -79,10 +79,11 @@ static ErrorOr<NonnullRefPtr<ClientType>> launch_server_process(
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
|
||||
WebView::ViewImplementation& view,
|
||||
template<typename... ClientArguments>
|
||||
static ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process_impl(
|
||||
IPC::File image_decoder_socket,
|
||||
Optional<IPC::File> request_server_socket)
|
||||
Optional<IPC::File> request_server_socket,
|
||||
ClientArguments&&... client_arguments)
|
||||
{
|
||||
auto const& chrome_options = WebView::Application::chrome_options();
|
||||
auto const& web_content_options = WebView::Application::web_content_options();
|
||||
@@ -138,7 +139,22 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
|
||||
arguments.append("--image-decoder-socket"sv);
|
||||
arguments.append(ByteString::number(image_decoder_socket.fd()));
|
||||
|
||||
return launch_server_process<WebView::WebContentClient>("WebContent"sv, move(arguments), view);
|
||||
return launch_server_process<WebView::WebContentClient>("WebContent"sv, move(arguments), forward<ClientArguments>(client_arguments)...);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
|
||||
WebView::ViewImplementation& view,
|
||||
IPC::File image_decoder_socket,
|
||||
Optional<IPC::File> request_server_socket)
|
||||
{
|
||||
return launch_web_content_process_impl(move(image_decoder_socket), move(request_server_socket), view);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_spare_web_content_process(
|
||||
IPC::File image_decoder_socket,
|
||||
Optional<IPC::File> request_server_socket)
|
||||
{
|
||||
return launch_web_content_process_impl(move(image_decoder_socket), move(request_server_socket));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<ImageDecoderClient::Client>> launch_image_decoder_process()
|
||||
|
||||
Reference in New Issue
Block a user