
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>
48 lines
1.7 KiB
C++
48 lines
1.7 KiB
C++
/*
|
|
* Copyright (c) 2022, Ben Abraham <ben.d.abraham@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/URL.h>
|
|
#include <LibWeb/DOM/Document.h>
|
|
#include <LibWeb/Forward.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
class WorkerEnvironmentSettingsObject final
|
|
: public EnvironmentSettingsObject {
|
|
JS_CELL(WindowEnvironmentSettingsObject, EnvironmentSettingsObject);
|
|
|
|
public:
|
|
WorkerEnvironmentSettingsObject(NonnullOwnPtr<JS::ExecutionContext> execution_context, JS::NonnullGCPtr<WorkerGlobalScope> global_scope)
|
|
: EnvironmentSettingsObject(move(execution_context))
|
|
, m_global_scope(global_scope)
|
|
{
|
|
}
|
|
|
|
static JS::NonnullGCPtr<WorkerEnvironmentSettingsObject> setup(NonnullOwnPtr<JS::ExecutionContext> execution_context /* FIXME: null or an environment reservedEnvironment, a URL topLevelCreationURL, and an origin topLevelOrigin */);
|
|
|
|
virtual ~WorkerEnvironmentSettingsObject() override = default;
|
|
|
|
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
|
|
DeprecatedString api_url_character_encoding() override { return m_api_url_character_encoding; }
|
|
AK::URL api_base_url() override { return m_url; }
|
|
Origin origin() override { return m_origin; }
|
|
PolicyContainer policy_container() override { return m_policy_container; }
|
|
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override { return CanUseCrossOriginIsolatedAPIs::No; }
|
|
|
|
private:
|
|
virtual void visit_edges(JS::Cell::Visitor&) override;
|
|
|
|
DeprecatedString m_api_url_character_encoding;
|
|
AK::URL m_url;
|
|
HTML::Origin m_origin;
|
|
HTML::PolicyContainer m_policy_container;
|
|
|
|
JS::NonnullGCPtr<WorkerGlobalScope> m_global_scope;
|
|
};
|
|
|
|
}
|