1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

LibWeb: Put most LibWeb GC objects in type-specific heap blocks

With this change, we now have ~1200 CellAllocators across both LibJS and
LibWeb in a normal WebContent instance.

This gives us a minimum heap size of 4.7 MiB in the scenario where we
only have one cell allocated per type. Of course, in practice there will
be many more of each type, so the effective overhead is quite a bit
smaller than that in practice.

I left a few types unconverted to this mechanism because I got tired of
doing this. :^)
This commit is contained in:
Andreas Kling 2023-11-19 19:47:52 +01:00
parent 536596632b
commit bfd354492e
599 changed files with 933 additions and 3 deletions

View file

@ -2502,6 +2502,7 @@ static void generate_named_properties_object_declarations(IDL::Interface const&
generator.append(R"~~~( generator.append(R"~~~(
class @named_properties_class@ : public JS::Object { class @named_properties_class@ : public JS::Object {
JS_OBJECT(@named_properties_class@, JS::Object); JS_OBJECT(@named_properties_class@, JS::Object);
JS_DECLARE_ALLOCATOR(@named_properties_class@);
public: public:
explicit @named_properties_class@(JS::Realm&); explicit @named_properties_class@(JS::Realm&);
virtual void initialize(JS::Realm&) override; virtual void initialize(JS::Realm&) override;
@ -3298,7 +3299,7 @@ namespace Web::Bindings {
class @namespace_class@ final : public JS::Object { class @namespace_class@ final : public JS::Object {
JS_OBJECT(@namespace_class@, JS::Object); JS_OBJECT(@namespace_class@, JS::Object);
JS_DECLARE_ALLOCATOR(@namespace_class@);
public: public:
explicit @namespace_class@(JS::Realm&); explicit @namespace_class@(JS::Realm&);
virtual void initialize(JS::Realm&) override; virtual void initialize(JS::Realm&) override;
@ -3395,6 +3396,8 @@ using namespace Web::WebIDL;
namespace Web::Bindings { namespace Web::Bindings {
JS_DEFINE_ALLOCATOR(@namespace_class@);
@namespace_class@::@namespace_class@(JS::Realm& realm) @namespace_class@::@namespace_class@(JS::Realm& realm)
: Object(ConstructWithoutPrototypeTag::Tag, realm) : Object(ConstructWithoutPrototypeTag::Tag, realm)
{ {
@ -3467,6 +3470,7 @@ namespace Web::Bindings {
class @constructor_class@ : public JS::NativeFunction { class @constructor_class@ : public JS::NativeFunction {
JS_OBJECT(@constructor_class@, JS::NativeFunction); JS_OBJECT(@constructor_class@, JS::NativeFunction);
JS_DECLARE_ALLOCATOR(@constructor_class@);
public: public:
explicit @constructor_class@(JS::Realm&); explicit @constructor_class@(JS::Realm&);
virtual void initialize(JS::Realm&) override; virtual void initialize(JS::Realm&) override;
@ -3619,6 +3623,8 @@ using namespace Web::WebIDL;
namespace Web::Bindings { namespace Web::Bindings {
JS_DEFINE_ALLOCATOR(@constructor_class@);
@constructor_class@::@constructor_class@(JS::Realm& realm) @constructor_class@::@constructor_class@(JS::Realm& realm)
: NativeFunction("@name@"sv, realm.intrinsics().function_prototype()) : NativeFunction("@name@"sv, realm.intrinsics().function_prototype())
{ {
@ -3958,6 +3964,7 @@ namespace Web::Bindings {
class @prototype_class@ : public JS::Object { class @prototype_class@ : public JS::Object {
JS_OBJECT(@prototype_class@, JS::Object); JS_OBJECT(@prototype_class@, JS::Object);
JS_DECLARE_ALLOCATOR(@prototype_class@);
public: public:
explicit @prototype_class@(JS::Realm&); explicit @prototype_class@(JS::Realm&);
virtual void initialize(JS::Realm&) override; virtual void initialize(JS::Realm&) override;
@ -4096,6 +4103,8 @@ using namespace Web::WebIDL;
namespace Web::Bindings { namespace Web::Bindings {
JS_DEFINE_ALLOCATOR(@prototype_class@);
@prototype_class@::@prototype_class@([[maybe_unused]] JS::Realm& realm))~~~"); @prototype_class@::@prototype_class@([[maybe_unused]] JS::Realm& realm))~~~");
if (interface.name == "DOMException") { if (interface.name == "DOMException") {
// https://webidl.spec.whatwg.org/#es-DOMException-specialness // https://webidl.spec.whatwg.org/#es-DOMException-specialness
@ -4168,6 +4177,7 @@ namespace Web::Bindings {
class @prototype_class@ : public JS::Object { class @prototype_class@ : public JS::Object {
JS_OBJECT(@prototype_class@, JS::Object); JS_OBJECT(@prototype_class@, JS::Object);
JS_DECLARE_ALLOCATOR(@prototype_class@);
public: public:
explicit @prototype_class@(JS::Realm&); explicit @prototype_class@(JS::Realm&);
virtual void initialize(JS::Realm&) override; virtual void initialize(JS::Realm&) override;
@ -4241,6 +4251,8 @@ using namespace Web::WebIDL;
namespace Web::Bindings { namespace Web::Bindings {
JS_DEFINE_ALLOCATOR(@prototype_class@);
@prototype_class@::@prototype_class@(JS::Realm& realm) @prototype_class@::@prototype_class@(JS::Realm& realm)
: Object(ConstructWithPrototypeTag::Tag, realm.intrinsics().iterator_prototype()) : Object(ConstructWithPrototypeTag::Tag, realm.intrinsics().iterator_prototype())
{ {

View file

@ -17,6 +17,8 @@
namespace Web::Animations { namespace Web::Animations {
JS_DEFINE_ALLOCATOR(Animation);
// https://www.w3.org/TR/web-animations-1/#dom-animation-animation // https://www.w3.org/TR/web-animations-1/#dom-animation-animation
JS::NonnullGCPtr<Animation> Animation::create(JS::Realm& realm, JS::GCPtr<AnimationEffect> effect, JS::GCPtr<AnimationTimeline> timeline) JS::NonnullGCPtr<Animation> Animation::create(JS::Realm& realm, JS::GCPtr<AnimationEffect> effect, JS::GCPtr<AnimationTimeline> timeline)
{ {

View file

@ -15,6 +15,7 @@ namespace Web::Animations {
// https://www.w3.org/TR/web-animations-1/#the-animation-interface // https://www.w3.org/TR/web-animations-1/#the-animation-interface
class Animation : public DOM::EventTarget { class Animation : public DOM::EventTarget {
WEB_PLATFORM_OBJECT(Animation, DOM::EventTarget); WEB_PLATFORM_OBJECT(Animation, DOM::EventTarget);
JS_DECLARE_ALLOCATOR(Animation);
public: public:
static JS::NonnullGCPtr<Animation> create(JS::Realm&, JS::GCPtr<AnimationEffect>, JS::GCPtr<AnimationTimeline>); static JS::NonnullGCPtr<Animation> create(JS::Realm&, JS::GCPtr<AnimationEffect>, JS::GCPtr<AnimationTimeline>);

View file

@ -12,6 +12,8 @@
namespace Web::Animations { namespace Web::Animations {
JS_DEFINE_ALLOCATOR(AnimationEffect);
JS::NonnullGCPtr<AnimationEffect> AnimationEffect::create(JS::Realm& realm) JS::NonnullGCPtr<AnimationEffect> AnimationEffect::create(JS::Realm& realm)
{ {
return realm.heap().allocate<AnimationEffect>(realm, realm); return realm.heap().allocate<AnimationEffect>(realm, realm);

View file

@ -58,6 +58,7 @@ enum class AnimationDirection {
// https://www.w3.org/TR/web-animations-1/#the-animationeffect-interface // https://www.w3.org/TR/web-animations-1/#the-animationeffect-interface
class AnimationEffect : public Bindings::PlatformObject { class AnimationEffect : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(AnimationEffect, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(AnimationEffect, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(AnimationEffect);
public: public:
static JS::NonnullGCPtr<AnimationEffect> create(JS::Realm&); static JS::NonnullGCPtr<AnimationEffect> create(JS::Realm&);

View file

@ -9,6 +9,8 @@
namespace Web::Animations { namespace Web::Animations {
JS_DEFINE_ALLOCATOR(AnimationPlaybackEvent);
JS::NonnullGCPtr<AnimationPlaybackEvent> AnimationPlaybackEvent::create(JS::Realm& realm, FlyString const& event_name, AnimationPlaybackEventInit const& event_init) JS::NonnullGCPtr<AnimationPlaybackEvent> AnimationPlaybackEvent::create(JS::Realm& realm, FlyString const& event_name, AnimationPlaybackEventInit const& event_init)
{ {
return realm.heap().allocate<AnimationPlaybackEvent>(realm, realm, event_name, event_init); return realm.heap().allocate<AnimationPlaybackEvent>(realm, realm, event_name, event_init);

View file

@ -20,6 +20,7 @@ struct AnimationPlaybackEventInit : public DOM::EventInit {
// https://www.w3.org/TR/web-animations-1/#animationplaybackevent // https://www.w3.org/TR/web-animations-1/#animationplaybackevent
class AnimationPlaybackEvent : public DOM::Event { class AnimationPlaybackEvent : public DOM::Event {
WEB_PLATFORM_OBJECT(AnimationPlaybackEvent, DOM::Event); WEB_PLATFORM_OBJECT(AnimationPlaybackEvent, DOM::Event);
JS_DECLARE_ALLOCATOR(AnimationPlaybackEvent);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<AnimationPlaybackEvent> create(JS::Realm&, FlyString const& event_name, AnimationPlaybackEventInit const& event_init = {}); [[nodiscard]] static JS::NonnullGCPtr<AnimationPlaybackEvent> create(JS::Realm&, FlyString const& event_name, AnimationPlaybackEventInit const& event_init = {});

View file

@ -10,6 +10,8 @@
namespace Web::Animations { namespace Web::Animations {
JS_DEFINE_ALLOCATOR(AnimationTimeline);
WebIDL::ExceptionOr<void> AnimationTimeline::set_current_time(Optional<double> value) WebIDL::ExceptionOr<void> AnimationTimeline::set_current_time(Optional<double> value)
{ {
if (value == m_current_time) if (value == m_current_time)

View file

@ -13,6 +13,7 @@ namespace Web::Animations {
// https://www.w3.org/TR/web-animations-1/#animationtimeline // https://www.w3.org/TR/web-animations-1/#animationtimeline
class AnimationTimeline : public Bindings::PlatformObject { class AnimationTimeline : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(AnimationTimeline, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(AnimationTimeline, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(AnimationTimeline);
public: public:
Optional<double> current_time() const { return m_current_time; } Optional<double> current_time() const { return m_current_time; }

View file

@ -13,6 +13,8 @@
namespace Web::Animations { namespace Web::Animations {
JS_DEFINE_ALLOCATOR(DocumentTimeline);
JS::NonnullGCPtr<DocumentTimeline> DocumentTimeline::create(JS::Realm& realm, DOM::Document& document, HighResolutionTime::DOMHighResTimeStamp origin_time) JS::NonnullGCPtr<DocumentTimeline> DocumentTimeline::create(JS::Realm& realm, DOM::Document& document, HighResolutionTime::DOMHighResTimeStamp origin_time)
{ {
return realm.heap().allocate<DocumentTimeline>(realm, realm, document, origin_time); return realm.heap().allocate<DocumentTimeline>(realm, realm, document, origin_time);

View file

@ -20,6 +20,7 @@ struct DocumentTimelineOptions {
// https://www.w3.org/TR/web-animations-1/#the-documenttimeline-interface // https://www.w3.org/TR/web-animations-1/#the-documenttimeline-interface
class DocumentTimeline : public AnimationTimeline { class DocumentTimeline : public AnimationTimeline {
WEB_PLATFORM_OBJECT(DocumentTimeline, AnimationTimeline); WEB_PLATFORM_OBJECT(DocumentTimeline, AnimationTimeline);
JS_DECLARE_ALLOCATOR(DocumentTimeline);
public: public:
static JS::NonnullGCPtr<DocumentTimeline> create(JS::Realm&, DOM::Document&, HighResolutionTime::DOMHighResTimeStamp origin_time); static JS::NonnullGCPtr<DocumentTimeline> create(JS::Realm&, DOM::Document&, HighResolutionTime::DOMHighResTimeStamp origin_time);

View file

@ -39,6 +39,7 @@ struct BaseKeyframe {
// https://www.w3.org/TR/web-animations-1/#the-keyframeeffect-interface // https://www.w3.org/TR/web-animations-1/#the-keyframeeffect-interface
class KeyframeEffect : public AnimationEffect { class KeyframeEffect : public AnimationEffect {
WEB_PLATFORM_OBJECT(KeyframeEffect, AnimationEffect); WEB_PLATFORM_OBJECT(KeyframeEffect, AnimationEffect);
JS_DECLARE_ALLOCATOR(KeyframeEffect);
public: public:
static JS::NonnullGCPtr<KeyframeEffect> create(JS::Realm&); static JS::NonnullGCPtr<KeyframeEffect> create(JS::Realm&);

View file

@ -12,6 +12,8 @@
namespace Web::Bindings { namespace Web::Bindings {
JS_DEFINE_ALLOCATOR(Intrinsics);
void Intrinsics::visit_edges(JS::Cell::Visitor& visitor) void Intrinsics::visit_edges(JS::Cell::Visitor& visitor)
{ {
Base::visit_edges(visitor); Base::visit_edges(visitor);

View file

@ -18,6 +18,7 @@ namespace Web::Bindings {
class Intrinsics final : public JS::Cell { class Intrinsics final : public JS::Cell {
JS_CELL(Intrinsics, JS::Cell); JS_CELL(Intrinsics, JS::Cell);
JS_DECLARE_ALLOCATOR(Intrinsics);
public: public:
Intrinsics(JS::Realm& realm) Intrinsics(JS::Realm& realm)

View file

@ -14,6 +14,7 @@ namespace Web::CSS {
class CSSFontFaceRule final : public CSSRule { class CSSFontFaceRule final : public CSSRule {
WEB_PLATFORM_OBJECT(CSSFontFaceRule, CSSRule); WEB_PLATFORM_OBJECT(CSSFontFaceRule, CSSRule);
JS_DECLARE_ALLOCATOR(CSSFontFaceRule);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<CSSFontFaceRule> create(JS::Realm&, FontFace&&); [[nodiscard]] static JS::NonnullGCPtr<CSSFontFaceRule> create(JS::Realm&, FontFace&&);

View file

@ -19,6 +19,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(CSSImportRule);
JS::NonnullGCPtr<CSSImportRule> CSSImportRule::create(AK::URL url, DOM::Document& document) JS::NonnullGCPtr<CSSImportRule> CSSImportRule::create(AK::URL url, DOM::Document& document)
{ {
auto& realm = document.realm(); auto& realm = document.realm();

View file

@ -20,6 +20,7 @@ class CSSImportRule final
: public CSSRule : public CSSRule
, public ResourceClient { , public ResourceClient {
WEB_PLATFORM_OBJECT(CSSImportRule, CSSRule); WEB_PLATFORM_OBJECT(CSSImportRule, CSSRule);
JS_DECLARE_ALLOCATOR(CSSImportRule);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<CSSImportRule> create(AK::URL, DOM::Document&); [[nodiscard]] static JS::NonnullGCPtr<CSSImportRule> create(AK::URL, DOM::Document&);

View file

@ -11,6 +11,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(CSSKeyframeRule);
JS::NonnullGCPtr<CSSKeyframeRule> CSSKeyframeRule::create(JS::Realm& realm, CSS::Percentage key, Web::CSS::CSSStyleDeclaration& declarations) JS::NonnullGCPtr<CSSKeyframeRule> CSSKeyframeRule::create(JS::Realm& realm, CSS::Percentage key, Web::CSS::CSSStyleDeclaration& declarations)
{ {
return realm.heap().allocate<CSSKeyframeRule>(realm, realm, key, declarations); return realm.heap().allocate<CSSKeyframeRule>(realm, realm, key, declarations);

View file

@ -18,6 +18,7 @@ namespace Web::CSS {
// https://drafts.csswg.org/css-animations/#interface-csskeyframerule // https://drafts.csswg.org/css-animations/#interface-csskeyframerule
class CSSKeyframeRule final : public CSSRule { class CSSKeyframeRule final : public CSSRule {
WEB_PLATFORM_OBJECT(CSSKeyframeRule, CSSRule); WEB_PLATFORM_OBJECT(CSSKeyframeRule, CSSRule);
JS_DECLARE_ALLOCATOR(CSSKeyframeRule);
public: public:
static JS::NonnullGCPtr<CSSKeyframeRule> create(JS::Realm&, CSS::Percentage key, CSSStyleDeclaration&); static JS::NonnullGCPtr<CSSKeyframeRule> create(JS::Realm&, CSS::Percentage key, CSSStyleDeclaration&);

View file

@ -10,6 +10,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(CSSKeyframesRule);
JS::NonnullGCPtr<CSSKeyframesRule> CSSKeyframesRule::create(JS::Realm& realm, FlyString name, JS::MarkedVector<JS::NonnullGCPtr<CSSKeyframeRule>> keyframes) JS::NonnullGCPtr<CSSKeyframesRule> CSSKeyframesRule::create(JS::Realm& realm, FlyString name, JS::MarkedVector<JS::NonnullGCPtr<CSSKeyframeRule>> keyframes)
{ {
return realm.heap().allocate<CSSKeyframesRule>(realm, realm, move(name), move(keyframes)); return realm.heap().allocate<CSSKeyframesRule>(realm, realm, move(name), move(keyframes));

View file

@ -19,6 +19,7 @@ namespace Web::CSS {
// https://drafts.csswg.org/css-animations/#interface-csskeyframesrule // https://drafts.csswg.org/css-animations/#interface-csskeyframesrule
class CSSKeyframesRule final : public CSSRule { class CSSKeyframesRule final : public CSSRule {
WEB_PLATFORM_OBJECT(CSSKeyframesRule, CSSRule); WEB_PLATFORM_OBJECT(CSSKeyframesRule, CSSRule);
JS_DECLARE_ALLOCATOR(CSSKeyframesRule);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<CSSKeyframesRule> create(JS::Realm&, FlyString name, JS::MarkedVector<JS::NonnullGCPtr<CSSKeyframeRule>>); [[nodiscard]] static JS::NonnullGCPtr<CSSKeyframesRule> create(JS::Realm&, FlyString name, JS::MarkedVector<JS::NonnullGCPtr<CSSKeyframeRule>>);

View file

@ -12,6 +12,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(CSSMediaRule);
JS::NonnullGCPtr<CSSMediaRule> CSSMediaRule::create(JS::Realm& realm, MediaList& media_queries, CSSRuleList& rules) JS::NonnullGCPtr<CSSMediaRule> CSSMediaRule::create(JS::Realm& realm, MediaList& media_queries, CSSRuleList& rules)
{ {
return realm.heap().allocate<CSSMediaRule>(realm, realm, media_queries, rules); return realm.heap().allocate<CSSMediaRule>(realm, realm, media_queries, rules);

View file

@ -16,6 +16,7 @@ namespace Web::CSS {
// https://www.w3.org/TR/css-conditional-3/#the-cssmediarule-interface // https://www.w3.org/TR/css-conditional-3/#the-cssmediarule-interface
class CSSMediaRule final : public CSSConditionRule { class CSSMediaRule final : public CSSConditionRule {
WEB_PLATFORM_OBJECT(CSSMediaRule, CSSConditionRule); WEB_PLATFORM_OBJECT(CSSMediaRule, CSSConditionRule);
JS_DECLARE_ALLOCATOR(CSSMediaRule);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<CSSMediaRule> create(JS::Realm&, MediaList& media_queries, CSSRuleList&); [[nodiscard]] static JS::NonnullGCPtr<CSSMediaRule> create(JS::Realm&, MediaList& media_queries, CSSRuleList&);

View file

@ -14,6 +14,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(CSSNamespaceRule);
CSSNamespaceRule::CSSNamespaceRule(JS::Realm& realm, Optional<DeprecatedString> prefix, StringView namespace_uri) CSSNamespaceRule::CSSNamespaceRule(JS::Realm& realm, Optional<DeprecatedString> prefix, StringView namespace_uri)
: CSSRule(realm) : CSSRule(realm)
, m_namespace_uri(namespace_uri) , m_namespace_uri(namespace_uri)

View file

@ -12,6 +12,7 @@ namespace Web::CSS {
class CSSNamespaceRule final : public CSSRule { class CSSNamespaceRule final : public CSSRule {
WEB_PLATFORM_OBJECT(CSSNamespaceRule, CSSRule); WEB_PLATFORM_OBJECT(CSSNamespaceRule, CSSRule);
JS_DECLARE_ALLOCATOR(CSSNamespaceRule);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<CSSNamespaceRule> create(JS::Realm&, Optional<DeprecatedString> prefix, StringView namespace_uri); [[nodiscard]] static JS::NonnullGCPtr<CSSNamespaceRule> create(JS::Realm&, Optional<DeprecatedString> prefix, StringView namespace_uri);

View file

@ -18,6 +18,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(CSSRuleList);
JS::NonnullGCPtr<CSSRuleList> CSSRuleList::create(JS::Realm& realm, JS::MarkedVector<CSSRule*> const& rules) JS::NonnullGCPtr<CSSRuleList> CSSRuleList::create(JS::Realm& realm, JS::MarkedVector<CSSRule*> const& rules)
{ {
auto rule_list = realm.heap().allocate<CSSRuleList>(realm, realm); auto rule_list = realm.heap().allocate<CSSRuleList>(realm, realm);

View file

@ -21,6 +21,7 @@ namespace Web::CSS {
// https://www.w3.org/TR/cssom/#the-cssrulelist-interface // https://www.w3.org/TR/cssom/#the-cssrulelist-interface
class CSSRuleList : public Bindings::LegacyPlatformObject { class CSSRuleList : public Bindings::LegacyPlatformObject {
WEB_PLATFORM_OBJECT(CSSRuleList, Bindings::LegacyPlatformObject); WEB_PLATFORM_OBJECT(CSSRuleList, Bindings::LegacyPlatformObject);
JS_DECLARE_ALLOCATOR(CSSRuleList);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<CSSRuleList> create(JS::Realm&, JS::MarkedVector<CSSRule*> const&); [[nodiscard]] static JS::NonnullGCPtr<CSSRuleList> create(JS::Realm&, JS::MarkedVector<CSSRule*> const&);

View file

@ -16,6 +16,10 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(CSSStyleDeclaration);
JS_DEFINE_ALLOCATOR(PropertyOwningCSSStyleDeclaration);
JS_DEFINE_ALLOCATOR(ElementInlineCSSStyleDeclaration);
CSSStyleDeclaration::CSSStyleDeclaration(JS::Realm& realm) CSSStyleDeclaration::CSSStyleDeclaration(JS::Realm& realm)
: PlatformObject(realm) : PlatformObject(realm)
{ {

View file

@ -16,6 +16,7 @@ namespace Web::CSS {
class CSSStyleDeclaration : public Bindings::PlatformObject { class CSSStyleDeclaration : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(CSSStyleDeclaration, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(CSSStyleDeclaration, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(CSSStyleDeclaration);
public: public:
virtual ~CSSStyleDeclaration() = default; virtual ~CSSStyleDeclaration() = default;
@ -50,6 +51,8 @@ protected:
class PropertyOwningCSSStyleDeclaration : public CSSStyleDeclaration { class PropertyOwningCSSStyleDeclaration : public CSSStyleDeclaration {
WEB_PLATFORM_OBJECT(PropertyOwningCSSStyleDeclaration, CSSStyleDeclaration); WEB_PLATFORM_OBJECT(PropertyOwningCSSStyleDeclaration, CSSStyleDeclaration);
JS_DECLARE_ALLOCATOR(PropertyOwningCSSStyleDeclaration);
friend class ElementInlineCSSStyleDeclaration; friend class ElementInlineCSSStyleDeclaration;
public: public:
@ -93,6 +96,7 @@ private:
class ElementInlineCSSStyleDeclaration final : public PropertyOwningCSSStyleDeclaration { class ElementInlineCSSStyleDeclaration final : public PropertyOwningCSSStyleDeclaration {
WEB_PLATFORM_OBJECT(ElementInlineCSSStyleDeclaration, PropertyOwningCSSStyleDeclaration); WEB_PLATFORM_OBJECT(ElementInlineCSSStyleDeclaration, PropertyOwningCSSStyleDeclaration);
JS_DECLARE_ALLOCATOR(ElementInlineCSSStyleDeclaration);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<ElementInlineCSSStyleDeclaration> create(DOM::Element&, Vector<StyleProperty>, HashMap<FlyString, StyleProperty> custom_properties); [[nodiscard]] static JS::NonnullGCPtr<ElementInlineCSSStyleDeclaration> create(DOM::Element&, Vector<StyleProperty>, HashMap<FlyString, StyleProperty> custom_properties);

View file

@ -12,6 +12,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(CSSStyleRule);
JS::NonnullGCPtr<CSSStyleRule> CSSStyleRule::create(JS::Realm& realm, Vector<NonnullRefPtr<Web::CSS::Selector>>&& selectors, CSSStyleDeclaration& declaration) JS::NonnullGCPtr<CSSStyleRule> CSSStyleRule::create(JS::Realm& realm, Vector<NonnullRefPtr<Web::CSS::Selector>>&& selectors, CSSStyleDeclaration& declaration)
{ {
return realm.heap().allocate<CSSStyleRule>(realm, realm, move(selectors), declaration); return realm.heap().allocate<CSSStyleRule>(realm, realm, move(selectors), declaration);

View file

@ -16,6 +16,7 @@ namespace Web::CSS {
class CSSStyleRule final : public CSSRule { class CSSStyleRule final : public CSSRule {
WEB_PLATFORM_OBJECT(CSSStyleRule, CSSRule); WEB_PLATFORM_OBJECT(CSSStyleRule, CSSRule);
JS_DECLARE_ALLOCATOR(CSSStyleRule);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<CSSStyleRule> create(JS::Realm&, Vector<NonnullRefPtr<Selector>>&&, CSSStyleDeclaration&); [[nodiscard]] static JS::NonnullGCPtr<CSSStyleRule> create(JS::Realm&, Vector<NonnullRefPtr<Selector>>&&, CSSStyleDeclaration&);

View file

@ -15,6 +15,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(CSSStyleSheet);
JS::NonnullGCPtr<CSSStyleSheet> CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location) JS::NonnullGCPtr<CSSStyleSheet> CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location)
{ {
return realm.heap().allocate<CSSStyleSheet>(realm, realm, rules, media, move(location)); return realm.heap().allocate<CSSStyleSheet>(realm, realm, rules, media, move(location));

View file

@ -21,6 +21,7 @@ class CSSStyleSheet final
: public StyleSheet : public StyleSheet
, public Weakable<CSSStyleSheet> { , public Weakable<CSSStyleSheet> {
WEB_PLATFORM_OBJECT(CSSStyleSheet, StyleSheet); WEB_PLATFORM_OBJECT(CSSStyleSheet, StyleSheet);
JS_DECLARE_ALLOCATOR(CSSStyleSheet);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<CSSStyleSheet> create(JS::Realm&, CSSRuleList&, MediaList&, Optional<AK::URL> location); [[nodiscard]] static JS::NonnullGCPtr<CSSStyleSheet> create(JS::Realm&, CSSRuleList&, MediaList&, Optional<AK::URL> location);

View file

@ -11,6 +11,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(CSSSupportsRule);
JS::NonnullGCPtr<CSSSupportsRule> CSSSupportsRule::create(JS::Realm& realm, NonnullRefPtr<Supports>&& supports, CSSRuleList& rules) JS::NonnullGCPtr<CSSSupportsRule> CSSSupportsRule::create(JS::Realm& realm, NonnullRefPtr<Supports>&& supports, CSSRuleList& rules)
{ {
return realm.heap().allocate<CSSSupportsRule>(realm, realm, move(supports), rules); return realm.heap().allocate<CSSSupportsRule>(realm, realm, move(supports), rules);

View file

@ -17,6 +17,7 @@ namespace Web::CSS {
// https://www.w3.org/TR/css-conditional-3/#the-csssupportsrule-interface // https://www.w3.org/TR/css-conditional-3/#the-csssupportsrule-interface
class CSSSupportsRule final : public CSSConditionRule { class CSSSupportsRule final : public CSSConditionRule {
WEB_PLATFORM_OBJECT(CSSSupportsRule, CSSConditionRule); WEB_PLATFORM_OBJECT(CSSSupportsRule, CSSConditionRule);
JS_DECLARE_ALLOCATOR(CSSSupportsRule);
public: public:
static JS::NonnullGCPtr<CSSSupportsRule> create(JS::Realm&, NonnullRefPtr<Supports>&&, CSSRuleList&); static JS::NonnullGCPtr<CSSSupportsRule> create(JS::Realm&, NonnullRefPtr<Supports>&&, CSSRuleList&);

View file

@ -13,6 +13,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(MediaList);
JS::NonnullGCPtr<MediaList> MediaList::create(JS::Realm& realm, Vector<NonnullRefPtr<MediaQuery>>&& media) JS::NonnullGCPtr<MediaList> MediaList::create(JS::Realm& realm, Vector<NonnullRefPtr<MediaQuery>>&& media)
{ {
return realm.heap().allocate<MediaList>(realm, realm, move(media)); return realm.heap().allocate<MediaList>(realm, realm, move(media));

View file

@ -18,6 +18,7 @@ namespace Web::CSS {
// https://www.w3.org/TR/cssom-1/#the-medialist-interface // https://www.w3.org/TR/cssom-1/#the-medialist-interface
class MediaList final : public Bindings::LegacyPlatformObject { class MediaList final : public Bindings::LegacyPlatformObject {
WEB_PLATFORM_OBJECT(MediaList, Bindings::LegacyPlatformObject); WEB_PLATFORM_OBJECT(MediaList, Bindings::LegacyPlatformObject);
JS_DECLARE_ALLOCATOR(MediaList);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<MediaList> create(JS::Realm&, Vector<NonnullRefPtr<MediaQuery>>&&); [[nodiscard]] static JS::NonnullGCPtr<MediaList> create(JS::Realm&, Vector<NonnullRefPtr<MediaQuery>>&&);

View file

@ -15,6 +15,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(MediaQueryList);
JS::NonnullGCPtr<MediaQueryList> MediaQueryList::create(DOM::Document& document, Vector<NonnullRefPtr<MediaQuery>>&& media) JS::NonnullGCPtr<MediaQueryList> MediaQueryList::create(DOM::Document& document, Vector<NonnullRefPtr<MediaQuery>>&& media)
{ {
return document.heap().allocate<MediaQueryList>(document.realm(), document, move(media)); return document.heap().allocate<MediaQueryList>(document.realm(), document, move(media));

View file

@ -15,6 +15,7 @@ namespace Web::CSS {
// 4.2. The MediaQueryList Interface, https://drafts.csswg.org/cssom-view/#the-mediaquerylist-interface // 4.2. The MediaQueryList Interface, https://drafts.csswg.org/cssom-view/#the-mediaquerylist-interface
class MediaQueryList final : public DOM::EventTarget { class MediaQueryList final : public DOM::EventTarget {
WEB_PLATFORM_OBJECT(MediaQueryList, DOM::EventTarget); WEB_PLATFORM_OBJECT(MediaQueryList, DOM::EventTarget);
JS_DECLARE_ALLOCATOR(MediaQueryList);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<MediaQueryList> create(DOM::Document&, Vector<NonnullRefPtr<MediaQuery>>&&); [[nodiscard]] static JS::NonnullGCPtr<MediaQueryList> create(DOM::Document&, Vector<NonnullRefPtr<MediaQuery>>&&);

View file

@ -10,6 +10,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(MediaQueryListEvent);
JS::NonnullGCPtr<MediaQueryListEvent> MediaQueryListEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, MediaQueryListEventInit const& event_init) JS::NonnullGCPtr<MediaQueryListEvent> MediaQueryListEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, MediaQueryListEventInit const& event_init)
{ {
return realm.heap().allocate<MediaQueryListEvent>(realm, realm, event_name, event_init); return realm.heap().allocate<MediaQueryListEvent>(realm, realm, event_name, event_init);

View file

@ -18,6 +18,7 @@ struct MediaQueryListEventInit : public DOM::EventInit {
class MediaQueryListEvent final : public DOM::Event { class MediaQueryListEvent final : public DOM::Event {
WEB_PLATFORM_OBJECT(MediaQueryListEvent, DOM::Event); WEB_PLATFORM_OBJECT(MediaQueryListEvent, DOM::Event);
JS_DECLARE_ALLOCATOR(MediaQueryListEvent);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<MediaQueryListEvent> construct_impl(JS::Realm&, FlyString const& event_name, MediaQueryListEventInit const& = {}); [[nodiscard]] static JS::NonnullGCPtr<MediaQueryListEvent> construct_impl(JS::Realm&, FlyString const& event_name, MediaQueryListEventInit const& = {});

View file

@ -44,6 +44,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(ResolvedCSSStyleDeclaration);
JS::NonnullGCPtr<ResolvedCSSStyleDeclaration> ResolvedCSSStyleDeclaration::create(DOM::Element& element) JS::NonnullGCPtr<ResolvedCSSStyleDeclaration> ResolvedCSSStyleDeclaration::create(DOM::Element& element)
{ {
return element.realm().heap().allocate<ResolvedCSSStyleDeclaration>(element.realm(), element); return element.realm().heap().allocate<ResolvedCSSStyleDeclaration>(element.realm(), element);

View file

@ -12,6 +12,7 @@ namespace Web::CSS {
class ResolvedCSSStyleDeclaration final : public CSSStyleDeclaration { class ResolvedCSSStyleDeclaration final : public CSSStyleDeclaration {
WEB_PLATFORM_OBJECT(ResolvedCSSStyleDeclaration, CSSStyleDeclaration); WEB_PLATFORM_OBJECT(ResolvedCSSStyleDeclaration, CSSStyleDeclaration);
JS_DECLARE_ALLOCATOR(ResolvedCSSStyleDeclaration);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<ResolvedCSSStyleDeclaration> create(DOM::Element&); [[nodiscard]] static JS::NonnullGCPtr<ResolvedCSSStyleDeclaration> create(DOM::Element&);

View file

@ -13,6 +13,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(Screen);
JS::NonnullGCPtr<Screen> Screen::create(HTML::Window& window) JS::NonnullGCPtr<Screen> Screen::create(HTML::Window& window)
{ {
return window.heap().allocate<Screen>(window.realm(), window); return window.heap().allocate<Screen>(window.realm(), window);

View file

@ -15,6 +15,7 @@ namespace Web::CSS {
class Screen final : public Bindings::PlatformObject { class Screen final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(Screen, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(Screen, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(Screen);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<Screen> create(HTML::Window&); [[nodiscard]] static JS::NonnullGCPtr<Screen> create(HTML::Window&);

View file

@ -13,6 +13,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(StyleSheetList);
void StyleSheetList::add_sheet(CSSStyleSheet& sheet) void StyleSheetList::add_sheet(CSSStyleSheet& sheet)
{ {
sheet.set_style_sheet_list({}, this); sheet.set_style_sheet_list({}, this);

View file

@ -12,8 +12,9 @@
namespace Web::CSS { namespace Web::CSS {
class StyleSheetList : public Bindings::LegacyPlatformObject { class StyleSheetList final : public Bindings::LegacyPlatformObject {
WEB_PLATFORM_OBJECT(StyleSheetList, Bindings::LegacyPlatformObject); WEB_PLATFORM_OBJECT(StyleSheetList, Bindings::LegacyPlatformObject);
JS_DECLARE_ALLOCATOR(StyleSheetList);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<StyleSheetList> create(DOM::Document&); [[nodiscard]] static JS::NonnullGCPtr<StyleSheetList> create(DOM::Document&);

View file

@ -15,6 +15,8 @@
namespace Web::CSS { namespace Web::CSS {
JS_DEFINE_ALLOCATOR(VisualViewport);
JS::NonnullGCPtr<VisualViewport> VisualViewport::create(DOM::Document& document) JS::NonnullGCPtr<VisualViewport> VisualViewport::create(DOM::Document& document)
{ {
return document.heap().allocate<VisualViewport>(document.realm(), document); return document.heap().allocate<VisualViewport>(document.realm(), document);

View file

@ -13,6 +13,7 @@ namespace Web::CSS {
// https://drafts.csswg.org/cssom-view/#visualviewport // https://drafts.csswg.org/cssom-view/#visualviewport
class VisualViewport final : public DOM::EventTarget { class VisualViewport final : public DOM::EventTarget {
WEB_PLATFORM_OBJECT(VisualViewport, DOM::EventTarget); WEB_PLATFORM_OBJECT(VisualViewport, DOM::EventTarget);
JS_DECLARE_ALLOCATOR(VisualViewport);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<VisualViewport> create(DOM::Document&); [[nodiscard]] static JS::NonnullGCPtr<VisualViewport> create(DOM::Document&);

View file

@ -19,6 +19,8 @@
namespace Web::Clipboard { namespace Web::Clipboard {
JS_DEFINE_ALLOCATOR(Clipboard);
WebIDL::ExceptionOr<JS::NonnullGCPtr<Clipboard>> Clipboard::construct_impl(JS::Realm& realm) WebIDL::ExceptionOr<JS::NonnullGCPtr<Clipboard>> Clipboard::construct_impl(JS::Realm& realm)
{ {
return realm.heap().allocate<Clipboard>(realm, realm); return realm.heap().allocate<Clipboard>(realm, realm);

View file

@ -17,6 +17,7 @@ namespace Web::Clipboard {
class Clipboard final : public DOM::EventTarget { class Clipboard final : public DOM::EventTarget {
WEB_PLATFORM_OBJECT(Clipboard, DOM::EventTarget); WEB_PLATFORM_OBJECT(Clipboard, DOM::EventTarget);
JS_DECLARE_ALLOCATOR(Clipboard);
public: public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Clipboard>> construct_impl(JS::Realm&); static WebIDL::ExceptionOr<JS::NonnullGCPtr<Clipboard>> construct_impl(JS::Realm&);

View file

@ -15,6 +15,8 @@
namespace Web::Crypto { namespace Web::Crypto {
JS_DEFINE_ALLOCATOR(Crypto);
JS::NonnullGCPtr<Crypto> Crypto::create(JS::Realm& realm) JS::NonnullGCPtr<Crypto> Crypto::create(JS::Realm& realm)
{ {
return realm.heap().allocate<Crypto>(realm, realm); return realm.heap().allocate<Crypto>(realm, realm);

View file

@ -14,6 +14,7 @@ namespace Web::Crypto {
class Crypto : public Bindings::PlatformObject { class Crypto : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(Crypto, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(Crypto, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(Crypto);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<Crypto> create(JS::Realm&); [[nodiscard]] static JS::NonnullGCPtr<Crypto> create(JS::Realm&);

View file

@ -14,6 +14,8 @@
namespace Web::Crypto { namespace Web::Crypto {
JS_DEFINE_ALLOCATOR(SubtleCrypto);
JS::NonnullGCPtr<SubtleCrypto> SubtleCrypto::create(JS::Realm& realm) JS::NonnullGCPtr<SubtleCrypto> SubtleCrypto::create(JS::Realm& realm)
{ {
return realm.heap().allocate<SubtleCrypto>(realm, realm); return realm.heap().allocate<SubtleCrypto>(realm, realm);

View file

@ -13,6 +13,7 @@ namespace Web::Crypto {
class SubtleCrypto final : public Bindings::PlatformObject { class SubtleCrypto final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SubtleCrypto, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(SubtleCrypto, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SubtleCrypto);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<SubtleCrypto> create(JS::Realm&); [[nodiscard]] static JS::NonnullGCPtr<SubtleCrypto> create(JS::Realm&);

View file

@ -10,6 +10,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(AbortController);
WebIDL::ExceptionOr<JS::NonnullGCPtr<AbortController>> AbortController::construct_impl(JS::Realm& realm) WebIDL::ExceptionOr<JS::NonnullGCPtr<AbortController>> AbortController::construct_impl(JS::Realm& realm)
{ {
auto signal = TRY(AbortSignal::construct_impl(realm)); auto signal = TRY(AbortSignal::construct_impl(realm));

View file

@ -14,6 +14,7 @@ namespace Web::DOM {
// https://dom.spec.whatwg.org/#abortcontroller // https://dom.spec.whatwg.org/#abortcontroller
class AbortController final : public Bindings::PlatformObject { class AbortController final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(AbortController, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(AbortController, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(AbortController);
public: public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<AbortController>> construct_impl(JS::Realm&); static WebIDL::ExceptionOr<JS::NonnullGCPtr<AbortController>> construct_impl(JS::Realm&);

View file

@ -12,6 +12,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(AbortSignal);
WebIDL::ExceptionOr<JS::NonnullGCPtr<AbortSignal>> AbortSignal::construct_impl(JS::Realm& realm) WebIDL::ExceptionOr<JS::NonnullGCPtr<AbortSignal>> AbortSignal::construct_impl(JS::Realm& realm)
{ {
return realm.heap().allocate<AbortSignal>(realm, realm); return realm.heap().allocate<AbortSignal>(realm, realm);

View file

@ -17,6 +17,7 @@ namespace Web::DOM {
// https://dom.spec.whatwg.org/#abortsignal // https://dom.spec.whatwg.org/#abortsignal
class AbortSignal final : public EventTarget { class AbortSignal final : public EventTarget {
WEB_PLATFORM_OBJECT(AbortSignal, EventTarget); WEB_PLATFORM_OBJECT(AbortSignal, EventTarget);
JS_DECLARE_ALLOCATOR(AbortSignal);
public: public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<AbortSignal>> construct_impl(JS::Realm&); static WebIDL::ExceptionOr<JS::NonnullGCPtr<AbortSignal>> construct_impl(JS::Realm&);

View file

@ -13,6 +13,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(AccessibilityTreeNode);
JS::NonnullGCPtr<AccessibilityTreeNode> AccessibilityTreeNode::create(Document* document, DOM::Node const* value) JS::NonnullGCPtr<AccessibilityTreeNode> AccessibilityTreeNode::create(Document* document, DOM::Node const* value)
{ {
return document->heap().allocate<AccessibilityTreeNode>(document->realm(), value); return document->heap().allocate<AccessibilityTreeNode>(document->realm(), value);

View file

@ -9,13 +9,16 @@
#include <AK/JsonObjectSerializer.h> #include <AK/JsonObjectSerializer.h>
#include <AK/Vector.h> #include <AK/Vector.h>
#include <LibJS/Heap/Cell.h> #include <LibJS/Heap/Cell.h>
#include <LibJS/Heap/CellAllocator.h>
#include <LibWeb/DOM/Node.h> #include <LibWeb/DOM/Node.h>
#include <LibWeb/Forward.h> #include <LibWeb/Forward.h>
namespace Web::DOM { namespace Web::DOM {
class AccessibilityTreeNode final : public JS::Cell { class AccessibilityTreeNode final : public JS::Cell {
JS_CELL(AccessibilityTreeNode, JS::Cell) JS_CELL(AccessibilityTreeNode, JS::Cell);
JS_DECLARE_ALLOCATOR(AccessibilityTreeNode);
public: public:
static JS::NonnullGCPtr<AccessibilityTreeNode> create(Document*, DOM::Node const*); static JS::NonnullGCPtr<AccessibilityTreeNode> create(Document*, DOM::Node const*);
virtual ~AccessibilityTreeNode() override = default; virtual ~AccessibilityTreeNode() override = default;

View file

@ -15,6 +15,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(Attr);
JS::NonnullGCPtr<Attr> Attr::create(Document& document, FlyString local_name, String value, Element* owner_element) JS::NonnullGCPtr<Attr> Attr::create(Document& document, FlyString local_name, String value, Element* owner_element)
{ {
return document.heap().allocate<Attr>(document.realm(), document, QualifiedName(move(local_name), Optional<FlyString> {}, Optional<FlyString> {}), move(value), owner_element); return document.heap().allocate<Attr>(document.realm(), document, QualifiedName(move(local_name), Optional<FlyString> {}, Optional<FlyString> {}), move(value), owner_element);

View file

@ -15,6 +15,7 @@ namespace Web::DOM {
// https://dom.spec.whatwg.org/#attr // https://dom.spec.whatwg.org/#attr
class Attr final : public Node { class Attr final : public Node {
WEB_PLATFORM_OBJECT(Attr, Node); WEB_PLATFORM_OBJECT(Attr, Node);
JS_DECLARE_ALLOCATOR(Attr);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<Attr> create(Document&, QualifiedName, String value = {}, Element* = nullptr); [[nodiscard]] static JS::NonnullGCPtr<Attr> create(Document&, QualifiedName, String value = {}, Element* = nullptr);

View file

@ -9,6 +9,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(CDATASection);
CDATASection::CDATASection(Document& document, String const& data) CDATASection::CDATASection(Document& document, String const& data)
: Text(document, NodeType::CDATA_SECTION_NODE, data) : Text(document, NodeType::CDATA_SECTION_NODE, data)
{ {

View file

@ -13,6 +13,7 @@ namespace Web::DOM {
class CDATASection final : public Text { class CDATASection final : public Text {
WEB_PLATFORM_OBJECT(CDATASection, Text); WEB_PLATFORM_OBJECT(CDATASection, Text);
JS_DECLARE_ALLOCATOR(CDATASection);
public: public:
virtual ~CDATASection() override; virtual ~CDATASection() override;

View file

@ -14,6 +14,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(CharacterData);
CharacterData::CharacterData(Document& document, NodeType type, String const& data) CharacterData::CharacterData(Document& document, NodeType type, String const& data)
: Node(document, type) : Node(document, type)
, m_data(data) , m_data(data)

View file

@ -18,6 +18,7 @@ class CharacterData
, public ChildNode<CharacterData> , public ChildNode<CharacterData>
, public NonDocumentTypeChildNode<CharacterData> { , public NonDocumentTypeChildNode<CharacterData> {
WEB_PLATFORM_OBJECT(CharacterData, Node); WEB_PLATFORM_OBJECT(CharacterData, Node);
JS_DECLARE_ALLOCATOR(CharacterData);
public: public:
virtual ~CharacterData() override = default; virtual ~CharacterData() override = default;

View file

@ -11,6 +11,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(Comment);
Comment::Comment(Document& document, String const& data) Comment::Comment(Document& document, String const& data)
: CharacterData(document, NodeType::COMMENT_NODE, data) : CharacterData(document, NodeType::COMMENT_NODE, data)
{ {

View file

@ -12,6 +12,7 @@ namespace Web::DOM {
class Comment final : public CharacterData { class Comment final : public CharacterData {
WEB_PLATFORM_OBJECT(Comment, CharacterData); WEB_PLATFORM_OBJECT(Comment, CharacterData);
JS_DECLARE_ALLOCATOR(Comment);
public: public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Comment>> construct_impl(JS::Realm&, String const& data); static WebIDL::ExceptionOr<JS::NonnullGCPtr<Comment>> construct_impl(JS::Realm&, String const& data);

View file

@ -11,6 +11,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(CustomEvent);
JS::NonnullGCPtr<CustomEvent> CustomEvent::create(JS::Realm& realm, FlyString const& event_name, CustomEventInit const& event_init) JS::NonnullGCPtr<CustomEvent> CustomEvent::create(JS::Realm& realm, FlyString const& event_name, CustomEventInit const& event_init)
{ {
return realm.heap().allocate<CustomEvent>(realm, realm, event_name, event_init); return realm.heap().allocate<CustomEvent>(realm, realm, event_name, event_init);

View file

@ -19,6 +19,7 @@ struct CustomEventInit : public EventInit {
// https://dom.spec.whatwg.org/#customevent // https://dom.spec.whatwg.org/#customevent
class CustomEvent : public Event { class CustomEvent : public Event {
WEB_PLATFORM_OBJECT(CustomEvent, Event); WEB_PLATFORM_OBJECT(CustomEvent, Event);
JS_DECLARE_ALLOCATOR(CustomEvent);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<CustomEvent> create(JS::Realm&, FlyString const& event_name, CustomEventInit const& = {}); [[nodiscard]] static JS::NonnullGCPtr<CustomEvent> create(JS::Realm&, FlyString const& event_name, CustomEventInit const& = {});

View file

@ -10,6 +10,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(DOMEventListener);
DOMEventListener::DOMEventListener() = default; DOMEventListener::DOMEventListener() = default;
DOMEventListener::~DOMEventListener() = default; DOMEventListener::~DOMEventListener() = default;

View file

@ -17,6 +17,7 @@ namespace Web::DOM {
// NOTE: The spec calls this "event listener", and it's *importantly* not the same as "EventListener" // NOTE: The spec calls this "event listener", and it's *importantly* not the same as "EventListener"
class DOMEventListener : public JS::Cell { class DOMEventListener : public JS::Cell {
JS_CELL(DOMEventListener, JS::Cell); JS_CELL(DOMEventListener, JS::Cell);
JS_DECLARE_ALLOCATOR(DOMEventListener);
public: public:
DOMEventListener(); DOMEventListener();

View file

@ -17,6 +17,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(DOMImplementation);
JS::NonnullGCPtr<DOMImplementation> DOMImplementation::create(Document& document) JS::NonnullGCPtr<DOMImplementation> DOMImplementation::create(Document& document)
{ {
auto& realm = document.realm(); auto& realm = document.realm();

View file

@ -15,6 +15,7 @@ namespace Web::DOM {
class DOMImplementation final : public Bindings::PlatformObject { class DOMImplementation final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(DOMImplementation, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(DOMImplementation, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(DOMImplementation);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<DOMImplementation> create(Document&); [[nodiscard]] static JS::NonnullGCPtr<DOMImplementation> create(Document&);

View file

@ -52,6 +52,8 @@ inline void replace_in_ordered_set(Vector<String>& set, String const& item, Stri
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(DOMTokenList);
JS::NonnullGCPtr<DOMTokenList> DOMTokenList::create(Element& associated_element, FlyString associated_attribute) JS::NonnullGCPtr<DOMTokenList> DOMTokenList::create(Element& associated_element, FlyString associated_attribute)
{ {
auto& realm = associated_element.realm(); auto& realm = associated_element.realm();

View file

@ -22,6 +22,7 @@ namespace Web::DOM {
// https://dom.spec.whatwg.org/#domtokenlist // https://dom.spec.whatwg.org/#domtokenlist
class DOMTokenList final : public Bindings::LegacyPlatformObject { class DOMTokenList final : public Bindings::LegacyPlatformObject {
WEB_PLATFORM_OBJECT(DOMTokenList, Bindings::LegacyPlatformObject); WEB_PLATFORM_OBJECT(DOMTokenList, Bindings::LegacyPlatformObject);
JS_DECLARE_ALLOCATOR(DOMTokenList);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<DOMTokenList> create(Element& associated_element, FlyString associated_attribute); [[nodiscard]] static JS::NonnullGCPtr<DOMTokenList> create(Element& associated_element, FlyString associated_attribute);

View file

@ -106,6 +106,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(Document);
// https://html.spec.whatwg.org/multipage/origin.html#obtain-browsing-context-navigation // https://html.spec.whatwg.org/multipage/origin.html#obtain-browsing-context-navigation
static JS::NonnullGCPtr<HTML::BrowsingContext> obtain_a_browsing_context_to_use_for_a_navigation_response( static JS::NonnullGCPtr<HTML::BrowsingContext> obtain_a_browsing_context_to_use_for_a_navigation_response(
HTML::BrowsingContext& browsing_context, HTML::BrowsingContext& browsing_context,

View file

@ -81,6 +81,7 @@ class Document
, public NonElementParentNode<Document> , public NonElementParentNode<Document>
, public HTML::GlobalEventHandlers { , public HTML::GlobalEventHandlers {
WEB_PLATFORM_OBJECT(Document, ParentNode); WEB_PLATFORM_OBJECT(Document, ParentNode);
JS_DECLARE_ALLOCATOR(Document);
public: public:
enum class Type { enum class Type {

View file

@ -9,6 +9,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(DocumentFragment);
DocumentFragment::DocumentFragment(Document& document) DocumentFragment::DocumentFragment(Document& document)
: ParentNode(document, NodeType::DOCUMENT_FRAGMENT_NODE) : ParentNode(document, NodeType::DOCUMENT_FRAGMENT_NODE)
{ {

View file

@ -16,6 +16,7 @@ class DocumentFragment
: public ParentNode : public ParentNode
, public NonElementParentNode<DocumentFragment> { , public NonElementParentNode<DocumentFragment> {
WEB_PLATFORM_OBJECT(DocumentFragment, ParentNode); WEB_PLATFORM_OBJECT(DocumentFragment, ParentNode);
JS_DECLARE_ALLOCATOR(DocumentFragment);
public: public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> construct_impl(JS::Realm& realm); static WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> construct_impl(JS::Realm& realm);

View file

@ -10,6 +10,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(DocumentObserver);
DocumentObserver::DocumentObserver(JS::Realm& realm, DOM::Document& document) DocumentObserver::DocumentObserver(JS::Realm& realm, DOM::Document& document)
: Bindings::PlatformObject(realm) : Bindings::PlatformObject(realm)
, m_document(document) , m_document(document)

View file

@ -16,6 +16,7 @@ namespace Web::DOM {
class DocumentObserver final : public Bindings::PlatformObject { class DocumentObserver final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(DocumentObserver, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(DocumentObserver, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(DocumentObserver);
public: public:
[[nodiscard]] JS::GCPtr<JS::HeapFunction<void()>> document_became_inactive() const { return m_document_became_inactive; } [[nodiscard]] JS::GCPtr<JS::HeapFunction<void()>> document_became_inactive() const { return m_document_became_inactive; }

View file

@ -9,6 +9,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(DocumentType);
JS::NonnullGCPtr<DocumentType> DocumentType::create(Document& document) JS::NonnullGCPtr<DocumentType> DocumentType::create(Document& document)
{ {
return document.heap().allocate<DocumentType>(document.realm(), document); return document.heap().allocate<DocumentType>(document.realm(), document);

View file

@ -16,6 +16,7 @@ class DocumentType final
: public Node : public Node
, public ChildNode<DocumentType> { , public ChildNode<DocumentType> {
WEB_PLATFORM_OBJECT(DocumentType, Node); WEB_PLATFORM_OBJECT(DocumentType, Node);
JS_DECLARE_ALLOCATOR(DocumentType);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<DocumentType> create(Document&); [[nodiscard]] static JS::NonnullGCPtr<DocumentType> create(Document&);

View file

@ -14,6 +14,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(Event);
JS::NonnullGCPtr<Event> Event::create(JS::Realm& realm, FlyString const& event_name, EventInit const& event_init) JS::NonnullGCPtr<Event> Event::create(JS::Realm& realm, FlyString const& event_name, EventInit const& event_init)
{ {
return realm.heap().allocate<Event>(realm, realm, event_name, event_init); return realm.heap().allocate<Event>(realm, realm, event_name, event_init);

View file

@ -20,6 +20,7 @@ struct EventInit {
class Event : public Bindings::PlatformObject { class Event : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(Event, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(Event, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(Event);
public: public:
enum Phase : u16 { enum Phase : u16 {

View file

@ -13,6 +13,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(HTMLCollection);
JS::NonnullGCPtr<HTMLCollection> HTMLCollection::create(ParentNode& root, Scope scope, Function<bool(Element const&)> filter) JS::NonnullGCPtr<HTMLCollection> HTMLCollection::create(ParentNode& root, Scope scope, Function<bool(Element const&)> filter)
{ {
return root.heap().allocate<HTMLCollection>(root.realm(), root, scope, move(filter)); return root.heap().allocate<HTMLCollection>(root.realm(), root, scope, move(filter));

View file

@ -27,6 +27,7 @@ namespace Web::DOM {
class HTMLCollection : public Bindings::LegacyPlatformObject { class HTMLCollection : public Bindings::LegacyPlatformObject {
WEB_PLATFORM_OBJECT(HTMLCollection, Bindings::LegacyPlatformObject); WEB_PLATFORM_OBJECT(HTMLCollection, Bindings::LegacyPlatformObject);
JS_DECLARE_ALLOCATOR(HTMLCollection);
public: public:
enum class Scope { enum class Scope {

View file

@ -12,6 +12,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(HTMLFormControlsCollection);
JS::NonnullGCPtr<HTMLFormControlsCollection> HTMLFormControlsCollection::create(ParentNode& root, Scope scope, Function<bool(Element const&)> filter) JS::NonnullGCPtr<HTMLFormControlsCollection> HTMLFormControlsCollection::create(ParentNode& root, Scope scope, Function<bool(Element const&)> filter)
{ {
return root.heap().allocate<HTMLFormControlsCollection>(root.realm(), root, scope, move(filter)); return root.heap().allocate<HTMLFormControlsCollection>(root.realm(), root, scope, move(filter));

View file

@ -13,6 +13,7 @@ namespace Web::DOM {
class HTMLFormControlsCollection : public HTMLCollection { class HTMLFormControlsCollection : public HTMLCollection {
WEB_PLATFORM_OBJECT(HTMLFormControlsCollection, HTMLCollection); WEB_PLATFORM_OBJECT(HTMLFormControlsCollection, HTMLCollection);
JS_DECLARE_ALLOCATOR(HTMLFormControlsCollection);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<HTMLFormControlsCollection> create(ParentNode& root, Scope, Function<bool(Element const&)> filter); [[nodiscard]] static JS::NonnullGCPtr<HTMLFormControlsCollection> create(ParentNode& root, Scope, Function<bool(Element const&)> filter);

View file

@ -12,6 +12,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(LiveNodeList);
JS::NonnullGCPtr<NodeList> LiveNodeList::create(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter) JS::NonnullGCPtr<NodeList> LiveNodeList::create(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter)
{ {
return realm.heap().allocate<LiveNodeList>(realm, realm, root, scope, move(filter)); return realm.heap().allocate<LiveNodeList>(realm, realm, root, scope, move(filter));

View file

@ -16,6 +16,7 @@ namespace Web::DOM {
class LiveNodeList : public NodeList { class LiveNodeList : public NodeList {
WEB_PLATFORM_OBJECT(LiveNodeList, NodeList); WEB_PLATFORM_OBJECT(LiveNodeList, NodeList);
JS_DECLARE_ALLOCATOR(LiveNodeList);
public: public:
enum class Scope { enum class Scope {

View file

@ -11,6 +11,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(MutationObserver);
WebIDL::ExceptionOr<JS::NonnullGCPtr<MutationObserver>> MutationObserver::construct_impl(JS::Realm& realm, JS::GCPtr<WebIDL::CallbackType> callback) WebIDL::ExceptionOr<JS::NonnullGCPtr<MutationObserver>> MutationObserver::construct_impl(JS::Realm& realm, JS::GCPtr<WebIDL::CallbackType> callback)
{ {
return realm.heap().allocate<MutationObserver>(realm, realm, callback); return realm.heap().allocate<MutationObserver>(realm, realm, callback);

View file

@ -29,6 +29,7 @@ struct MutationObserverInit {
// https://dom.spec.whatwg.org/#mutationobserver // https://dom.spec.whatwg.org/#mutationobserver
class MutationObserver final : public Bindings::PlatformObject { class MutationObserver final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(MutationObserver, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(MutationObserver, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(MutationObserver);
public: public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MutationObserver>> construct_impl(JS::Realm&, JS::GCPtr<WebIDL::CallbackType>); static WebIDL::ExceptionOr<JS::NonnullGCPtr<MutationObserver>> construct_impl(JS::Realm&, JS::GCPtr<WebIDL::CallbackType>);

View file

@ -12,6 +12,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(MutationRecord);
JS::NonnullGCPtr<MutationRecord> MutationRecord::create(JS::Realm& realm, FlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, Optional<String> const& attribute_name, Optional<String> const& attribute_namespace, Optional<String> const& old_value) JS::NonnullGCPtr<MutationRecord> MutationRecord::create(JS::Realm& realm, FlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, Optional<String> const& attribute_name, Optional<String> const& attribute_namespace, Optional<String> const& old_value)
{ {
return realm.heap().allocate<MutationRecord>(realm, realm, type, target, added_nodes, removed_nodes, previous_sibling, next_sibling, attribute_name, attribute_namespace, old_value); return realm.heap().allocate<MutationRecord>(realm, realm, type, target, added_nodes, removed_nodes, previous_sibling, next_sibling, attribute_name, attribute_namespace, old_value);

View file

@ -14,6 +14,7 @@ namespace Web::DOM {
// https://dom.spec.whatwg.org/#mutationrecord // https://dom.spec.whatwg.org/#mutationrecord
class MutationRecord : public Bindings::PlatformObject { class MutationRecord : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(MutationRecord, Bindings::PlatformObject); WEB_PLATFORM_OBJECT(MutationRecord, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(MutationRecord);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<MutationRecord> create(JS::Realm&, FlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, Optional<String> const& attribute_name, Optional<String> const& attribute_namespace, Optional<String> const& old_value); [[nodiscard]] static JS::NonnullGCPtr<MutationRecord> create(JS::Realm&, FlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, Optional<String> const& attribute_name, Optional<String> const& attribute_namespace, Optional<String> const& old_value);

View file

@ -13,6 +13,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(NamedNodeMap);
JS::NonnullGCPtr<NamedNodeMap> NamedNodeMap::create(Element& element) JS::NonnullGCPtr<NamedNodeMap> NamedNodeMap::create(Element& element)
{ {
auto& realm = element.realm(); auto& realm = element.realm();

View file

@ -20,6 +20,7 @@ namespace Web::DOM {
// https://dom.spec.whatwg.org/#interface-namednodemap // https://dom.spec.whatwg.org/#interface-namednodemap
class NamedNodeMap : public Bindings::LegacyPlatformObject { class NamedNodeMap : public Bindings::LegacyPlatformObject {
WEB_PLATFORM_OBJECT(NamedNodeMap, Bindings::LegacyPlatformObject); WEB_PLATFORM_OBJECT(NamedNodeMap, Bindings::LegacyPlatformObject);
JS_DECLARE_ALLOCATOR(NamedNodeMap);
public: public:
[[nodiscard]] static JS::NonnullGCPtr<NamedNodeMap> create(Element&); [[nodiscard]] static JS::NonnullGCPtr<NamedNodeMap> create(Element&);

View file

@ -10,6 +10,8 @@
namespace Web::DOM { namespace Web::DOM {
JS_DEFINE_ALLOCATOR(NodeFilter);
JS::NonnullGCPtr<NodeFilter> NodeFilter::create(JS::Realm& realm, WebIDL::CallbackType& callback) JS::NonnullGCPtr<NodeFilter> NodeFilter::create(JS::Realm& realm, WebIDL::CallbackType& callback)
{ {
return realm.heap().allocate<NodeFilter>(realm, realm, callback); return realm.heap().allocate<NodeFilter>(realm, realm, callback);

Some files were not shown because too many files have changed in this diff Show more