
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. :^)
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2023, Jonah Shafran <jonahshafran@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/CSS/CSSRule.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
class CSSNamespaceRule final : public CSSRule {
|
|
WEB_PLATFORM_OBJECT(CSSNamespaceRule, CSSRule);
|
|
JS_DECLARE_ALLOCATOR(CSSNamespaceRule);
|
|
|
|
public:
|
|
[[nodiscard]] static JS::NonnullGCPtr<CSSNamespaceRule> create(JS::Realm&, Optional<DeprecatedString> prefix, StringView namespace_uri);
|
|
|
|
virtual ~CSSNamespaceRule() = default;
|
|
|
|
void set_namespace_uri(DeprecatedString value) { m_namespace_uri = move(value); }
|
|
DeprecatedString namespace_uri() const { return m_namespace_uri; }
|
|
void set_prefix(DeprecatedString value) { m_prefix = move(value); }
|
|
DeprecatedString prefix() const { return m_prefix; }
|
|
virtual Type type() const override { return Type::Namespace; }
|
|
|
|
private:
|
|
CSSNamespaceRule(JS::Realm&, Optional<DeprecatedString> prefix, StringView namespace_uri);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
virtual DeprecatedString serialized() const override;
|
|
DeprecatedString m_namespace_uri;
|
|
DeprecatedString m_prefix;
|
|
};
|
|
|
|
}
|