ladybird/Libraries/LibWeb/HTML/ShadowRealmGlobalScope.cpp
Shannon Booth 9b79a686eb LibJS+LibWeb: Use realm.create<T> instead of heap.allocate<T>
The main motivation behind this is to remove JS specifics of the Realm
from the implementation of the Heap.

As a side effect of this change, this is a bit nicer to read than the
previous approach, and in my opinion, also makes it a little more clear
that this method is specific to a JavaScript Realm.
2024-11-13 16:51:44 -05:00

46 lines
1.1 KiB
C++

/*
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/ShadowRealmExposedInterfaces.h>
#include <LibWeb/Bindings/ShadowRealmGlobalScopePrototype.h>
#include <LibWeb/HTML/ShadowRealmGlobalScope.h>
namespace Web::HTML {
JS_DEFINE_ALLOCATOR(ShadowRealmGlobalScope);
ShadowRealmGlobalScope::ShadowRealmGlobalScope(JS::Realm& realm)
: DOM::EventTarget(realm)
{
}
ShadowRealmGlobalScope::~ShadowRealmGlobalScope() = default;
JS::NonnullGCPtr<ShadowRealmGlobalScope> ShadowRealmGlobalScope::create(JS::Realm& realm)
{
return realm.create<ShadowRealmGlobalScope>(realm);
}
void ShadowRealmGlobalScope::initialize(JS::Realm&)
{
}
void ShadowRealmGlobalScope::initialize_web_interfaces()
{
auto& realm = this->realm();
WEB_SET_PROTOTYPE_FOR_INTERFACE(ShadowRealmGlobalScope);
add_shadow_realm_exposed_interfaces(*this);
Bindings::ShadowRealmGlobalScopeGlobalMixin::initialize(realm, *this);
}
void ShadowRealmGlobalScope::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
}
}