2024-12-26 11:56:03 +13:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2024-2025, Shannon Booth <shannon@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2025-06-11 18:51:22 +02:00
|
|
|
|
#include <LibGC/Heap.h>
|
2024-12-26 11:56:03 +13:00
|
|
|
|
#include <LibWeb/StorageAPI/StorageShelf.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::StorageAPI {
|
|
|
|
|
|
2025-06-11 18:51:22 +02:00
|
|
|
|
GC_DEFINE_ALLOCATOR(StorageShelf);
|
|
|
|
|
|
|
|
|
|
void StorageShelf::visit_edges(GC::Cell::Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
|
|
|
|
visitor.visit(m_bucket_map);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-26 11:56:03 +13:00
|
|
|
|
// https://storage.spec.whatwg.org/#create-a-storage-shelf
|
2025-06-08 23:35:46 +02:00
|
|
|
|
StorageShelf::StorageShelf(GC::Ref<Page> page, StorageKey key, StorageType type)
|
2024-12-26 11:56:03 +13:00
|
|
|
|
{
|
|
|
|
|
// 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.
|
2025-06-08 23:35:46 +02:00
|
|
|
|
m_bucket_map.set("default"_string, StorageBucket::create(heap(), page, key, type));
|
2024-12-26 11:56:03 +13:00
|
|
|
|
// 3. Return shelf.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|