mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-07 09:31:53 +00:00
LibWeb: Change Storage{Bottle,Bucket,Shelf} to be GC-allocated
In upcoming changes StorageBottle will own pointers to GC-allocated objects, so it needs to be a GC-allocated object itself to avoid introducing more GC roots.
This commit is contained in:
parent
70a29f36c6
commit
f53559cb55
Notes:
github-actions[bot]
2025-06-12 15:06:02 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: f53559cb55
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5052
Reviewed-by: https://github.com/shannonbooth ✅
Reviewed-by: https://github.com/trflynn89
12 changed files with 117 additions and 44 deletions
|
@ -25,12 +25,12 @@ static HashTable<GC::RawRef<Storage>>& all_storages()
|
|||
return storages;
|
||||
}
|
||||
|
||||
GC::Ref<Storage> Storage::create(JS::Realm& realm, Type type, NonnullRefPtr<StorageAPI::StorageBottle> storage_bottle)
|
||||
GC::Ref<Storage> Storage::create(JS::Realm& realm, Type type, GC::Ref<StorageAPI::StorageBottle> storage_bottle)
|
||||
{
|
||||
return realm.create<Storage>(realm, type, move(storage_bottle));
|
||||
}
|
||||
|
||||
Storage::Storage(JS::Realm& realm, Type type, NonnullRefPtr<StorageAPI::StorageBottle> storage_bottle)
|
||||
Storage::Storage(JS::Realm& realm, Type type, GC::Ref<StorageAPI::StorageBottle> storage_bottle)
|
||||
: Bindings::PlatformObject(realm)
|
||||
, m_type(type)
|
||||
, m_storage_bottle(move(storage_bottle))
|
||||
|
@ -65,6 +65,12 @@ void Storage::finalize()
|
|||
all_storages().remove(*this);
|
||||
}
|
||||
|
||||
void Storage::visit_edges(GC::Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_storage_bottle);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-length
|
||||
size_t Storage::length() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue