Files
ladybird/Libraries/LibWeb/HTML/WorkerAgentParent.h
Shannon Booth 5adfd1c43a LibWeb/Bindings: Generate struct definitions from IDL dictionaries
Previously we were inconsistent by generating code for enum definitions
but not generating code for dictionaries. With future changes to the
IDL generator to expose helpers to convert to and from IDL values
this produced circular depdendencies. To solve this problem, also
generate the dictionary definitions in bindings headers.
2026-05-09 10:49:49 +02:00

44 lines
1.4 KiB
C++

/*
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibURL/URL.h>
#include <LibWeb/Bindings/AgentType.h>
#include <LibWeb/Bindings/Request.h>
#include <LibWeb/Bindings/Worker.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
// FIXME: Figure out a better naming convention for this type of parent/child process pattern.
class WorkerAgentParent : public JS::Cell {
GC_CELL(WorkerAgentParent, JS::Cell);
GC_DECLARE_ALLOCATOR(WorkerAgentParent);
protected:
WorkerAgentParent(URL::URL url, Bindings::WorkerOptions const& options, GC::Ptr<MessagePort> outside_port, GC::Ref<EnvironmentSettingsObject> outside_settings, GC::Ref<DOM::EventTarget> worker_event_target, Bindings::AgentType);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
private:
void setup_worker_ipc_callbacks(JS::Realm&);
void release_startup_keep_alive();
Bindings::WorkerOptions m_worker_options;
Bindings::AgentType m_agent_type { Bindings::AgentType::DedicatedWorker };
URL::URL m_url;
GC::Ptr<MessagePort> m_message_port;
GC::Ptr<MessagePort> m_outside_port;
GC::Ref<EnvironmentSettingsObject> m_outside_settings;
GC::Ref<DOM::EventTarget> m_worker_event_target;
RefPtr<Web::HTML::WebWorkerClient> m_worker_ipc;
};
}