mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +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
|
@ -4,16 +4,25 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGC/Heap.h>
|
||||
#include <LibWeb/StorageAPI/StorageShelf.h>
|
||||
|
||||
namespace Web::StorageAPI {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(StorageShelf);
|
||||
|
||||
void StorageShelf::visit_edges(GC::Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_bucket_map);
|
||||
}
|
||||
|
||||
// https://storage.spec.whatwg.org/#create-a-storage-shelf
|
||||
StorageShelf::StorageShelf(StorageType type)
|
||||
{
|
||||
// 1. Let shelf be a new storage shelf.
|
||||
// 2. Set shelf’s bucket map["default"] to the result of running create a storage bucket with type.
|
||||
bucket_map.set("default"_string, StorageBucket { type });
|
||||
m_bucket_map.set("default"_string, StorageBucket::create(heap(), type));
|
||||
// 3. Return shelf.
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue