ladybird/Libraries/LibWeb/HTML/DedicatedWorkerGlobalScope.h
Andreas Kling 2ac363dcba LibGC: Only call finalize() on types that override finalize()
This dramatically cuts down on time spent in the GC's finalizer pass,
since most types don't override finalize().
2026-01-07 20:51:17 +01:00

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/DedicatedWorkerGlobalScopeGlobalMixin.h>
#include <LibWeb/Bindings/WorkerGlobalScopePrototype.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, StructuredSerializeOptions const&);
WebIDL::ExceptionOr<void> post_message(JS::Value message, Vector<GC::Root<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;
};
}