mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
LibWeb: Make TextEncoder GC-allocated
This commit is contained in:
parent
57db2529cf
commit
7e508456a0
4 changed files with 25 additions and 21 deletions
|
@ -16,21 +16,13 @@
|
|||
namespace Web::Encoding {
|
||||
|
||||
// https://encoding.spec.whatwg.org/#textencoder
|
||||
class TextEncoder
|
||||
: public RefCounted<TextEncoder>
|
||||
, public Bindings::Wrappable {
|
||||
class TextEncoder final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(TextEncoder, Bindings::PlatformObject);
|
||||
|
||||
public:
|
||||
using WrapperType = Bindings::TextEncoderWrapper;
|
||||
static JS::NonnullGCPtr<TextEncoder> create_with_global_object(HTML::Window&);
|
||||
|
||||
static NonnullRefPtr<TextEncoder> create()
|
||||
{
|
||||
return adopt_ref(*new TextEncoder());
|
||||
}
|
||||
|
||||
static NonnullRefPtr<TextEncoder> create_with_global_object(HTML::Window&)
|
||||
{
|
||||
return TextEncoder::create();
|
||||
}
|
||||
virtual ~TextEncoder() override;
|
||||
|
||||
JS::Uint8Array* encode(String const& input) const;
|
||||
|
||||
|
@ -38,7 +30,9 @@ public:
|
|||
|
||||
protected:
|
||||
// https://encoding.spec.whatwg.org/#dom-textencoder
|
||||
TextEncoder() = default;
|
||||
explicit TextEncoder(HTML::Window&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(TextEncoder, Web::Encoding)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue