mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 19:47:17 +02:00
LibWeb: Heap-allocate SerializationRecord in IndexedDB ObjectStoreRecord
Wrap the SerializationRecord (Vector<u8, 1024>) in an OwnPtr so that each ObjectStoreRecord is only ~16 bytes instead of ~1040+ bytes. This makes Vector operations on the records list dramatically cheaper since memmove now shifts pointers instead of kilobyte-sized buffers.
This commit is contained in:
committed by
Andreas Kling
parent
ea5c543322
commit
6564eff91c
Notes:
github-actions[bot]
2026-03-21 13:42:23 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/6564eff91c8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8546 Reviewed-by: https://github.com/tcl3
@@ -60,17 +60,17 @@ bool Index::has_record_with_key(GC::Ref<Key> key)
|
||||
}
|
||||
|
||||
// https://w3c.github.io/IndexedDB/#index-referenced-value
|
||||
HTML::SerializationRecord Index::referenced_value(IndexRecord const& index_record) const
|
||||
HTML::SerializationRecord const& Index::referenced_value(IndexRecord const& index_record) const
|
||||
{
|
||||
// Records in an index are said to have a referenced value.
|
||||
// This is the value of the record in the index’s referenced object store which has a key equal to the index’s record’s value.
|
||||
return m_object_store
|
||||
->records()
|
||||
.first_matching([&](auto const& store_record) {
|
||||
return Key::equals(store_record.key, index_record.value);
|
||||
})
|
||||
.value()
|
||||
.value;
|
||||
return *m_object_store
|
||||
->records()
|
||||
.first_matching([&](auto const& store_record) {
|
||||
return Key::equals(store_record.key, index_record.value);
|
||||
})
|
||||
.value()
|
||||
.value;
|
||||
}
|
||||
|
||||
void Index::clear_records()
|
||||
|
||||
Reference in New Issue
Block a user