2024-12-26 11:56:03 +13:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024-2025, Shannon Booth <shannon@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/HashMap.h>
|
2025-06-11 18:51:22 +02:00
|
|
|
#include <LibGC/Ptr.h>
|
2024-12-26 11:56:03 +13:00
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
#include <LibWeb/StorageAPI/StorageKey.h>
|
|
|
|
#include <LibWeb/StorageAPI/StorageShelf.h>
|
|
|
|
#include <LibWeb/StorageAPI/StorageType.h>
|
|
|
|
|
|
|
|
namespace Web::StorageAPI {
|
|
|
|
|
|
|
|
// https://storage.spec.whatwg.org/#storage-shed
|
|
|
|
// A storage shed is a map of storage keys to storage shelves. It is initially empty.
|
2025-06-11 18:51:22 +02:00
|
|
|
class StorageShed : public GC::Cell {
|
|
|
|
GC_CELL(StorageShed, GC::Cell);
|
|
|
|
GC_DECLARE_ALLOCATOR(StorageShed);
|
|
|
|
|
2024-12-26 11:56:03 +13:00
|
|
|
public:
|
2025-06-11 18:51:22 +02:00
|
|
|
static GC::Ref<StorageShed> create(GC::Heap& heap) { return heap.allocate<StorageShed>(); }
|
|
|
|
|
2025-06-08 23:35:46 +02:00
|
|
|
GC::Ptr<StorageShelf> obtain_a_storage_shelf(HTML::EnvironmentSettingsObject&, StorageType);
|
2025-06-11 18:51:22 +02:00
|
|
|
|
|
|
|
virtual void visit_edges(GC::Cell::Visitor& visitor) override;
|
2024-12-26 11:56:03 +13:00
|
|
|
|
|
|
|
private:
|
2025-06-11 18:51:22 +02:00
|
|
|
StorageShed() = default;
|
|
|
|
|
|
|
|
OrderedHashMap<StorageKey, GC::Ref<StorageShelf>> m_data;
|
2024-12-26 11:56:03 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|