Changeset 199078 in webkit
- Timestamp:
- Apr 5, 2016 3:55:33 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r199076 r199078 1 2016-04-05 Brady Eidson <beidson@apple.com> 2 3 Modern IDB: Get blob URLs/files all the way to the IDB backing store. 4 https://bugs.webkit.org/show_bug.cgi?id=156248 5 6 Reviewed by Alex Christensen. 7 8 No new tests (No change in behavior). 9 10 * Modules/indexeddb/IDBTransaction.cpp: 11 (WebCore::IDBTransaction::putOrAddOnServer): 12 13 * Modules/indexeddb/IDBValue.cpp: 14 (WebCore::IDBValue::IDBValue): 15 (WebCore::IDBValue::isolatedCopy): 16 * Modules/indexeddb/IDBValue.h: 17 (WebCore::IDBValue::blobURLs): 18 (WebCore::IDBValue::blobFilePaths): 19 (WebCore::IDBValue::encode): 20 (WebCore::IDBValue::decode): 21 22 * Modules/indexeddb/server/IDBBackingStore.h: 23 24 * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: 25 (WebCore::IDBServer::MemoryIDBBackingStore::addRecord): 26 * Modules/indexeddb/server/MemoryIDBBackingStore.h: 27 28 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 29 (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): 30 * Modules/indexeddb/server/SQLiteIDBBackingStore.h: 31 32 * Modules/indexeddb/server/UniqueIDBDatabase.cpp: 33 (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd): 34 35 * bindings/js/SerializedScriptValue.cpp: 36 (WebCore::SerializedScriptValue::writeBlobsToDiskForIndexedDB): 37 1 38 2016-03-19 Filip Pizlo <fpizlo@apple.com> 2 39 -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
r199072 r199078 878 878 RefPtr<IDBTransaction> protector(this); 879 879 RefPtr<IDBClient::TransactionOperation> operationRef(&operation); 880 value->writeBlobsToDiskForIndexedDB([protector, this, operationRef, key, value, overwriteMode](const IDBValue&) { 881 // FIXME: Send the passed in IDBValue to the IDB server instead of the SerializedScriptValue. 882 serverConnection().putOrAdd(*operationRef, key.get(), *value, overwriteMode); 880 value->writeBlobsToDiskForIndexedDB([protector, this, operationRef, key, value, overwriteMode](const IDBValue& idbValue) { 881 serverConnection().putOrAdd(*operationRef, key.get(), idbValue, overwriteMode); 883 882 }); 884 883 } -
trunk/Source/WebCore/Modules/indexeddb/IDBValue.cpp
r199072 r199078 42 42 } 43 43 44 IDBValue::IDBValue(const SerializedScriptValue& scriptValue, const Vector<String>& blobURLs, const Vector<String>& blobFilePaths) 45 : m_data(ThreadSafeDataBuffer::copyVector(scriptValue.data())) 46 , m_blobURLs(blobURLs) 47 , m_blobFilePaths(blobFilePaths) 48 { 49 } 50 44 51 IDBValue IDBValue::isolatedCopy() const 45 52 { 46 53 IDBValue result; 47 54 result.m_data = m_data; 55 56 result.m_blobURLs.reserveInitialCapacity(m_blobURLs.size()); 57 for (auto& url : m_blobURLs) 58 result.m_blobURLs.uncheckedAppend(url.isolatedCopy()); 59 60 result.m_blobFilePaths.reserveInitialCapacity(m_blobFilePaths.size()); 61 for (auto& path : m_blobFilePaths) 62 result.m_blobFilePaths.uncheckedAppend(path.isolatedCopy()); 63 48 64 return result; 49 65 } -
trunk/Source/WebCore/Modules/indexeddb/IDBValue.h
r199072 r199078 28 28 29 29 #include "ThreadSafeDataBuffer.h" 30 #include <wtf/text/WTFString.h> 30 31 31 32 namespace WebCore { … … 37 38 WEBCORE_EXPORT IDBValue(); 38 39 IDBValue(const SerializedScriptValue&); 40 IDBValue(const SerializedScriptValue&, const Vector<String>& blobURLs, const Vector<String>& blobFilePaths); 39 41 40 42 IDBValue isolatedCopy() const; 41 43 42 44 const ThreadSafeDataBuffer& data() const { return m_data; } 45 const Vector<String>& blobURLs() const { return m_blobURLs; } 46 const Vector<String>& blobFilePaths() const { return m_blobFilePaths; } 43 47 44 48 template<class Encoder> void encode(Encoder&) const; … … 47 51 private: 48 52 ThreadSafeDataBuffer m_data; 53 Vector<String> m_blobURLs; 54 Vector<String> m_blobFilePaths; 49 55 }; 50 56 … … 54 60 { 55 61 encoder << m_data; 62 encoder << m_blobURLs; 63 encoder << m_blobFilePaths; 56 64 } 57 65 … … 62 70 return false; 63 71 72 if (!decoder.decode(result.m_blobURLs)) 73 return false; 74 75 if (!decoder.decode(result.m_blobFilePaths)) 76 return false; 77 64 78 return true; 65 79 } -
trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h
r197474 r199078 68 68 virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) = 0; 69 69 virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) = 0; 70 virtual IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const ThreadSafeDataBuffer& value ) = 0;70 virtual IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const ThreadSafeDataBuffer& value, const Vector<String>& blobURLs, const Vector<String>& blobFilePaths) = 0; 71 71 virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, ThreadSafeDataBuffer& outValue) = 0; 72 72 virtual IDBError getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&, IDBGetResult& outValue) = 0; -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp
r197474 r199078 268 268 } 269 269 270 IDBError MemoryIDBBackingStore::addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& objectStoreInfo, const IDBKeyData& keyData, const ThreadSafeDataBuffer& value )270 IDBError MemoryIDBBackingStore::addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& objectStoreInfo, const IDBKeyData& keyData, const ThreadSafeDataBuffer& value, const Vector<String>&, const Vector<String>&) 271 271 { 272 272 LOG(IndexedDB, "MemoryIDBBackingStore::addRecord"); -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h
r197566 r199078 60 60 IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) final; 61 61 IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) final; 62 IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const ThreadSafeDataBuffer& value ) final;62 IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const ThreadSafeDataBuffer& value, const Vector<String>& blobURLs, const Vector<String>& blobFilePaths) final; 63 63 IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, ThreadSafeDataBuffer& outValue) final; 64 64 IDBError getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&, IDBGetResult& outValue) final; -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r198177 r199078 1283 1283 } 1284 1284 1285 IDBError SQLiteIDBBackingStore::addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& objectStoreInfo, const IDBKeyData& keyData, const ThreadSafeDataBuffer& value )1285 IDBError SQLiteIDBBackingStore::addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& objectStoreInfo, const IDBKeyData& keyData, const ThreadSafeDataBuffer& value, const Vector<String>&, const Vector<String>&) 1286 1286 { 1287 1287 LOG(IndexedDB, "SQLiteIDBBackingStore::addRecord - key %s, object store %" PRIu64, keyData.loggingString().utf8().data(), objectStoreInfo.identifier()); -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h
r197566 r199078 64 64 IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) final; 65 65 IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) final; 66 IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const ThreadSafeDataBuffer& value ) final;66 IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const ThreadSafeDataBuffer& value, const Vector<String>& blobURLs, const Vector<String>& blobFilePaths) final; 67 67 IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, ThreadSafeDataBuffer& outValue) final; 68 68 IDBError getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&, IDBGetResult& outValue) final; -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r199072 r199078 796 796 } 797 797 798 error = m_backingStore->addRecord(transactionIdentifier, *objectStoreInfo, usedKey, injectedRecordValue.data() ? injectedRecordValue : originalRecordValue.data() );798 error = m_backingStore->addRecord(transactionIdentifier, *objectStoreInfo, usedKey, injectedRecordValue.data() ? injectedRecordValue : originalRecordValue.data(), originalRecordValue.blobURLs(), originalRecordValue.blobFilePaths()); 799 799 if (!error.isNull()) { 800 800 m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r199059 r199078 2752 2752 { 2753 2753 ASSERT(isMainThread()); 2754 2755 if (m_blobURLs.isEmpty()) { 2756 completionHandler({ }); 2757 return; 2758 } 2754 ASSERT(hasBlobURLs()); 2759 2755 2760 2756 RefPtr<SerializedScriptValue> protector(this); 2761 blobRegistry().writeBlobsToTemporaryFiles(m_blobURLs, [completionHandler, this, protector](const Vector<String>&) { 2762 // FIXME: Return an IDBValue that contains both the SerializedScriptValue data and all blob file data. 2763 completionHandler({ }); 2757 blobRegistry().writeBlobsToTemporaryFiles(m_blobURLs, [completionHandler, this, protector](const Vector<String>& blobFilePaths) { 2758 ASSERT(isMainThread()); 2759 2760 if (blobFilePaths.isEmpty()) { 2761 // We should have successfully written blobs to temporary files. 2762 // If we failed, then we can't successfully store this record. 2763 completionHandler({ }); 2764 return; 2765 } 2766 2767 ASSERT(m_blobURLs.size() == blobFilePaths.size()); 2768 2769 completionHandler({ *this, m_blobURLs, blobFilePaths }); 2764 2770 }); 2765 2771 }
Note: See TracChangeset
for help on using the changeset viewer.