mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb/HTML: Rename WorkerAgent to WorkerAgentParent
This is to differentiate the agent representation for the parent process for the WorkerAgent in the child process which is actually hooked up to the javascript VM. I am not sure if this is a good name, but I can't really think of anything better which is consistent with the names used by the rest of the codebase.
This commit is contained in:
parent
2fc1cafb8a
commit
939bb10828
Notes:
github-actions[bot]
2025-04-25 14:46:02 +00:00
Author: https://github.com/shannonbooth
Commit: 939bb10828
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4453
6 changed files with 17 additions and 16 deletions
|
@ -545,7 +545,7 @@ set(SOURCES
|
|||
HTML/WindowOrWorkerGlobalScope.cpp
|
||||
HTML/WindowProxy.cpp
|
||||
HTML/Worker.cpp
|
||||
HTML/WorkerAgent.cpp
|
||||
HTML/WorkerAgentParent.cpp
|
||||
HTML/WorkerDebugConsoleClient.cpp
|
||||
HTML/WorkerGlobalScope.cpp
|
||||
HTML/WorkerLocation.cpp
|
||||
|
|
|
@ -579,7 +579,7 @@ class Window;
|
|||
class WindowEnvironmentSettingsObject;
|
||||
class WindowProxy;
|
||||
class Worker;
|
||||
class WorkerAgent;
|
||||
class WorkerAgentParent;
|
||||
class WorkerDebugConsoleClient;
|
||||
class WorkerEnvironmentSettingsObject;
|
||||
class WorkerGlobalScope;
|
||||
|
|
|
@ -110,7 +110,7 @@ void Worker::run_a_worker(URL::URL& url, EnvironmentSettingsObject& outside_sett
|
|||
// and is shared. Run the rest of these steps in that agent.
|
||||
|
||||
// Note: This spawns a new process to act as the 'agent' for the worker.
|
||||
m_agent = outside_settings.realm().create<WorkerAgent>(url, options, port, outside_settings);
|
||||
m_agent = outside_settings.realm().create<WorkerAgentParent>(url, options, port, outside_settings);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#dom-worker-terminate
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/AbstractWorker.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HTML/WorkerAgent.h>
|
||||
#include <LibWeb/HTML/WorkerAgentParent.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
#define ENUMERATE_WORKER_EVENT_HANDLERS(E) \
|
||||
|
@ -65,7 +65,7 @@ private:
|
|||
GC::Ptr<DOM::Document> m_document;
|
||||
GC::Ptr<MessagePort> m_outside_port;
|
||||
|
||||
GC::Ptr<WorkerAgent> m_agent;
|
||||
GC::Ptr<WorkerAgentParent> m_agent;
|
||||
|
||||
void run_a_worker(URL::URL& url, EnvironmentSettingsObject& outside_settings, GC::Ptr<MessagePort> outside_port, WorkerOptions const& options);
|
||||
};
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
|
||||
#include <LibWeb/Bindings/PrincipalHostDefined.h>
|
||||
#include <LibWeb/HTML/MessagePort.h>
|
||||
#include <LibWeb/HTML/WorkerAgent.h>
|
||||
#include <LibWeb/HTML/WorkerAgentParent.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Worker/WebWorkerClient.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(WorkerAgent);
|
||||
GC_DEFINE_ALLOCATOR(WorkerAgentParent);
|
||||
|
||||
WorkerAgent::WorkerAgent(URL::URL url, WorkerOptions const& options, GC::Ptr<MessagePort> outside_port, GC::Ref<EnvironmentSettingsObject> outside_settings)
|
||||
WorkerAgentParent::WorkerAgentParent(URL::URL url, WorkerOptions const& options, GC::Ptr<MessagePort> outside_port, GC::Ref<EnvironmentSettingsObject> outside_settings)
|
||||
: m_worker_options(options)
|
||||
, m_url(move(url))
|
||||
, m_outside_port(outside_port)
|
||||
|
@ -22,7 +22,7 @@ WorkerAgent::WorkerAgent(URL::URL url, WorkerOptions const& options, GC::Ptr<Mes
|
|||
{
|
||||
}
|
||||
|
||||
void WorkerAgent::initialize(JS::Realm& realm)
|
||||
void WorkerAgentParent::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
|
||||
|
@ -47,7 +47,7 @@ void WorkerAgent::initialize(JS::Realm& realm)
|
|||
m_worker_ipc->async_start_dedicated_worker(m_url, m_worker_options.type, m_worker_options.credentials, m_worker_options.name, move(data_holder), m_outside_settings->serialize());
|
||||
}
|
||||
|
||||
void WorkerAgent::visit_edges(Cell::Visitor& visitor)
|
||||
void WorkerAgentParent::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_message_port);
|
|
@ -19,16 +19,17 @@ struct WorkerOptions {
|
|||
String name { String {} };
|
||||
};
|
||||
|
||||
class WorkerAgent : public JS::Cell {
|
||||
GC_CELL(WorkerAgent, JS::Cell);
|
||||
GC_DECLARE_ALLOCATOR(WorkerAgent);
|
||||
// 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);
|
||||
|
||||
WorkerAgent(URL::URL url, WorkerOptions const& options, GC::Ptr<MessagePort> outside_port, GC::Ref<EnvironmentSettingsObject> outside_settings);
|
||||
|
||||
private:
|
||||
protected:
|
||||
WorkerAgentParent(URL::URL url, WorkerOptions const& options, GC::Ptr<MessagePort> outside_port, GC::Ref<EnvironmentSettingsObject> outside_settings);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
WorkerOptions m_worker_options;
|
||||
URL::URL m_url;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue