mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-24 00:49:46 +00:00
LibWeb/IDB: Implement retrieve_multiple_items_from_an_object_store
This commit is contained in:
parent
752210aec1
commit
839ffd45f3
Notes:
github-actions[bot]
2025-08-27 14:15:36 +00:00
Author: https://github.com/stelar7
Commit: 839ffd45f3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5385
Reviewed-by: https://github.com/gmta ✅
4 changed files with 95 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue