mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-23 16:40:03 +00:00
LibWeb/IDB: Move Records and give more descriptive names
This commit is contained in:
parent
87af53a613
commit
fe5d5639ef
Notes:
github-actions[bot]
2025-08-27 14:15:50 +00:00
Author: https://github.com/stelar7
Commit: fe5d5639ef
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5385
Reviewed-by: https://github.com/gmta ✅
5 changed files with 55 additions and 38 deletions
|
@ -18,17 +18,12 @@
|
|||
#include <LibWeb/IndexedDB/Internal/Database.h>
|
||||
#include <LibWeb/IndexedDB/Internal/Index.h>
|
||||
#include <LibWeb/IndexedDB/Internal/KeyGenerator.h>
|
||||
#include <LibWeb/IndexedDB/Internal/Record.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
||||
using KeyPath = Variant<String, Vector<String>>;
|
||||
|
||||
// https://w3c.github.io/IndexedDB/#object-store-record
|
||||
struct Record {
|
||||
GC::Ref<Key> key;
|
||||
HTML::SerializationRecord value;
|
||||
};
|
||||
|
||||
// https://w3c.github.io/IndexedDB/#object-store-construct
|
||||
class ObjectStore : public JS::Cell {
|
||||
GC_CELL(ObjectStore, JS::Cell);
|
||||
|
@ -48,15 +43,15 @@ public:
|
|||
AK::HashMap<String, GC::Ref<Index>>& index_set() { return m_indexes; }
|
||||
|
||||
GC::Ref<Database> database() const { return m_database; }
|
||||
ReadonlySpan<Record> records() const { return m_records; }
|
||||
ReadonlySpan<ObjectStoreRecord> records() const { return m_records; }
|
||||
|
||||
void remove_records_in_range(GC::Ref<IDBKeyRange> range);
|
||||
bool has_record_with_key(GC::Ref<Key> key);
|
||||
void store_a_record(Record const& record);
|
||||
void store_a_record(ObjectStoreRecord const& record);
|
||||
u64 count_records_in_range(GC::Ref<IDBKeyRange> range);
|
||||
Optional<Record&> first_in_range(GC::Ref<IDBKeyRange> range);
|
||||
Optional<ObjectStoreRecord&> first_in_range(GC::Ref<IDBKeyRange> range);
|
||||
void clear_records();
|
||||
GC::ConservativeVector<Record> first_n_in_range(GC::Ref<IDBKeyRange> range, Optional<WebIDL::UnsignedLong> count);
|
||||
GC::ConservativeVector<ObjectStoreRecord> first_n_in_range(GC::Ref<IDBKeyRange> range, Optional<WebIDL::UnsignedLong> count);
|
||||
|
||||
protected:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
@ -80,7 +75,7 @@ private:
|
|||
Optional<KeyGenerator> m_key_generator;
|
||||
|
||||
// An object store has a list of records
|
||||
Vector<Record> m_records;
|
||||
Vector<ObjectStoreRecord> m_records;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue