Represent WebIDL C++ types with a single CppType model that tracks nullability, optional presence, and contained storage. GC-like values now use GC::Ref/GC::Ptr directly, while containers choose "plain", "Root", or "Conservative" container types depending on what they contain. For example, sequence<Element> becomes a RootVector of GC::Ref values, while sequence<SomeDictionary> becomes a ConservativeVector only when the dictionary contains GC-like values. This moves the generated bindings away from wrapping GC values in GC::Root by default. This has broad fallout as the types passed to interfaces for GC objects changes almost fully across the board.
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Bindings/DedicatedWorkerGlobalScope.h>
|
|
#include <LibWeb/Bindings/WorkerGlobalScope.h>
|
|
#include <LibWeb/Export.h>
|
|
#include <LibWeb/HTML/WorkerGlobalScope.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
class WEB_API DedicatedWorkerGlobalScope
|
|
: public WorkerGlobalScope
|
|
, public Bindings::DedicatedWorkerGlobalScopeGlobalMixin {
|
|
WEB_PLATFORM_OBJECT(DedicatedWorkerGlobalScope, WorkerGlobalScope);
|
|
GC_DECLARE_ALLOCATOR(DedicatedWorkerGlobalScope);
|
|
|
|
public:
|
|
static constexpr bool OVERRIDES_FINALIZE = true;
|
|
|
|
virtual ~DedicatedWorkerGlobalScope() override;
|
|
|
|
WebIDL::ExceptionOr<void> post_message(JS::Value message, Bindings::StructuredSerializeOptions const&);
|
|
WebIDL::ExceptionOr<void> post_message(JS::Value message, GC::RootVector<GC::Ref<JS::Object>> const& transfer);
|
|
|
|
void close();
|
|
|
|
WebIDL::CallbackType* onmessage();
|
|
void set_onmessage(WebIDL::CallbackType* callback);
|
|
|
|
WebIDL::CallbackType* onmessageerror();
|
|
void set_onmessageerror(WebIDL::CallbackType* callback);
|
|
|
|
virtual void finalize() override;
|
|
|
|
private:
|
|
DedicatedWorkerGlobalScope(JS::Realm&, GC::Ref<Web::Page>);
|
|
|
|
virtual void initialize_web_interfaces_impl() override;
|
|
};
|
|
|
|
}
|