void MemoryBackingStoreTransaction::recordValueChanged(MemoryObjectStore& objectStore, const IDBKeyData& key, ThreadSafeDataBuffer* value) { ASSERT(m_objectStores.contains(&objectStore)); if (m_isAborting) return; // If this object store had been cleared during the transaction, no point in recording this // individual key/value change as its entire key/value map will be restored upon abort. if (m_clearedKeyValueMaps.contains(&objectStore)) return; auto originalAddResult = m_originalValues.add(&objectStore, nullptr); if (originalAddResult.isNewEntry) originalAddResult.iterator->value = std::make_unique<KeyValueMap>(); auto* map = originalAddResult.iterator->value.get(); auto addResult = map->add(key, ThreadSafeDataBuffer()); if (!addResult.isNewEntry) return; if (value) addResult.iterator->value = *value; }
ThreadSafeDataBuffer MemoryObjectStore::valueForKeyRange(const IDBKeyRangeData& keyRangeData) const { LOG(IndexedDB, "MemoryObjectStore::valueForKey"); IDBKeyData key = lowestKeyWithRecordInRange(keyRangeData); if (key.isNull()) return ThreadSafeDataBuffer(); ASSERT(m_keyValueStore); return m_keyValueStore->get(key); }
void MemoryBackingStoreTransaction::recordValueChanged(MemoryObjectStore& objectStore, const IDBKeyData& key) { ASSERT(m_objectStores.contains(&objectStore)); if (m_isAborting) return; auto originalAddResult = m_originalValues.add(&objectStore, nullptr); if (originalAddResult.isNewEntry) originalAddResult.iterator->value = std::make_unique<KeyValueMap>(); auto* map = originalAddResult.iterator->value.get(); auto addResult = map->add(key, ThreadSafeDataBuffer()); if (!addResult.isNewEntry) return; addResult.iterator->value = objectStore.valueForKey(key); }
CrossThreadCopierBase<false, false, ThreadSafeDataBuffer>::Type CrossThreadCopierBase<false, false, ThreadSafeDataBuffer>::copy(const ThreadSafeDataBuffer& buffer) { return ThreadSafeDataBuffer(buffer); }