mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibJS+LibWeb: Make Console, ConsoleClient & subclasses GC-allocated
These objects had confusing ownership semantics. Let's just throw them all on the GC heap and stop worrying about it.
This commit is contained in:
parent
44659f2f2a
commit
4db1712f90
Notes:
sideshowbarker
2024-07-17 06:20:50 +09:00
Author: https://github.com/awesomekling
Commit: 4db1712f90
Pull-request: https://github.com/SerenityOS/serenity/pull/24035
Issue: https://github.com/SerenityOS/serenity/issues/14612
13 changed files with 95 additions and 34 deletions
|
@ -16,14 +16,22 @@ JS_DEFINE_ALLOCATOR(ConsoleObject);
|
|||
|
||||
ConsoleObject::ConsoleObject(Realm& realm)
|
||||
: Object(ConstructWithPrototypeTag::Tag, realm.intrinsics().object_prototype())
|
||||
, m_console(make<Console>(realm))
|
||||
{
|
||||
}
|
||||
|
||||
ConsoleObject::~ConsoleObject() = default;
|
||||
|
||||
void ConsoleObject::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_console);
|
||||
}
|
||||
|
||||
void ConsoleObject::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Base::initialize(realm);
|
||||
m_console = vm.heap().allocate<Console>(realm, realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Enumerable | Attribute::Configurable;
|
||||
define_native_function(realm, vm.names.assert, assert_, 0, attr);
|
||||
define_native_function(realm, vm.names.clear, clear, 0, attr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue