LibWeb+LibWebView+Services: Add IPC for starting WebWorker of a type

The provides some of the plumbing for a WebContent process to spin
up a WebWorker that is not just a dedicated worker.
This commit is contained in:
Shannon Booth 2025-04-24 17:07:09 +12:00 committed by Andreas Kling
parent 041ff0c7ff
commit a2cca59516
Notes: github-actions[bot] 2025-04-25 14:45:22 +00:00
10 changed files with 49 additions and 13 deletions

View file

@ -664,9 +664,9 @@ void PageClient::page_did_allocate_backing_stores(i32 front_bitmap_id, Gfx::Shar
client().async_did_allocate_backing_stores(m_id, front_bitmap_id, front_bitmap, back_bitmap_id, back_bitmap);
}
IPC::File PageClient::request_worker_agent()
IPC::File PageClient::request_worker_agent(Web::Bindings::AgentType type)
{
auto response = client().send_sync_but_allow_failure<Messages::WebContentClient::RequestWorkerAgent>(m_id);
auto response = client().send_sync_but_allow_failure<Messages::WebContentClient::RequestWorkerAgent>(m_id, type);
if (!response) {
dbgln("WebContent client disconnected during RequestWorkerAgent. Exiting peacefully.");
exit(0);

View file

@ -172,7 +172,7 @@ private:
virtual void page_did_insert_clipboard_entry(StringView data, StringView presentation_style, StringView mime_type) override;
virtual void page_did_change_audio_play_state(Web::HTML::AudioPlayState) override;
virtual void page_did_allocate_backing_stores(i32 front_bitmap_id, Gfx::ShareableBitmap front_bitmap, i32 back_bitmap_id, Gfx::ShareableBitmap back_bitmap) override;
virtual IPC::File request_worker_agent() override;
virtual IPC::File request_worker_agent(Web::Bindings::AgentType) override;
virtual void page_did_mutate_dom(FlyString const& type, Web::DOM::Node const& target, Web::DOM::NodeList& added_nodes, Web::DOM::NodeList& removed_nodes, GC::Ptr<Web::DOM::Node> previous_sibling, GC::Ptr<Web::DOM::Node> next_sibling, Optional<String> const& attribute_name) override;
virtual void received_message_from_web_ui(String const& name, JS::Value data) override;

View file

@ -21,6 +21,7 @@
#include <LibWebView/Mutation.h>
#include <LibWebView/PageInfo.h>
#include <LibWebView/ProcessHandle.h>
#include <LibWeb/Bindings/MainThreadVM.h>
endpoint WebContentClient
{
@ -107,5 +108,5 @@ endpoint WebContentClient
did_find_in_page(u64 page_id, size_t current_match_index, Optional<size_t> total_match_count) =|
request_worker_agent(u64 page_id) => (IPC::File socket) // FIXME: Add required attributes to select a SharedWorker Agent
request_worker_agent(u64 page_id, Web::Bindings::AgentType worker_type) => (IPC::File socket) // FIXME: Add required attributes to select a SharedWorker Agent
}