mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00: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:
parent
5810c8073e
commit
aca4385daf
Notes:
github-actions[bot]
2025-03-11 11:11:42 +00:00
Author: https://github.com/trflynn89
Commit: aca4385daf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3882
Reviewed-by: https://github.com/gmta ✅
8 changed files with 98 additions and 9 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue