mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-08 04:02:52 +00:00
Instead of storing all storage objects in static memory, we now follow the the spec by lazily creating a unique Storage object on each document object. Each Storage object now holds a 'proxy' to the underlying backing storage. For now, this proxy is simply a reference to the backing object. In the future, it will need to be some type of interface object that stores on a SQLite database or similar. Session storage is now correctly stored / tracked as part of the TraversableNavigable object. Local storage is still stored in a static map, but eventually this should be factored into something that is stored at the user agent level.
29 lines
722 B
C++
29 lines
722 B
C++
/*
|
|
* Copyright (c) 2024-2025, Shannon Booth <shannon@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/HashMap.h>
|
|
#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.
|
|
class StorageShed {
|
|
public:
|
|
Optional<StorageShelf&> obtain_a_storage_shelf(HTML::EnvironmentSettingsObject const&, StorageType);
|
|
|
|
private:
|
|
OrderedHashMap<StorageKey, StorageShelf> m_data;
|
|
};
|
|
|
|
StorageShed& user_agent_storage_shed();
|
|
|
|
}
|