
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, Tim Flynn <trflynn89@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
#include <LibWeb/Bindings/ToggleEventPrototype.h>
|
|
#include <LibWeb/HTML/ToggleEvent.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
JS_DEFINE_ALLOCATOR(ToggleEvent);
|
|
|
|
JS::NonnullGCPtr<ToggleEvent> ToggleEvent::create(JS::Realm& realm, FlyString const& event_name, ToggleEventInit event_init)
|
|
{
|
|
return realm.heap().allocate<ToggleEvent>(realm, realm, event_name, move(event_init));
|
|
}
|
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<ToggleEvent>> ToggleEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, ToggleEventInit event_init)
|
|
{
|
|
return create(realm, event_name, move(event_init));
|
|
}
|
|
|
|
ToggleEvent::ToggleEvent(JS::Realm& realm, FlyString const& event_name, ToggleEventInit event_init)
|
|
: DOM::Event(realm, event_name, event_init)
|
|
, m_old_state(move(event_init.old_state))
|
|
, m_new_state(move(event_init.new_state))
|
|
{
|
|
}
|
|
|
|
void ToggleEvent::initialize(JS::Realm& realm)
|
|
{
|
|
Base::initialize(realm);
|
|
set_prototype(&Bindings::ensure_web_prototype<Bindings::ToggleEventPrototype>(realm, "ToggleEvent"));
|
|
}
|
|
|
|
}
|