Changeset 248377 in webkit
- Timestamp:
- Aug 7, 2019 11:05:12 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r248376 r248377 1 2019-08-07 Youenn Fablet <youenn@apple.com> 2 3 Remove IDBDatabaseIdentifier::m_sessionID 4 https://bugs.webkit.org/show_bug.cgi?id=200489 5 6 Reviewed by Darin Adler. 7 8 IDBDatabaseIdentifier can be created without a valid session ID. 9 Its session ID is only used in NetworkProcess where it can be retrieved from the IDBServer. 10 In WebProcess, session ID is also known from the IDB connection. 11 Update SQLiteIDBBackingStore to store a session ID which is given from its IDBServer. 12 No observable change of behavior. 13 14 * Modules/indexeddb/IDBDatabaseIdentifier.cpp: 15 (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier): 16 (WebCore::IDBDatabaseIdentifier::isolatedCopy const): 17 * Modules/indexeddb/IDBDatabaseIdentifier.h: 18 (WebCore::IDBDatabaseIdentifier::hash const): 19 (WebCore::IDBDatabaseIdentifier::databaseName const): 20 (WebCore::IDBDatabaseIdentifier::encode const): 21 (WebCore::IDBDatabaseIdentifier::decode): 22 (WebCore::IDBDatabaseIdentifier::sessionID const): Deleted. 23 * Modules/indexeddb/IDBFactory.cpp: 24 (WebCore::IDBFactory::openInternal): 25 (WebCore::IDBFactory::deleteDatabase): 26 * Modules/indexeddb/server/IDBServer.cpp: 27 (WebCore::IDBServer::IDBServer::createBackingStore): 28 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 29 (WebCore::IDBServer::SQLiteIDBBackingStore::SQLiteIDBBackingStore): 30 (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord): 31 (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord): 32 (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords): 33 (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey): 34 * Modules/indexeddb/server/SQLiteIDBBackingStore.h: 35 (WebCore::IDBServer::SQLiteIDBBackingStore::sessionID const): 36 * Modules/indexeddb/server/SQLiteIDBCursor.cpp: 37 (WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord): 38 1 39 2019-08-07 Chris Dumez <cdumez@apple.com> 2 40 -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp
r243019 r248377 36 36 namespace WebCore { 37 37 38 IDBDatabaseIdentifier::IDBDatabaseIdentifier(const String& databaseName, const PAL::SessionID& sessionID,SecurityOriginData&& openingOrigin, SecurityOriginData&& mainFrameOrigin)38 IDBDatabaseIdentifier::IDBDatabaseIdentifier(const String& databaseName, SecurityOriginData&& openingOrigin, SecurityOriginData&& mainFrameOrigin) 39 39 : m_databaseName(databaseName) 40 , m_sessionID(sessionID)41 40 , m_origin { WTFMove(openingOrigin), WTFMove(mainFrameOrigin) } 42 41 { … … 50 49 51 50 identifier.m_databaseName = m_databaseName.isolatedCopy(); 52 identifier.m_sessionID = m_sessionID.isolatedCopy();53 51 identifier.m_origin = m_origin.isolatedCopy(); 54 52 -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h
r243163 r248377 46 46 } 47 47 48 WEBCORE_EXPORT IDBDatabaseIdentifier(const String& databaseName, const PAL::SessionID&,SecurityOriginData&& openingOrigin, SecurityOriginData&& mainFrameOrigin);48 WEBCORE_EXPORT IDBDatabaseIdentifier(const String& databaseName, SecurityOriginData&& openingOrigin, SecurityOriginData&& mainFrameOrigin); 49 49 50 50 IDBDatabaseIdentifier isolatedCopy() const; … … 58 58 { 59 59 unsigned nameHash = StringHash::hash(m_databaseName); 60 unsigned sessionIDHash = WTF::SessionIDHash::hash(m_sessionID);61 60 unsigned originHash = m_origin.hash(); 62 61 63 unsigned hashCodes[ 3] = { nameHash, sessionIDHash, originHash };62 unsigned hashCodes[2] = { nameHash, originHash }; 64 63 return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); 65 64 } … … 82 81 83 82 const String& databaseName() const { return m_databaseName; } 84 const PAL::SessionID& sessionID() const { return m_sessionID; }85 83 const ClientOrigin& origin() const { return m_origin; } 86 84 … … 99 97 private: 100 98 String m_databaseName; 101 PAL::SessionID m_sessionID;102 99 ClientOrigin m_origin; 103 100 SecurityOriginData m_mainFrameOrigin; … … 119 116 void IDBDatabaseIdentifier::encode(Encoder& encoder) const 120 117 { 121 encoder << m_databaseName << m_ sessionID << m_origin;118 encoder << m_databaseName << m_origin; 122 119 } 123 120 … … 130 127 return WTF::nullopt; 131 128 132 Optional<PAL::SessionID> sessionID;133 decoder >> sessionID;134 if (!sessionID)135 return WTF::nullopt;136 137 129 Optional<ClientOrigin> origin; 138 130 decoder >> origin; … … 142 134 IDBDatabaseIdentifier identifier; 143 135 identifier.m_databaseName = WTFMove(*databaseName); // FIXME: When decoding from IPC, databaseName can be null, and the non-empty constructor asserts that this is not the case. 144 identifier.m_sessionID = WTFMove(*sessionID);145 136 identifier.m_origin = WTFMove(*origin); 146 137 return identifier; -
trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp
r243348 r248377 92 92 93 93 ASSERT(context.securityOrigin()); 94 IDBDatabaseIdentifier databaseIdentifier(name, context.sessionID(),SecurityOriginData { context.securityOrigin()->data() }, SecurityOriginData { context.topOrigin().data() });94 IDBDatabaseIdentifier databaseIdentifier(name, SecurityOriginData { context.securityOrigin()->data() }, SecurityOriginData { context.topOrigin().data() }); 95 95 if (!databaseIdentifier.isValid()) 96 96 return Exception { TypeError, "IDBFactory.open() called with an invalid security origin"_s }; … … 112 112 113 113 ASSERT(context.securityOrigin()); 114 IDBDatabaseIdentifier databaseIdentifier(name, context.sessionID(),SecurityOriginData { context.securityOrigin()->data() }, SecurityOriginData { context.topOrigin().data() });114 IDBDatabaseIdentifier databaseIdentifier(name, SecurityOriginData { context.securityOrigin()->data() }, SecurityOriginData { context.topOrigin().data() }); 115 115 if (!databaseIdentifier.isValid()) 116 116 return Exception { TypeError, "IDBFactory.deleteDatabase() called with an invalid security origin"_s }; -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
r245871 r248377 136 136 return MemoryIDBBackingStore::create(identifier); 137 137 138 return std::make_unique<SQLiteIDBBackingStore>( identifier, m_databaseDirectoryPath, m_backingStoreTemporaryFileHandler, m_perOriginQuota);138 return std::make_unique<SQLiteIDBBackingStore>(m_sessionID, identifier, m_databaseDirectoryPath, m_backingStoreTemporaryFileHandler, m_perOriginQuota); 139 139 } 140 140 -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r246922 r248377 229 229 } 230 230 231 SQLiteIDBBackingStore::SQLiteIDBBackingStore(const IDBDatabaseIdentifier& identifier, const String& databaseRootDirectory, IDBBackingStoreTemporaryFileHandler& fileHandler, uint64_t quota) 232 : m_identifier(identifier) 231 SQLiteIDBBackingStore::SQLiteIDBBackingStore(PAL::SessionID sessionID, const IDBDatabaseIdentifier& identifier, const String& databaseRootDirectory, IDBBackingStoreTemporaryFileHandler& fileHandler, uint64_t quota) 232 : m_sessionID(sessionID) 233 , m_identifier(identifier) 233 234 , m_databaseRootDirectory(databaseRootDirectory) 234 235 , m_temporaryFileHandler(fileHandler) … … 1906 1907 } 1907 1908 1908 IDBError SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord(int64_t objectStoreRecord, Vector<String>& blobURLs, PAL::SessionID& sessionID,Vector<String>& blobFilePaths)1909 IDBError SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord(int64_t objectStoreRecord, Vector<String>& blobURLs, Vector<String>& blobFilePaths) 1909 1910 { 1910 1911 ASSERT(objectStoreRecord); … … 1955 1956 blobFilePaths.append(FileSystem::pathByAppendingComponent(m_databaseDirectory, fileName)); 1956 1957 } 1957 sessionID = m_identifier.sessionID();1958 1959 1958 return IDBError { }; 1960 1959 } … … 2083 2082 ASSERT(recordID); 2084 2083 Vector<String> blobURLs, blobFilePaths; 2085 PAL::SessionID sessionID; 2086 auto error = getBlobRecordsForObjectStoreRecord(recordID, blobURLs, sessionID, blobFilePaths); 2084 auto error = getBlobRecordsForObjectStoreRecord(recordID, blobURLs, blobFilePaths); 2087 2085 ASSERT(blobURLs.size() == blobFilePaths.size()); 2088 2086 … … 2092 2090 auto* objectStoreInfo = infoForObjectStore(objectStoreID); 2093 2091 ASSERT(objectStoreInfo); 2094 resultValue = { keyData, { valueResultBuffer, WTFMove(blobURLs), sessionID, WTFMove(blobFilePaths) }, objectStoreInfo->keyPath()};2092 resultValue = { keyData, { valueResultBuffer, WTFMove(blobURLs), m_sessionID, WTFMove(blobFilePaths) }, objectStoreInfo->keyPath()}; 2095 2093 return IDBError { }; 2096 2094 } … … 2205 2203 ASSERT(recordID); 2206 2204 Vector<String> blobURLs, blobFilePaths; 2207 PAL::SessionID sessionID; 2208 auto error = getBlobRecordsForObjectStoreRecord(recordID, blobURLs, sessionID, blobFilePaths); 2205 auto error = getBlobRecordsForObjectStoreRecord(recordID, blobURLs, blobFilePaths); 2209 2206 ASSERT(blobURLs.size() == blobFilePaths.size()); 2210 2207 … … 2212 2209 return error; 2213 2210 2214 result.addValue({ valueResultBuffer, WTFMove(blobURLs), sessionID, WTFMove(blobFilePaths) });2211 result.addValue({ valueResultBuffer, WTFMove(blobURLs), m_sessionID, WTFMove(blobFilePaths) }); 2215 2212 } 2216 2213 … … 2367 2364 int64_t recordID = sql->getColumnInt64(2); 2368 2365 Vector<String> blobURLs, blobFilePaths; 2369 PAL::SessionID sessionID; 2370 auto error = getBlobRecordsForObjectStoreRecord(recordID, blobURLs, sessionID, blobFilePaths); 2366 auto error = getBlobRecordsForObjectStoreRecord(recordID, blobURLs, blobFilePaths); 2371 2367 ASSERT(blobURLs.size() == blobFilePaths.size()); 2372 2368 … … 2376 2372 auto* objectStoreInfo = infoForObjectStore(objectStoreID); 2377 2373 ASSERT(objectStoreInfo); 2378 getResult = { objectStoreKey, objectStoreKey, { ThreadSafeDataBuffer::create(WTFMove(valueVector)), WTFMove(blobURLs), sessionID, WTFMove(blobFilePaths) }, objectStoreInfo->keyPath() };2374 getResult = { objectStoreKey, objectStoreKey, { ThreadSafeDataBuffer::create(WTFMove(valueVector)), WTFMove(blobURLs), m_sessionID, WTFMove(blobFilePaths) }, objectStoreInfo->keyPath() }; 2379 2375 return IDBError { }; 2380 2376 } -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h
r244687 r248377 49 49 WTF_MAKE_FAST_ALLOCATED; 50 50 public: 51 SQLiteIDBBackingStore( const IDBDatabaseIdentifier&, const String& databaseRootDirectory, IDBBackingStoreTemporaryFileHandler&, uint64_t quota);51 SQLiteIDBBackingStore(PAL::SessionID, const IDBDatabaseIdentifier&, const String& databaseRootDirectory, IDBBackingStoreTemporaryFileHandler&, uint64_t quota); 52 52 53 53 ~SQLiteIDBBackingStore() final; … … 92 92 IDBBackingStoreTemporaryFileHandler& temporaryFileHandler() const { return m_temporaryFileHandler; } 93 93 94 IDBError getBlobRecordsForObjectStoreRecord(int64_t objectStoreRecord, Vector<String>& blobURLs, PAL::SessionID&,Vector<String>& blobFilePaths);94 IDBError getBlobRecordsForObjectStoreRecord(int64_t objectStoreRecord, Vector<String>& blobURLs, Vector<String>& blobFilePaths); 95 95 96 96 static String databaseNameFromEncodedFilename(const String&); … … 102 102 103 103 bool hasTransaction(const IDBResourceIdentifier&) const final; 104 105 PAL::SessionID sessionID() const { return m_sessionID; } 106 104 107 private: 105 108 String filenameForDatabaseName() const; … … 192 195 void initializeVM(); 193 196 197 PAL::SessionID m_sessionID; 194 198 IDBDatabaseIdentifier m_identifier; 195 199 std::unique_ptr<IDBDatabaseInfo> m_databaseInfo; -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp
r244436 r248377 457 457 458 458 Vector<String> blobURLs, blobFilePaths; 459 PAL::SessionID sessionID; 460 auto error = m_transaction->backingStore().getBlobRecordsForObjectStoreRecord(record.rowID, blobURLs, sessionID, blobFilePaths); 459 auto error = m_transaction->backingStore().getBlobRecordsForObjectStoreRecord(record.rowID, blobURLs, blobFilePaths); 461 460 if (!error.isNull()) { 462 461 LOG_ERROR("Unable to fetch blob records from database while advancing cursor"); … … 466 465 467 466 if (m_cursorType == IndexedDB::CursorType::KeyAndValue) 468 record.record.value = std::make_unique<IDBValue>(ThreadSafeDataBuffer::create(WTFMove(keyData)), blobURLs, sessionID, blobFilePaths);467 record.record.value = std::make_unique<IDBValue>(ThreadSafeDataBuffer::create(WTFMove(keyData)), blobURLs, m_transaction->backingStore().sessionID(), blobFilePaths); 469 468 } else { 470 469 if (!deserializeIDBKeyData(keyData.data(), keyData.size(), record.record.primaryKey)) {
Note: See TracChangeset
for help on using the changeset viewer.