mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:37:35 +00:00
LibWeb+WebWorker: Move worker execution into a new WebWorker process
We now create a WorkerAgent for the parent context, which is currently only a Window. Note that Workers can have Workers per the spec. The WorkerAgent spawns a WebWorker process to hold the actual script execution of the Worker. This is modeled with the DedicatedWorkerHost object in the WebWorker process. A start_dedicated_worker IPC method in the WebWorker IPC creates the WorkerHost object. Future different worker types may use different IPC messages to create their WorkerHost instance. This implementation cannot yet postMessage between the parent and the child processes. Co-Authored-By: Andreas Kling <kling@serenityos.org>
This commit is contained in:
parent
3dbbb5b263
commit
124c378472
31 changed files with 998 additions and 267 deletions
|
@ -41,6 +41,16 @@ public:
|
|||
virtual Bindings::PlatformObject& this_impl() override { return *this; }
|
||||
virtual Bindings::PlatformObject const& this_impl() const override { return *this; }
|
||||
|
||||
using WindowOrWorkerGlobalScopeMixin::atob;
|
||||
using WindowOrWorkerGlobalScopeMixin::btoa;
|
||||
using WindowOrWorkerGlobalScopeMixin::clear_interval;
|
||||
using WindowOrWorkerGlobalScopeMixin::clear_timeout;
|
||||
using WindowOrWorkerGlobalScopeMixin::fetch;
|
||||
using WindowOrWorkerGlobalScopeMixin::queue_microtask;
|
||||
using WindowOrWorkerGlobalScopeMixin::set_interval;
|
||||
using WindowOrWorkerGlobalScopeMixin::set_timeout;
|
||||
using WindowOrWorkerGlobalScopeMixin::structured_clone;
|
||||
|
||||
// Following methods are from the WorkerGlobalScope IDL definition
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface
|
||||
|
||||
|
@ -67,16 +77,17 @@ public:
|
|||
// this is not problematic as it cannot be observed from script.
|
||||
void set_location(JS::NonnullGCPtr<WorkerLocation> loc) { m_location = move(loc); }
|
||||
|
||||
void initialize_web_interfaces(Badge<WorkerEnvironmentSettingsObject>);
|
||||
|
||||
Web::Page* page() { return &m_page; }
|
||||
|
||||
protected:
|
||||
explicit WorkerGlobalScope(JS::Realm&);
|
||||
explicit WorkerGlobalScope(JS::Realm&, Web::Page&);
|
||||
|
||||
private:
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
JS::GCPtr<WorkerLocation> m_location;
|
||||
|
||||
JS::GCPtr<WorkerNavigator> m_navigator;
|
||||
|
||||
// FIXME: Add all these internal slots
|
||||
|
@ -110,6 +121,8 @@ private:
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#concept-workerglobalscope-cross-origin-isolated-capability
|
||||
bool m_cross_origin_isolated_capability { false };
|
||||
|
||||
Web::Page& m_page;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue