LibWeb/IDB: Implement retrieve_multiple_items_from_an_object_store

This commit is contained in:
stelar7 2025-07-09 11:52:44 +02:00 committed by Jelle Raaijmakers
commit 839ffd45f3
Notes: github-actions[bot] 2025-08-27 14:15:36 +00:00
4 changed files with 95 additions and 0 deletions

View file

@ -103,4 +103,18 @@ GC::ConservativeVector<ObjectStoreRecord> ObjectStore::first_n_in_range(GC::Ref<
return records;
}
GC::ConservativeVector<ObjectStoreRecord> ObjectStore::last_n_in_range(GC::Ref<IDBKeyRange> range, Optional<WebIDL::UnsignedLong> count)
{
GC::ConservativeVector<ObjectStoreRecord> records(range->heap());
for (auto const& record : m_records.in_reverse()) {
if (range->is_in_range(record.key))
records.append(record);
if (count.has_value() && records.size() >= *count)
break;
}
return records;
}
}