diff --git a/Libraries/LibWebView/Application.cpp b/Libraries/LibWebView/Application.cpp index 777015ee5d..49913c39c6 100644 --- a/Libraries/LibWebView/Application.cpp +++ b/Libraries/LibWebView/Application.cpp @@ -169,7 +169,6 @@ ErrorOr Application::initialize(Main::Arguments const& arguments) bool disable_http_memory_cache = false; bool disable_http_disk_cache = false; bool disable_content_blocker = false; - bool disable_compositor_process = false; Vector content_blocker_list_paths; Optional resource_substitution_map_path; bool enable_autoplay = false; @@ -244,7 +243,6 @@ ErrorOr Application::initialize(Main::Arguments const& arguments) args_parser.add_option(disable_http_memory_cache, "Disable HTTP memory cache", "disable-http-memory-cache"); args_parser.add_option(disable_http_disk_cache, "Disable HTTP disk cache", "disable-http-disk-cache"); args_parser.add_option(disable_content_blocker, "Disable content blocker", "disable-content-blocker"); - args_parser.add_option(disable_compositor_process, "Disable the out-of-process compositor", "disable-compositor-process"); args_parser.add_option(Core::ArgsParser::Option { .argument_mode = Core::ArgsParser::OptionArgumentMode::Required, .help_string = "Path to a content blocker list. May be specified multiple times.", @@ -368,7 +366,6 @@ ErrorOr Application::initialize(Main::Arguments const& arguments) : OptionalNone()), .devtools_port = devtools_port, .enable_content_blocker = disable_content_blocker ? EnableContentBlocker::No : EnableContentBlocker::Yes, - .enable_compositor_process = disable_compositor_process ? EnableCompositorProcess::No : EnableCompositorProcess::Yes, .content_blocker_list_paths = move(content_blocker_list_paths_as_byte_strings), }; @@ -504,8 +501,6 @@ static ErrorOr> create_web_content_client(Option static bool can_send_compositor_process_ipc(RefPtr const& compositor_client) { - if (!Application::the().should_use_compositor_process()) - return false; if (!compositor_client) return false; return compositor_client->is_open(); @@ -513,8 +508,6 @@ static bool can_send_compositor_process_ipc(RefPtr const& comp ErrorOr Application::connect_web_content_to_compositor(WebContentClient& web_content_client) { - if (!should_use_compositor_process()) - return {}; if (web_content_client.compositor_connection_id({}).has_value()) return {}; @@ -549,8 +542,6 @@ void Application::register_compositor_context(WebContentClient& web_content_clie ErrorOr Application::try_register_compositor_context(WebContentClient& web_content_client, Web::Compositor::CompositorContextId context_id, Optional page_id, Web::Compositor::PagePresentationRegistration page_presentation_registration) { - if (!should_use_compositor_process()) - return {}; if (!m_compositor_client) return Error::from_string_literal("Compositor process is not available"); @@ -715,8 +706,7 @@ ErrorOr Application::launch_services() TRY(launch_request_server()); TRY(launch_image_decoder_server()); - if (should_use_compositor_process()) - TRY(launch_compositor_process()); + TRY(launch_compositor_process()); if (m_browser_options.devtools_port.has_value()) TRY(launch_devtools_server()); @@ -726,9 +716,6 @@ ErrorOr Application::launch_services() ErrorOr Application::launch_compositor_process() { - if (!should_use_compositor_process()) - return {}; - VERIFY(!m_compositor_client); m_compositor_client = TRY(WebView::launch_compositor_process()); m_compositor_client->on_death = [this]() { @@ -738,11 +725,6 @@ ErrorOr Application::launch_compositor_process() return {}; } -bool Application::should_use_compositor_process() const -{ - return m_browser_options.enable_compositor_process == EnableCompositorProcess::Yes; -} - void Application::handle_compositor_process_death() { m_compositor_client = nullptr; @@ -769,7 +751,7 @@ void Application::handle_compositor_process_death() void Application::recover_compositor_process() { - if (!should_use_compositor_process() || Core::EventLoop::current().was_exit_requested()) + if (Core::EventLoop::current().was_exit_requested()) return; constexpr size_t max_compositor_restart_count = 3; diff --git a/Libraries/LibWebView/Application.h b/Libraries/LibWebView/Application.h index 62103651b4..c3d2afefd7 100644 --- a/Libraries/LibWebView/Application.h +++ b/Libraries/LibWebView/Application.h @@ -107,7 +107,6 @@ public: Main::Arguments const& command_line_arguments() const { return m_arguments; } virtual void open_url_in_new_window(URL::URL const& url); - bool should_use_compositor_process() const; void add_child_process(Process&&); diff --git a/Libraries/LibWebView/HelperProcess.cpp b/Libraries/LibWebView/HelperProcess.cpp index 79e7a06b33..e66c099926 100644 --- a/Libraries/LibWebView/HelperProcess.cpp +++ b/Libraries/LibWebView/HelperProcess.cpp @@ -121,8 +121,6 @@ static ErrorOr> launch_web_content_proc arguments.append("--disable-scrollbar-painting"sv); if (web_content_options.enable_async_scrolling == EnableAsyncScrolling::No) arguments.append("--disable-async-scrolling"sv); - if (!WebView::Application::the().should_use_compositor_process()) - arguments.append("--disable-compositor-process"sv); if (web_content_options.file_scheme_urls_have_tuple_origins == FileSchemeUrlsHaveTupleOrigins::Yes) arguments.append("--tuple-file-origins"sv); diff --git a/Libraries/LibWebView/Options.h b/Libraries/LibWebView/Options.h index 3ee9fe183a..c8cfb96f1d 100644 --- a/Libraries/LibWebView/Options.h +++ b/Libraries/LibWebView/Options.h @@ -74,11 +74,6 @@ enum class EnableContentBlocker { Yes, }; -enum class EnableCompositorProcess { - No, - Yes, -}; - struct BrowserOptions { Vector urls; Vector raw_urls; @@ -97,7 +92,6 @@ struct BrowserOptions { Optional dns_settings {}; Optional devtools_port; EnableContentBlocker enable_content_blocker { EnableContentBlocker::Yes }; - EnableCompositorProcess enable_compositor_process { EnableCompositorProcess::Yes }; Vector content_blocker_list_paths {}; }; diff --git a/Libraries/LibWebView/ViewImplementation.cpp b/Libraries/LibWebView/ViewImplementation.cpp index bea7c4f4bb..e94bb75449 100644 --- a/Libraries/LibWebView/ViewImplementation.cpp +++ b/Libraries/LibWebView/ViewImplementation.cpp @@ -727,8 +727,7 @@ void ViewImplementation::apply_zoom_for_current_host() void ViewImplementation::handle_resize() { client().async_set_viewport(page_id(), viewport_size(), m_device_pixel_ratio, m_is_fullscreen); - if (Application::the().should_use_compositor_process()) - Application::the().update_compositor_viewport(client().compositor_context_id_for_page(page_id()), viewport_size().to_type()); + Application::the().update_compositor_viewport(client().compositor_context_id_for_page(page_id()), viewport_size().to_type()); } void ViewImplementation::initialize_client(CreateNewClient create_new_client) @@ -748,10 +747,8 @@ void ViewImplementation::initialize_client(CreateNewClient create_new_client) client().async_set_viewport(m_client_state.page_index, viewport_size(), m_device_pixel_ratio, m_is_fullscreen); client().async_set_maximum_frames_per_second(m_client_state.page_index, m_maximum_frames_per_second); client().async_set_system_visibility_state(m_client_state.page_index, m_system_visibility_state); - if (Application::the().should_use_compositor_process()) { - auto compositor_context_id = client().compositor_context_id_for_page(m_client_state.page_index); - Application::the().update_compositor_viewport(compositor_context_id, viewport_size().to_type()); - } + auto compositor_context_id = client().compositor_context_id_for_page(m_client_state.page_index); + Application::the().update_compositor_viewport(compositor_context_id, viewport_size().to_type()); client().async_set_document_cookie_version_buffer(m_client_state.page_index, m_document_cookie_version_buffer); if (auto webdriver_endpoint = Application::browser_options().webdriver_endpoint; webdriver_endpoint.has_value()) diff --git a/Libraries/LibWebView/WebContentClient.cpp b/Libraries/LibWebView/WebContentClient.cpp index 05af26cfb0..69045ee741 100644 --- a/Libraries/LibWebView/WebContentClient.cpp +++ b/Libraries/LibWebView/WebContentClient.cpp @@ -5,8 +5,6 @@ */ #include -#include -#include #include #include #include @@ -20,70 +18,11 @@ #include #include #include -#include -#include namespace WebView { HashTable WebContentClient::s_clients; -class CompositorConnectionToServer final - : public IPC::ConnectionToServer - , public CompositorClientEndpoint { - C_OBJECT(CompositorConnectionToServer) - -public: - CompositorConnectionToServer(WebContentClient& web_content_client, NonnullOwnPtr transport) - : IPC::ConnectionToServer(*this, move(transport)) - , m_web_content_client(web_content_client.make_weak_ptr()) - { - } - -private: - virtual void die() override { } - - virtual void did_allocate_backing_stores(u64 page_id, i32 front_bitmap_id, Gfx::SharedImage front_backing_store, i32 back_bitmap_id, Gfx::SharedImage back_backing_store) override - { - if (auto web_content_client = m_web_content_client.strong_ref()) - web_content_client->did_present_backing_stores(page_id, front_bitmap_id, move(front_backing_store), back_bitmap_id, move(back_backing_store)); - } - - virtual void did_paint(u64 page_id, Gfx::IntRect content_rect, i32 bitmap_id) override - { - if (auto web_content_client = m_web_content_client.strong_ref()) - web_content_client->did_present_bitmap(page_id, content_rect, bitmap_id); - } - - WeakPtr m_web_content_client; -}; - -static HashMap>& compositor_connections() -{ - static NeverDestroyed>> connections; - return *connections; -} - -static bool try_notify_presented_bitmap_ready_to_paint(WebContentClient& web_content_client, u64 page_id, i32 bitmap_id) -{ - auto connection = compositor_connections().get(&web_content_client); - if (!connection.has_value() || !connection.value()->is_open()) - return false; - - dbgln_if(COMPOSITOR_DEBUG, "[Compositor] UI sending compositor ready_to_paint for page {} bitmap {}", - page_id, bitmap_id); - connection.value()->async_ready_to_paint(page_id, bitmap_id); - return true; -} - -static void initialize_compositor_connection(WebContentClient& web_content_client) -{ - auto paired_transport = MUST(IPC::Transport::create_paired()); - - auto connection = CompositorConnectionToServer::construct(web_content_client, move(paired_transport.local)); - compositor_connections().set(&web_content_client, connection); - web_content_client.async_connect_to_compositor(move(paired_transport.remote_handle)); -} - static Optional history_title(Utf16String const& title, URL::URL const& url) { if (title.is_empty()) @@ -101,21 +40,16 @@ WebContentClient::WebContentClient(NonnullOwnPtr transport, View { s_clients.set(this); m_views.set(0, view); - if (!Application::the().should_use_compositor_process()) - initialize_compositor_connection(*this); } WebContentClient::WebContentClient(NonnullOwnPtr transport) : IPC::ConnectionToServer(*this, move(transport)) { s_clients.set(this); - if (!Application::the().should_use_compositor_process()) - initialize_compositor_connection(*this); } WebContentClient::~WebContentClient() { - compositor_connections().remove(this); s_clients.remove(this); } @@ -236,7 +170,7 @@ void WebContentClient::destroy_all_compositor_contexts() ErrorOr WebContentClient::reconnect_to_compositor_process(Badge) { - if (!Application::the().should_use_compositor_process() || !is_open()) + if (!is_open()) return {}; m_compositor_connection_id.clear(); @@ -246,7 +180,7 @@ ErrorOr WebContentClient::reconnect_to_compositor_process(Badge WebContentClient::recreate_compositor_contexts(Badge) { - if (!Application::the().should_use_compositor_process() || !is_open()) + if (!is_open()) return {}; for (auto const& [context_id, registration] : m_compositor_contexts) @@ -257,7 +191,7 @@ ErrorOr WebContentClient::recreate_compositor_contexts(Badge) void WebContentClient::update_compositor_viewports_after_reconnect(Badge) { - if (!Application::the().should_use_compositor_process() || !is_open()) + if (!is_open()) return; for (auto const& [page_id, view] : m_views) { @@ -270,7 +204,7 @@ void WebContentClient::update_compositor_viewports_after_reconnect(Badge) { - if (!Application::the().should_use_compositor_process() || !is_open()) + if (!is_open()) return; async_compositor_process_reconnected(); @@ -304,15 +238,7 @@ bool WebContentClient::send_async_scroll_to_compositor(u64 page_id, Gfx::FloatPo { auto timer = Core::ElapsedTimer::start_new(Core::TimerType::Precise); - bool handled = false; - if (Application::the().should_use_compositor_process()) { - handled = Application::the().send_async_scroll_to_compositor(compositor_context_id_for_page(page_id), position, delta_in_device_pixels); - } else { - auto connection = compositor_connections().get(this); - VERIFY(connection.has_value()); - VERIFY(connection.value()->is_open()); - handled = connection.value()->async_scroll_by(page_id, position, delta_in_device_pixels); - } + auto handled = Application::the().send_async_scroll_to_compositor(compositor_context_id_for_page(page_id), position, delta_in_device_pixels); dbgln_if(COMPOSITOR_DEBUG, "[Compositor] UI compositor IPC async_scroll_by page {} returned {} in {} us", page_id, handled, timer.elapsed_time().to_microseconds()); @@ -323,15 +249,7 @@ bool WebContentClient::handle_mouse_event_in_compositor(u64 page_id, Web::MouseE { auto timer = Core::ElapsedTimer::start_new(Core::TimerType::Precise); - bool handled = false; - if (Application::the().should_use_compositor_process()) { - handled = Application::the().handle_mouse_event_in_compositor(compositor_context_id_for_page(page_id), event); - } else { - auto connection = compositor_connections().get(this); - VERIFY(connection.has_value()); - VERIFY(connection.value()->is_open()); - handled = connection.value()->mouse_event(page_id, event.clone_without_browser_data()); - } + auto handled = Application::the().handle_mouse_event_in_compositor(compositor_context_id_for_page(page_id), event); dbgln_if(COMPOSITOR_DEBUG, "[Compositor] UI compositor IPC mouse_event page {} returned {} in {} us", page_id, handled, timer.elapsed_time().to_microseconds()); @@ -340,15 +258,13 @@ bool WebContentClient::handle_mouse_event_in_compositor(u64 page_id, Web::MouseE void WebContentClient::dispatch_mouse_event_to_web_content(u64 page_id, Web::MouseEvent const& event) { - if (Application::the().should_use_compositor_process()) { - auto context_id = m_page_compositor_context_ids.get(page_id); - if (context_id.has_value() && Application::the().dispatch_mouse_event_to_web_content(*context_id, event)) + auto context_id = m_page_compositor_context_ids.get(page_id); + if (context_id.has_value() && Application::the().dispatch_mouse_event_to_web_content(*context_id, event)) + return; + if (!context_id.has_value()) { + auto new_context_id = compositor_context_id_for_page(page_id); + if (Application::the().dispatch_mouse_event_to_web_content(new_context_id, event)) return; - if (!context_id.has_value()) { - auto new_context_id = compositor_context_id_for_page(page_id); - if (Application::the().dispatch_mouse_event_to_web_content(new_context_id, event)) - return; - } } async_mouse_event(page_id, event.clone_without_browser_data()); @@ -356,16 +272,11 @@ void WebContentClient::dispatch_mouse_event_to_web_content(u64 page_id, Web::Mou void WebContentClient::notify_presented_bitmap_ready_to_paint(u64 page_id, i32 bitmap_id) { - if (Application::the().should_use_compositor_process()) { - auto context_id = m_page_compositor_context_ids.get(page_id); - if (!context_id.has_value()) - return; - - Application::the().notify_compositor_presented_bitmap_ready_to_paint(*context_id, bitmap_id); + auto context_id = m_page_compositor_context_ids.get(page_id); + if (!context_id.has_value()) return; - } - VERIFY(try_notify_presented_bitmap_ready_to_paint(*this, page_id, bitmap_id)); + Application::the().notify_compositor_presented_bitmap_ready_to_paint(*context_id, bitmap_id); } void WebContentClient::did_present_bitmap(u64 page_id, Gfx::IntRect rect, i32 bitmap_id) @@ -377,10 +288,7 @@ void WebContentClient::did_present_bitmap(u64 page_id, Gfx::IntRect rect, i32 bi } else { dbgln_if(COMPOSITOR_DEBUG, "[Compositor] UI dropping did_paint for page {} bitmap {}: no view", page_id, bitmap_id); - if (Application::the().should_use_compositor_process()) - notify_presented_bitmap_ready_to_paint(page_id, bitmap_id); - else - try_notify_presented_bitmap_ready_to_paint(*this, page_id, bitmap_id); + notify_presented_bitmap_ready_to_paint(page_id, bitmap_id); } } diff --git a/Services/WebContent/ConnectionFromClient.cpp b/Services/WebContent/ConnectionFromClient.cpp index c0338cce70..b1532ae0b8 100644 --- a/Services/WebContent/ConnectionFromClient.cpp +++ b/Services/WebContent/ConnectionFromClient.cpp @@ -164,11 +164,6 @@ void ConnectionFromClient::connect_to_image_decoder(IPC::TransportHandle handle) on_image_decoder_connection(handle); } -void ConnectionFromClient::connect_to_compositor(IPC::TransportHandle handle) -{ - m_page_host->attach_compositor_ui_client(move(handle)); -} - void ConnectionFromClient::connect_to_compositor_process(IPC::TransportHandle handle) { auto transport = MUST(handle.create_transport()); diff --git a/Services/WebContent/ConnectionFromClient.h b/Services/WebContent/ConnectionFromClient.h index 1afbf373b3..491e132329 100644 --- a/Services/WebContent/ConnectionFromClient.h +++ b/Services/WebContent/ConnectionFromClient.h @@ -71,7 +71,6 @@ private: virtual void connect_to_web_ui(u64 page_id, IPC::TransportHandle handle) override; virtual void connect_to_request_server(IPC::TransportHandle handle) override; virtual void connect_to_image_decoder(IPC::TransportHandle handle) override; - virtual void connect_to_compositor(IPC::TransportHandle handle) override; virtual void connect_to_compositor_process(IPC::TransportHandle handle) override; virtual void compositor_process_reconnected() override; virtual void update_system_theme(u64 page_id, Core::AnonymousBuffer) override; diff --git a/Services/WebContent/PageHost.cpp b/Services/WebContent/PageHost.cpp index be94df62d3..cc12dcfa4a 100644 --- a/Services/WebContent/PageHost.cpp +++ b/Services/WebContent/PageHost.cpp @@ -6,7 +6,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include #include #include @@ -54,12 +53,6 @@ void PageHost::ensure_compositor_host(Web::DisplayListPlayerType display_list_pl m_compositor_host->start(display_list_player_type); } -void PageHost::attach_compositor_ui_client(IPC::TransportHandle handle) -{ - if (m_compositor_host) - m_compositor_host->attach_ui_client(move(handle)); -} - void PageHost::compositor_process_reconnected() { for (auto& [_, page] : m_pages) diff --git a/Services/WebContent/PageHost.h b/Services/WebContent/PageHost.h index f4396cbe57..9566e5acf4 100644 --- a/Services/WebContent/PageHost.h +++ b/Services/WebContent/PageHost.h @@ -13,7 +13,6 @@ #include #include #include -#include #include namespace Web { @@ -44,7 +43,6 @@ public: ConnectionFromClient& client() const { return m_client; } void ensure_compositor_host(Web::DisplayListPlayerType); - void attach_compositor_ui_client(IPC::TransportHandle); void compositor_process_reconnected(); Web::Compositor::CompositorHost* compositor_host() { return m_compositor_host.ptr(); } Web::Compositor::CompositorHost const* compositor_host() const { return m_compositor_host.ptr(); } diff --git a/Services/WebContent/WebContentCompositorHost.cpp b/Services/WebContent/WebContentCompositorHost.cpp index 5c82782319..2b23d2dfe9 100644 --- a/Services/WebContent/WebContentCompositorHost.cpp +++ b/Services/WebContent/WebContentCompositorHost.cpp @@ -30,17 +30,6 @@ namespace WebContent { -static bool& should_use_compositor_process() -{ - static bool flag = false; - return flag; -} - -void set_should_use_compositor_process(bool enabled) -{ - should_use_compositor_process() = enabled; -} - class WebContentCompositorActor; class WebContentCompositorConnectionToServer final @@ -681,9 +670,7 @@ private: NonnullOwnPtr create_web_content_compositor_host(ConnectionFromClient& client) { - if (should_use_compositor_process()) - return make(client); - return make(); + return make(client); } } diff --git a/Services/WebContent/WebContentCompositorHost.h b/Services/WebContent/WebContentCompositorHost.h index 479eaef14e..694f06a05e 100644 --- a/Services/WebContent/WebContentCompositorHost.h +++ b/Services/WebContent/WebContentCompositorHost.h @@ -15,6 +15,5 @@ namespace WebContent { NonnullOwnPtr create_web_content_compositor_host(ConnectionFromClient&); -void set_should_use_compositor_process(bool); } diff --git a/Services/WebContent/WebContentServer.ipc b/Services/WebContent/WebContentServer.ipc index 1458500100..0f6c081e09 100644 --- a/Services/WebContent/WebContentServer.ipc +++ b/Services/WebContent/WebContentServer.ipc @@ -34,7 +34,6 @@ endpoint WebContentServer connect_to_web_ui(u64 page_id, IPC::TransportHandle handle) =| connect_to_request_server(IPC::TransportHandle handle) =| connect_to_image_decoder(IPC::TransportHandle handle) =| - connect_to_compositor(IPC::TransportHandle handle) =| connect_to_compositor_process(IPC::TransportHandle handle) =| compositor_process_reconnected() =| diff --git a/Services/WebContent/main.cpp b/Services/WebContent/main.cpp index d04c6f1ae1..37fde978fd 100644 --- a/Services/WebContent/main.cpp +++ b/Services/WebContent/main.cpp @@ -150,7 +150,6 @@ ErrorOr ladybird_main(Main::Arguments arguments) bool is_headless = false; bool disable_scrollbar_painting = false; bool disable_async_scrolling = false; - bool disable_compositor_process = false; StringView echo_server_port_string_view {}; StringView default_time_zone {}; StringView style_invalidation_counter_dump_interval {}; @@ -173,7 +172,6 @@ ErrorOr ladybird_main(Main::Arguments arguments) args_parser.add_option(collect_garbage_on_every_allocation, "Collect garbage after every JS heap allocation", "collect-garbage-on-every-allocation"); args_parser.add_option(disable_scrollbar_painting, "Don't paint horizontal or vertical viewport scrollbars", "disable-scrollbar-painting"); args_parser.add_option(disable_async_scrolling, "Disable async scrolling", "disable-async-scrolling"); - args_parser.add_option(disable_compositor_process, "Disable use of the Compositor helper process", "disable-compositor-process"); args_parser.add_option(echo_server_port_string_view, "Echo server port used in test internals", "echo-server-port", 0, "echo_server_port"); args_parser.add_option(is_headless, "Report that the browser is running in headless mode", "headless"); args_parser.add_option(default_time_zone, "Default time zone", "default-time-zone", 0, "time-zone-id"); @@ -225,7 +223,6 @@ ErrorOr ladybird_main(Main::Arguments arguments) Web::Painting::set_paint_viewport_scrollbars(!disable_scrollbar_painting); WebContent::PageClient::set_async_scrolling_enabled(!disable_async_scrolling); - WebContent::set_should_use_compositor_process(!disable_compositor_process); if (!echo_server_port_string_view.is_empty()) { if (auto maybe_echo_server_port = echo_server_port_string_view.to_number(); maybe_echo_server_port.has_value())