/* * Copyright (c) 2024-2025, Shannon Booth * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace Web::StorageAPI { // https://storage.spec.whatwg.org/#storage-shelf // A storage shelf exists for each storage key within a storage shed. It holds a bucket map, which is a map of strings to storage buckets. using BucketMap = OrderedHashMap>; class StorageShelf : public GC::Cell { GC_CELL(StorageShelf, GC::Cell); GC_DECLARE_ALLOCATOR(StorageShelf); public: static GC::Ref create(GC::Heap& heap, GC::Ref page, StorageKey key, StorageType type) { return heap.allocate(page, key, type); } BucketMap& bucket_map() { return m_bucket_map; } BucketMap const& bucket_map() const { return m_bucket_map; } virtual void visit_edges(GC::Cell::Visitor& visitor) override; private: explicit StorageShelf(GC::Ref, StorageKey, StorageType); BucketMap m_bucket_map; }; }