Changeset 252787 in webkit
- Timestamp:
- Nov 22, 2019, 11:14:21 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
-
ChangeLog (modified) (1 diff)
-
Modules/indexeddb/server/IDBBackingStore.h (modified) (1 diff)
-
Modules/indexeddb/server/IDBServer.cpp (modified) (2 diffs)
-
Modules/indexeddb/server/IDBServer.h (modified) (3 diffs)
-
Modules/indexeddb/server/MemoryIDBBackingStore.cpp (modified) (25 diffs)
-
Modules/indexeddb/server/MemoryIDBBackingStore.h (modified) (1 diff)
-
Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (modified) (28 diffs)
-
Modules/indexeddb/server/SQLiteIDBBackingStore.h (modified) (3 diffs)
-
Modules/indexeddb/server/UniqueIDBDatabase.cpp (modified) (28 diffs)
-
Modules/indexeddb/server/UniqueIDBDatabase.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252785 r252787 1 2019-11-22 Sihui Liu <sihui_liu@apple.com> 2 3 IndexedDB: lock-based implementation of suspension 4 https://bugs.webkit.org/show_bug.cgi?id=204379 5 6 Reviewed by Geoffrey Garen. 7 8 Covered by existing API test: IndexedDB.IndexedDBSuspendImminently 9 10 * Modules/indexeddb/server/IDBBackingStore.h: 11 * Modules/indexeddb/server/IDBServer.cpp: 12 (WebCore::IDBServer::IDBServer::tryStop): 13 (WebCore::IDBServer::IDBServer::resume): 14 * Modules/indexeddb/server/IDBServer.h: 15 (WebCore::IDBServer::IDBServer::addDatabase): 16 (WebCore::IDBServer::IDBServer::removeDatabase): 17 * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: 18 (WebCore::IDBServer::MemoryIDBBackingStore::getOrEstablishDatabaseInfo): 19 (WebCore::IDBServer::MemoryIDBBackingStore::beginTransaction): 20 (WebCore::IDBServer::MemoryIDBBackingStore::abortTransaction): 21 (WebCore::IDBServer::MemoryIDBBackingStore::commitTransaction): 22 (WebCore::IDBServer::MemoryIDBBackingStore::createObjectStore): 23 (WebCore::IDBServer::MemoryIDBBackingStore::deleteObjectStore): 24 (WebCore::IDBServer::MemoryIDBBackingStore::renameObjectStore): 25 (WebCore::IDBServer::MemoryIDBBackingStore::clearObjectStore): 26 (WebCore::IDBServer::MemoryIDBBackingStore::createIndex): 27 (WebCore::IDBServer::MemoryIDBBackingStore::deleteIndex): 28 (WebCore::IDBServer::MemoryIDBBackingStore::renameIndex): 29 (WebCore::IDBServer::MemoryIDBBackingStore::keyExistsInObjectStore): 30 (WebCore::IDBServer::MemoryIDBBackingStore::deleteRange): 31 (WebCore::IDBServer::MemoryIDBBackingStore::addRecord): 32 (WebCore::IDBServer::MemoryIDBBackingStore::getRecord): 33 (WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords): 34 (WebCore::IDBServer::MemoryIDBBackingStore::getIndexRecord): 35 (WebCore::IDBServer::MemoryIDBBackingStore::getCount): 36 (WebCore::IDBServer::MemoryIDBBackingStore::generateKeyNumber): 37 (WebCore::IDBServer::MemoryIDBBackingStore::revertGeneratedKeyNumber): 38 (WebCore::IDBServer::MemoryIDBBackingStore::maybeUpdateKeyGeneratorNumber): 39 (WebCore::IDBServer::MemoryIDBBackingStore::openCursor): 40 (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor): 41 (WebCore::IDBServer::MemoryIDBBackingStore::infoForObjectStore): 42 (WebCore::IDBServer::MemoryIDBBackingStore::deleteBackingStore): 43 (WebCore::IDBServer::MemoryIDBBackingStore::close): 44 (WebCore::IDBServer::MemoryIDBBackingStore::databaseSize const): Deleted. 45 * Modules/indexeddb/server/MemoryIDBBackingStore.h: 46 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 47 (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo): 48 (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction): 49 (WebCore::IDBServer::SQLiteIDBBackingStore::abortTransaction): 50 (WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction): 51 (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore): 52 (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore): 53 (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore): 54 (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore): 55 (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): 56 (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex): 57 (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex): 58 (WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore): 59 (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange): 60 (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): 61 (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord): 62 (WebCore::IDBServer::SQLiteIDBBackingStore::getAllRecords): 63 (WebCore::IDBServer::SQLiteIDBBackingStore::getIndexRecord): 64 (WebCore::IDBServer::SQLiteIDBBackingStore::getCount): 65 (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber): 66 (WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber): 67 (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber): 68 (WebCore::IDBServer::SQLiteIDBBackingStore::openCursor): 69 (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor): 70 (WebCore::IDBServer::SQLiteIDBBackingStore::prefetchCursor): 71 (WebCore::IDBServer::SQLiteIDBBackingStore::infoForObjectStore): 72 (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore): 73 (WebCore::IDBServer::SQLiteIDBBackingStore::close): 74 (WebCore::IDBServer::SQLiteIDBBackingStore::hasTransaction const): 75 (WebCore::IDBServer::SQLiteIDBBackingStore::databaseSize const): Deleted. 76 * Modules/indexeddb/server/SQLiteIDBBackingStore.h: 77 * Modules/indexeddb/server/UniqueIDBDatabase.cpp: 78 (WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase): 79 (WebCore::IDBServer::UniqueIDBDatabase::~UniqueIDBDatabase): 80 (WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore): 81 (WebCore::IDBServer::UniqueIDBDatabase::performUnconditionalDeleteBackingStore): 82 (WebCore::IDBServer::UniqueIDBDatabase::shutdownForClose): 83 (WebCore::IDBServer::UniqueIDBDatabase::performStartVersionChangeTransaction): 84 (WebCore::IDBServer::UniqueIDBDatabase::openBackingStore): 85 (WebCore::IDBServer::UniqueIDBDatabase::performCreateObjectStore): 86 (WebCore::IDBServer::UniqueIDBDatabase::performDeleteObjectStore): 87 (WebCore::IDBServer::UniqueIDBDatabase::performRenameObjectStore): 88 (WebCore::IDBServer::UniqueIDBDatabase::performClearObjectStore): 89 (WebCore::IDBServer::UniqueIDBDatabase::performCreateIndex): 90 (WebCore::IDBServer::UniqueIDBDatabase::performDeleteIndex): 91 (WebCore::IDBServer::UniqueIDBDatabase::performRenameIndex): 92 (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd): 93 (WebCore::IDBServer::UniqueIDBDatabase::performGetRecord): 94 (WebCore::IDBServer::UniqueIDBDatabase::performGetIndexRecord): 95 (WebCore::IDBServer::UniqueIDBDatabase::performGetAllRecords): 96 (WebCore::IDBServer::UniqueIDBDatabase::performGetCount): 97 (WebCore::IDBServer::UniqueIDBDatabase::performDeleteRecord): 98 (WebCore::IDBServer::UniqueIDBDatabase::performOpenCursor): 99 (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor): 100 (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor): 101 (WebCore::IDBServer::UniqueIDBDatabase::performCommitTransaction): 102 (WebCore::IDBServer::UniqueIDBDatabase::performAbortTransaction): 103 (WebCore::IDBServer::UniqueIDBDatabase::performActivateTransactionInBackingStore): 104 (WebCore::IDBServer::UniqueIDBDatabase::abortTransactionOnMainThread): 105 (WebCore::IDBServer::UniqueIDBDatabase::commitTransactionOnMainThread): 106 (WebCore::IDBServer::UniqueIDBDatabase::suspend): 107 (WebCore::IDBServer::UniqueIDBDatabase::resume): 108 (WebCore::IDBServer::UniqueIDBDatabase::finishActiveTransactions): Deleted. 109 * Modules/indexeddb/server/UniqueIDBDatabase.h: 110 1 111 2019-11-22 Chris Lord <clord@igalia.com> 2 112 -
trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h
r251404 r252787 61 61 virtual ~IDBBackingStore() { RELEASE_ASSERT(!isMainThread()); } 62 62 63 virtual IDBError getOrEstablishDatabaseInfo(IDBDatabaseInfo&) = 0; 63 // All functions should take a LockHolder to make sure they have acquired lock when being called. 64 // This is used to make sure database operations would not be performed when process is suspended. 65 virtual IDBError getOrEstablishDatabaseInfo(IDBDatabaseInfo&, const LockHolder&) = 0; 64 66 65 virtual IDBError beginTransaction(const IDBTransactionInfo& ) = 0;66 virtual IDBError abortTransaction(const IDBResourceIdentifier& transactionIdentifier ) = 0;67 virtual IDBError commitTransaction(const IDBResourceIdentifier& transactionIdentifier ) = 0;67 virtual IDBError beginTransaction(const IDBTransactionInfo&, const LockHolder&) = 0; 68 virtual IDBError abortTransaction(const IDBResourceIdentifier& transactionIdentifier, const LockHolder&) = 0; 69 virtual IDBError commitTransaction(const IDBResourceIdentifier& transactionIdentifier, const LockHolder&) = 0; 68 70 69 virtual IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& ) = 0;70 virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier ) = 0;71 virtual IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName ) = 0;72 virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier ) = 0;73 virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo& ) = 0;74 virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier ) = 0;75 virtual IDBError renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName ) = 0;76 virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists ) = 0;77 virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& ) = 0;78 virtual IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const IDBValue& ) = 0;79 virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IDBGetRecordDataType, IDBGetResult& outValue ) = 0;80 virtual IDBError getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData&, IDBGetAllResult& outValue ) = 0;81 virtual IDBError getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&, IDBGetResult& outValue ) = 0;82 virtual IDBError getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, uint64_t& outCount ) = 0;83 virtual IDBError generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber ) = 0;84 virtual IDBError revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t keyNumber ) = 0;85 virtual IDBError maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, double newKeyNumber ) = 0;86 virtual IDBError openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo&, IDBGetResult& outResult ) = 0;87 virtual IDBError iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBIterateCursorData&, IDBGetResult& outResult ) = 0;88 virtual bool prefetchCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier ) = 0;71 virtual IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const LockHolder&) = 0; 72 virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const LockHolder&) = 0; 73 virtual IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName, const LockHolder&) = 0; 74 virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const LockHolder&) = 0; 75 virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&, const LockHolder&) = 0; 76 virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const LockHolder&) = 0; 77 virtual IDBError renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName, const LockHolder&) = 0; 78 virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists, const LockHolder&) = 0; 79 virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, const LockHolder&) = 0; 80 virtual IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const IDBValue&, const LockHolder&) = 0; 81 virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IDBGetRecordDataType, IDBGetResult& outValue, const LockHolder&) = 0; 82 virtual IDBError getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData&, IDBGetAllResult& outValue, const LockHolder&) = 0; 83 virtual IDBError getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&, IDBGetResult& outValue, const LockHolder&) = 0; 84 virtual IDBError getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, uint64_t& outCount, const LockHolder&) = 0; 85 virtual IDBError generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber, const LockHolder&) = 0; 86 virtual IDBError revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t keyNumber, const LockHolder&) = 0; 87 virtual IDBError maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, double newKeyNumber, const LockHolder&) = 0; 88 virtual IDBError openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo&, IDBGetResult& outResult, const LockHolder&) = 0; 89 virtual IDBError iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBIterateCursorData&, IDBGetResult& outResult, const LockHolder&) = 0; 90 virtual bool prefetchCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const LockHolder&) = 0; 89 91 90 virtual IDBObjectStoreInfo* infoForObjectStore(uint64_t objectStoreIdentifier ) = 0;91 virtual void deleteBackingStore( ) = 0;92 virtual IDBObjectStoreInfo* infoForObjectStore(uint64_t objectStoreIdentifier, const LockHolder&) = 0; 93 virtual void deleteBackingStore(const LockHolder&) = 0; 92 94 93 virtual bool supportsSimultaneousTransactions( ) = 0;94 virtual bool isEphemeral( ) = 0;95 virtual bool supportsSimultaneousTransactions(const LockHolder&) = 0; 96 virtual bool isEphemeral(const LockHolder&) = 0; 95 97 96 virtual void close() = 0; 97 virtual uint64_t databaseSize() const = 0; 98 virtual void close(const LockHolder&) = 0; 98 99 99 virtual bool hasTransaction(const IDBResourceIdentifier& ) const = 0;100 virtual bool hasTransaction(const IDBResourceIdentifier&, const LockHolder&) const = 0; 100 101 protected: 101 102 IDBBackingStore() { RELEASE_ASSERT(!isMainThread()); } -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
r252060 r252787 854 854 return; 855 855 856 suspendAndWait(); 857 if (shouldForceStop == ShouldForceStop::No && SQLiteDatabaseTracker::hasTransactionInProgress()) { 858 CrossThreadTaskHandler::resume(); 859 return; 860 } 861 862 for (auto& database : m_uniqueIDBDatabaseMap.values()) 863 database->finishActiveTransactions(); 856 if (shouldForceStop == ShouldForceStop::No && SQLiteDatabaseTracker::hasTransactionInProgress()) 857 return; 858 859 for (auto& database : m_allUniqueIDBDatabases) 860 database.suspend(); 864 861 } 865 862 … … 869 866 return; 870 867 871 CrossThreadTaskHandler::resume(); 868 for (auto& database : m_allUniqueIDBDatabases) 869 database.resume(); 872 870 } 873 871 -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h
r252060 r252787 42 42 #include <wtf/RefCounted.h> 43 43 #include <wtf/RefPtr.h> 44 #include <wtf/Weak Ptr.h>44 #include <wtf/WeakHashSet.h> 45 45 46 46 namespace WebCore { … … 124 124 WEBCORE_EXPORT void resume(); 125 125 126 void addDatabase(UniqueIDBDatabase& database) { m_allUniqueIDBDatabases.add(database); } 127 void removeDatabase(UniqueIDBDatabase& database) { m_allUniqueIDBDatabases.remove(database); } 128 126 129 private: 127 130 IDBServer(PAL::SessionID, QuotaManagerGetter&&); … … 191 194 HashMap<IDBConnectionIdentifier, RefPtr<IDBConnectionToClient>> m_connectionMap; 192 195 HashMap<IDBDatabaseIdentifier, std::unique_ptr<UniqueIDBDatabase>> m_uniqueIDBDatabaseMap; 196 WeakHashSet<UniqueIDBDatabase> m_allUniqueIDBDatabases; 193 197 194 198 HashMap<uint64_t, UniqueIDBDatabaseConnection*> m_databaseConnections; -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp
r252672 r252787 60 60 MemoryIDBBackingStore::~MemoryIDBBackingStore() = default; 61 61 62 IDBError MemoryIDBBackingStore::getOrEstablishDatabaseInfo(IDBDatabaseInfo& info, const LockHolder&) 63 { 64 return getOrEstablishDatabaseInfo(info); 65 } 66 62 67 IDBError MemoryIDBBackingStore::getOrEstablishDatabaseInfo(IDBDatabaseInfo& info) 63 68 { … … 77 82 } 78 83 79 IDBError MemoryIDBBackingStore::beginTransaction(const IDBTransactionInfo& info )84 IDBError MemoryIDBBackingStore::beginTransaction(const IDBTransactionInfo& info, const LockHolder&) 80 85 { 81 86 LOG(IndexedDB, "MemoryIDBBackingStore::beginTransaction"); … … 102 107 } 103 108 104 IDBError MemoryIDBBackingStore::abortTransaction(const IDBResourceIdentifier& transactionIdentifier )109 IDBError MemoryIDBBackingStore::abortTransaction(const IDBResourceIdentifier& transactionIdentifier, const LockHolder&) 105 110 { 106 111 LOG(IndexedDB, "MemoryIDBBackingStore::abortTransaction - %s", transactionIdentifier.loggingString().utf8().data()); … … 115 120 } 116 121 117 IDBError MemoryIDBBackingStore::commitTransaction(const IDBResourceIdentifier& transactionIdentifier )122 IDBError MemoryIDBBackingStore::commitTransaction(const IDBResourceIdentifier& transactionIdentifier, const LockHolder&) 118 123 { 119 124 LOG(IndexedDB, "MemoryIDBBackingStore::commitTransaction - %s", transactionIdentifier.loggingString().utf8().data()); … … 128 133 } 129 134 130 IDBError MemoryIDBBackingStore::createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& info )135 IDBError MemoryIDBBackingStore::createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& info, const LockHolder&) 131 136 { 132 137 LOG(IndexedDB, "MemoryIDBBackingStore::createObjectStore - adding OS %s with ID %" PRIu64, info.name().utf8().data(), info.identifier()); … … 151 156 } 152 157 153 IDBError MemoryIDBBackingStore::deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier )158 IDBError MemoryIDBBackingStore::deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const LockHolder&) 154 159 { 155 160 LOG(IndexedDB, "MemoryIDBBackingStore::deleteObjectStore"); … … 174 179 } 175 180 176 IDBError MemoryIDBBackingStore::renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName )181 IDBError MemoryIDBBackingStore::renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName, const LockHolder&) 177 182 { 178 183 LOG(IndexedDB, "MemoryIDBBackingStore::renameObjectStore"); … … 203 208 } 204 209 205 IDBError MemoryIDBBackingStore::clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier )210 IDBError MemoryIDBBackingStore::clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const LockHolder&) 206 211 { 207 212 LOG(IndexedDB, "MemoryIDBBackingStore::clearObjectStore"); … … 224 229 } 225 230 226 IDBError MemoryIDBBackingStore::createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo& info )231 IDBError MemoryIDBBackingStore::createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo& info, const LockHolder&) 227 232 { 228 233 LOG(IndexedDB, "MemoryIDBBackingStore::createIndex"); … … 239 244 } 240 245 241 IDBError MemoryIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier )246 IDBError MemoryIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const LockHolder&) 242 247 { 243 248 LOG(IndexedDB, "MemoryIDBBackingStore::deleteIndex"); … … 254 259 } 255 260 256 IDBError MemoryIDBBackingStore::renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName )261 IDBError MemoryIDBBackingStore::renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName, const LockHolder&) 257 262 { 258 263 LOG(IndexedDB, "MemoryIDBBackingStore::renameIndex"); … … 307 312 } 308 313 309 IDBError MemoryIDBBackingStore::keyExistsInObjectStore(const IDBResourceIdentifier&, uint64_t objectStoreIdentifier, const IDBKeyData& keyData, bool& keyExists )314 IDBError MemoryIDBBackingStore::keyExistsInObjectStore(const IDBResourceIdentifier&, uint64_t objectStoreIdentifier, const IDBKeyData& keyData, bool& keyExists, const LockHolder&) 310 315 { 311 316 LOG(IndexedDB, "MemoryIDBBackingStore::keyExistsInObjectStore"); … … 320 325 } 321 326 322 IDBError MemoryIDBBackingStore::deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range )327 IDBError MemoryIDBBackingStore::deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range, const LockHolder&) 323 328 { 324 329 LOG(IndexedDB, "MemoryIDBBackingStore::deleteRange"); … … 337 342 } 338 343 339 IDBError MemoryIDBBackingStore::addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& objectStoreInfo, const IDBKeyData& keyData, const IDBValue& value )344 IDBError MemoryIDBBackingStore::addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& objectStoreInfo, const IDBKeyData& keyData, const IDBValue& value, const LockHolder&) 340 345 { 341 346 LOG(IndexedDB, "MemoryIDBBackingStore::addRecord"); … … 354 359 } 355 360 356 IDBError MemoryIDBBackingStore::getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range, IDBGetRecordDataType type, IDBGetResult& outValue )361 IDBError MemoryIDBBackingStore::getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range, IDBGetRecordDataType type, IDBGetResult& outValue, const LockHolder&) 357 362 { 358 363 LOG(IndexedDB, "MemoryIDBBackingStore::getRecord"); … … 381 386 } 382 387 383 IDBError MemoryIDBBackingStore::getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData& getAllRecordsData, IDBGetAllResult& result )388 IDBError MemoryIDBBackingStore::getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData& getAllRecordsData, IDBGetAllResult& result, const LockHolder&) 384 389 { 385 390 LOG(IndexedDB, "MemoryIDBBackingStore::getAllRecords"); … … 406 411 } 407 412 408 IDBError MemoryIDBBackingStore::getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType recordType, const IDBKeyRangeData& range, IDBGetResult& outValue )413 IDBError MemoryIDBBackingStore::getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType recordType, const IDBKeyRangeData& range, IDBGetResult& outValue, const LockHolder&) 409 414 { 410 415 LOG(IndexedDB, "MemoryIDBBackingStore::getIndexRecord"); … … 423 428 } 424 429 425 IDBError MemoryIDBBackingStore::getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, uint64_t& outCount )430 IDBError MemoryIDBBackingStore::getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, uint64_t& outCount, const LockHolder&) 426 431 { 427 432 LOG(IndexedDB, "MemoryIDBBackingStore::getCount"); … … 441 446 } 442 447 443 IDBError MemoryIDBBackingStore::generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber )448 IDBError MemoryIDBBackingStore::generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber, const LockHolder&) 444 449 { 445 450 LOG(IndexedDB, "MemoryIDBBackingStore::generateKeyNumber"); … … 460 465 } 461 466 462 IDBError MemoryIDBBackingStore::revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t keyNumber )467 IDBError MemoryIDBBackingStore::revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t keyNumber, const LockHolder&) 463 468 { 464 469 LOG(IndexedDB, "MemoryIDBBackingStore::revertGeneratedKeyNumber"); … … 475 480 } 476 481 477 IDBError MemoryIDBBackingStore::maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, double newKeyNumber )482 IDBError MemoryIDBBackingStore::maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, double newKeyNumber, const LockHolder&) 478 483 { 479 484 LOG(IndexedDB, "MemoryIDBBackingStore::maybeUpdateKeyGeneratorNumber"); … … 504 509 } 505 510 506 IDBError MemoryIDBBackingStore::openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo& info, IDBGetResult& outData )511 IDBError MemoryIDBBackingStore::openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo& info, IDBGetResult& outData, const LockHolder&) 507 512 { 508 513 LOG(IndexedDB, "MemoryIDBBackingStore::openCursor"); … … 546 551 } 547 552 548 IDBError MemoryIDBBackingStore::iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBIterateCursorData& data, IDBGetResult& outData )553 IDBError MemoryIDBBackingStore::iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBIterateCursorData& data, IDBGetResult& outData, const LockHolder&) 549 554 { 550 555 LOG(IndexedDB, "MemoryIDBBackingStore::iterateCursor"); … … 593 598 } 594 599 595 IDBObjectStoreInfo* MemoryIDBBackingStore::infoForObjectStore(uint64_t objectStoreIdentifier )600 IDBObjectStoreInfo* MemoryIDBBackingStore::infoForObjectStore(uint64_t objectStoreIdentifier, const LockHolder&) 596 601 { 597 602 ASSERT(m_databaseInfo); … … 599 604 } 600 605 601 void MemoryIDBBackingStore::deleteBackingStore( )606 void MemoryIDBBackingStore::deleteBackingStore(const LockHolder&) 602 607 { 603 608 // The in-memory IDB backing store doesn't need to do any cleanup when it is deleted. 604 609 } 605 610 606 uint64_t MemoryIDBBackingStore::databaseSize() const 607 { 608 // FIXME: Implement this. 609 return 0; 610 } 611 612 void MemoryIDBBackingStore::close() 611 void MemoryIDBBackingStore::close(const LockHolder&) 613 612 { 614 613 } -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h
r250287 r252787 48 48 ~MemoryIDBBackingStore() final; 49 49 50 IDBError getOrEstablishDatabaseInfo(IDBDatabaseInfo&) final; 50 IDBError getOrEstablishDatabaseInfo(IDBDatabaseInfo&, const LockHolder&) final; 51 IDBError getOrEstablishDatabaseInfo(IDBDatabaseInfo&); 51 52 void setDatabaseInfo(const IDBDatabaseInfo&); 52 53 53 IDBError beginTransaction(const IDBTransactionInfo& ) final;54 IDBError abortTransaction(const IDBResourceIdentifier& transactionIdentifier ) final;55 IDBError commitTransaction(const IDBResourceIdentifier& transactionIdentifier ) final;56 IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& ) final;57 IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier ) final;58 IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName ) final;59 IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier ) final;60 IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo& ) final;61 IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier ) final;62 IDBError renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName ) final;63 IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists ) final;64 IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& ) final;65 IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const IDBValue& ) final;66 IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IDBGetRecordDataType, IDBGetResult& outValue ) final;67 IDBError getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData&, IDBGetAllResult& outValue ) final;68 IDBError getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&, IDBGetResult& outValue ) final;69 IDBError getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, uint64_t& outCount ) final;70 IDBError generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber ) final;71 IDBError revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t keyNumber ) final;72 IDBError maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, double newKeyNumber ) final;73 IDBError openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo&, IDBGetResult& outResult ) final;74 IDBError iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBIterateCursorData&, IDBGetResult& outResult ) final;75 bool prefetchCursor(const IDBResourceIdentifier&, const IDBResourceIdentifier& ) final { return false; }54 IDBError beginTransaction(const IDBTransactionInfo&, const LockHolder&) final; 55 IDBError abortTransaction(const IDBResourceIdentifier& transactionIdentifier, const LockHolder&) final; 56 IDBError commitTransaction(const IDBResourceIdentifier& transactionIdentifier, const LockHolder&) final; 57 IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const LockHolder&) final; 58 IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const LockHolder&) final; 59 IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName, const LockHolder&) final; 60 IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const LockHolder&) final; 61 IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&, const LockHolder&) final; 62 IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const LockHolder&) final; 63 IDBError renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName, const LockHolder&) final; 64 IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists, const LockHolder&) final; 65 IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, const LockHolder&) final; 66 IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const IDBValue&, const LockHolder&) final; 67 IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IDBGetRecordDataType, IDBGetResult& outValue, const LockHolder&) final; 68 IDBError getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData&, IDBGetAllResult& outValue, const LockHolder&) final; 69 IDBError getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&, IDBGetResult& outValue, const LockHolder&) final; 70 IDBError getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, uint64_t& outCount, const LockHolder&) final; 71 IDBError generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber, const LockHolder&) final; 72 IDBError revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t keyNumber, const LockHolder&) final; 73 IDBError maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, double newKeyNumber, const LockHolder&) final; 74 IDBError openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo&, IDBGetResult& outResult, const LockHolder&) final; 75 IDBError iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBIterateCursorData&, IDBGetResult& outResult, const LockHolder&) final; 76 bool prefetchCursor(const IDBResourceIdentifier&, const IDBResourceIdentifier&, const LockHolder&) final { return false; } 76 77 77 IDBObjectStoreInfo* infoForObjectStore(uint64_t objectStoreIdentifier ) final;78 void deleteBackingStore( ) final;78 IDBObjectStoreInfo* infoForObjectStore(uint64_t objectStoreIdentifier, const LockHolder&) final; 79 void deleteBackingStore(const LockHolder&) final; 79 80 80 bool supportsSimultaneousTransactions( ) final { return true; }81 bool isEphemeral( ) final { return true; }81 bool supportsSimultaneousTransactions(const LockHolder&) final { return true; } 82 bool isEphemeral(const LockHolder&) final { return true; } 82 83 83 84 void removeObjectStoreForVersionChangeAbort(MemoryObjectStore&); 84 85 void restoreObjectStoreForVersionChangeAbort(Ref<MemoryObjectStore>&&); 85 86 86 bool hasTransaction(const IDBResourceIdentifier& identifier ) const final { return m_transactions.contains(identifier); }87 bool hasTransaction(const IDBResourceIdentifier& identifier, const LockHolder&) const final { return m_transactions.contains(identifier); } 87 88 88 89 private: 89 90 RefPtr<MemoryObjectStore> takeObjectStoreByIdentifier(uint64_t identifier); 90 91 uint64_t databaseSize() const final; 92 void close() final; 91 92 void close(const LockHolder&) final; 93 93 94 94 IDBDatabaseIdentifier m_identifier; -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r251404 r252787 782 782 } 783 783 784 IDBError SQLiteIDBBackingStore::getOrEstablishDatabaseInfo(IDBDatabaseInfo& info )784 IDBError SQLiteIDBBackingStore::getOrEstablishDatabaseInfo(IDBDatabaseInfo& info, const LockHolder&) 785 785 { 786 786 LOG(IndexedDB, "SQLiteIDBBackingStore::getOrEstablishDatabaseInfo - database %s", m_identifier.databaseName().utf8().data()); … … 855 855 } 856 856 857 uint64_t SQLiteIDBBackingStore::databaseSize() const 858 { 859 ASSERT(!isMainThread()); 860 return SQLiteFileSystem::getDatabaseFileSize(fullDatabasePath()); 861 } 862 863 IDBError SQLiteIDBBackingStore::beginTransaction(const IDBTransactionInfo& info) 857 IDBError SQLiteIDBBackingStore::beginTransaction(const IDBTransactionInfo& info, const LockHolder&) 864 858 { 865 859 LOG(IndexedDB, "SQLiteIDBBackingStore::beginTransaction - %s", info.identifier().loggingString().utf8().data()); … … 892 886 } 893 887 894 IDBError SQLiteIDBBackingStore::abortTransaction(const IDBResourceIdentifier& identifier )888 IDBError SQLiteIDBBackingStore::abortTransaction(const IDBResourceIdentifier& identifier, const LockHolder&) 895 889 { 896 890 LOG(IndexedDB, "SQLiteIDBBackingStore::abortTransaction - %s", identifier.loggingString().utf8().data()); … … 911 905 } 912 906 913 IDBError SQLiteIDBBackingStore::commitTransaction(const IDBResourceIdentifier& identifier )907 IDBError SQLiteIDBBackingStore::commitTransaction(const IDBResourceIdentifier& identifier, const LockHolder&) 914 908 { 915 909 LOG(IndexedDB, "SQLiteIDBBackingStore::commitTransaction - %s", identifier.loggingString().utf8().data()); … … 936 930 } 937 931 938 IDBError SQLiteIDBBackingStore::createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& info )932 IDBError SQLiteIDBBackingStore::createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& info, const LockHolder&) 939 933 { 940 934 LOG(IndexedDB, "SQLiteIDBBackingStore::createObjectStore - adding OS %s with ID %" PRIu64, info.name().utf8().data(), info.identifier()); … … 987 981 } 988 982 989 IDBError SQLiteIDBBackingStore::deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier )983 IDBError SQLiteIDBBackingStore::deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const LockHolder&) 990 984 { 991 985 LOG(IndexedDB, "SQLiteIDBBackingStore::deleteObjectStore - object store %" PRIu64, objectStoreIdentifier); … … 1078 1072 } 1079 1073 1080 IDBError SQLiteIDBBackingStore::renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName )1074 IDBError SQLiteIDBBackingStore::renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName, const LockHolder&) 1081 1075 { 1082 1076 LOG(IndexedDB, "SQLiteIDBBackingStore::renameObjectStore - object store %" PRIu64, objectStoreIdentifier); … … 1110 1104 } 1111 1105 1112 IDBError SQLiteIDBBackingStore::clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID )1106 IDBError SQLiteIDBBackingStore::clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, const LockHolder&) 1113 1107 { 1114 1108 LOG(IndexedDB, "SQLiteIDBBackingStore::clearObjectStore - object store %" PRIu64, objectStoreID); … … 1151 1145 } 1152 1146 1153 IDBError SQLiteIDBBackingStore::createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo& info )1147 IDBError SQLiteIDBBackingStore::createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo& info, const LockHolder&) 1154 1148 { 1155 1149 LOG(IndexedDB, "SQLiteIDBBackingStore::createIndex - ObjectStore %" PRIu64 ", Index %" PRIu64, info.objectStoreIdentifier(), info.identifier()); … … 1338 1332 1339 1333 1340 IDBError SQLiteIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier )1334 IDBError SQLiteIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const LockHolder&) 1341 1335 { 1342 1336 LOG(IndexedDB, "SQLiteIDBBackingStore::deleteIndex - object store %" PRIu64, objectStoreIdentifier); … … 1383 1377 } 1384 1378 1385 IDBError SQLiteIDBBackingStore::renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName )1379 IDBError SQLiteIDBBackingStore::renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName, const LockHolder&) 1386 1380 { 1387 1381 LOG(IndexedDB, "SQLiteIDBBackingStore::renameIndex - object store %" PRIu64 ", index %" PRIu64, objectStoreIdentifier, indexIdentifier); … … 1424 1418 } 1425 1419 1426 IDBError SQLiteIDBBackingStore::keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, const IDBKeyData& keyData, bool& keyExists )1420 IDBError SQLiteIDBBackingStore::keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, const IDBKeyData& keyData, bool& keyExists, const LockHolder&) 1427 1421 { 1428 1422 LOG(IndexedDB, "SQLiteIDBBackingStore::keyExistsInObjectStore - key %s, object store %" PRIu64, keyData.loggingString().utf8().data(), objectStoreID); … … 1599 1593 } 1600 1594 1601 IDBError SQLiteIDBBackingStore::deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, const IDBKeyRangeData& keyRange )1595 IDBError SQLiteIDBBackingStore::deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, const IDBKeyRangeData& keyRange, const LockHolder&) 1602 1596 { 1603 1597 LOG(IndexedDB, "SQLiteIDBBackingStore::deleteRange - range %s, object store %" PRIu64, keyRange.loggingString().utf8().data(), objectStoreID); … … 1719 1713 } 1720 1714 1721 IDBError SQLiteIDBBackingStore::addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& objectStoreInfo, const IDBKeyData& keyData, const IDBValue& value )1715 IDBError SQLiteIDBBackingStore::addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo& objectStoreInfo, const IDBKeyData& keyData, const IDBValue& value, const LockHolder&) 1722 1716 { 1723 1717 LOG(IndexedDB, "SQLiteIDBBackingStore::addRecord - key %s, object store %" PRIu64, keyData.loggingString().utf8().data(), objectStoreInfo.identifier()); … … 1881 1875 } 1882 1876 1883 IDBError SQLiteIDBBackingStore::getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, const IDBKeyRangeData& keyRange, IDBGetRecordDataType type, IDBGetResult& resultValue )1877 IDBError SQLiteIDBBackingStore::getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, const IDBKeyRangeData& keyRange, IDBGetRecordDataType type, IDBGetResult& resultValue, const LockHolder&) 1884 1878 { 1885 1879 LOG(IndexedDB, "SQLiteIDBBackingStore::getRecord - key range %s, object store %" PRIu64, keyRange.loggingString().utf8().data(), objectStoreID); … … 2016 2010 } 2017 2011 2018 IDBError SQLiteIDBBackingStore::getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData& getAllRecordsData, IDBGetAllResult& result )2012 IDBError SQLiteIDBBackingStore::getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData& getAllRecordsData, IDBGetAllResult& result, const LockHolder&) 2019 2013 { 2020 2014 return getAllRecordsData.indexIdentifier ? getAllIndexRecords(transactionIdentifier, getAllRecordsData, result) : getAllObjectStoreRecords(transactionIdentifier, getAllRecordsData, result); … … 2196 2190 } 2197 2191 2198 IDBError SQLiteIDBBackingStore::getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, uint64_t indexID, IndexedDB::IndexRecordType type, const IDBKeyRangeData& range, IDBGetResult& getResult )2192 IDBError SQLiteIDBBackingStore::getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, uint64_t indexID, IndexedDB::IndexRecordType type, const IDBKeyRangeData& range, IDBGetResult& getResult, const LockHolder&) 2199 2193 { 2200 2194 LOG(IndexedDB, "SQLiteIDBBackingStore::getIndexRecord - %s", range.loggingString().utf8().data()); … … 2298 2292 } 2299 2293 2300 IDBError SQLiteIDBBackingStore::getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, uint64_t& outCount )2294 IDBError SQLiteIDBBackingStore::getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, uint64_t& outCount, const LockHolder&) 2301 2295 { 2302 2296 LOG(IndexedDB, "SQLiteIDBBackingStore::getCount - object store %" PRIu64, objectStoreIdentifier); … … 2415 2409 } 2416 2410 2417 IDBError SQLiteIDBBackingStore::generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, uint64_t& generatedKey )2411 IDBError SQLiteIDBBackingStore::generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, uint64_t& generatedKey, const LockHolder&) 2418 2412 { 2419 2413 LOG(IndexedDB, "SQLiteIDBBackingStore::generateKeyNumber"); … … 2443 2437 } 2444 2438 2445 IDBError SQLiteIDBBackingStore::revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, uint64_t newKeyNumber )2439 IDBError SQLiteIDBBackingStore::revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, uint64_t newKeyNumber, const LockHolder&) 2446 2440 { 2447 2441 LOG(IndexedDB, "SQLiteIDBBackingStore::revertGeneratedKeyNumber - object store %" PRIu64 ", reverted number %" PRIu64, objectStoreID, newKeyNumber); … … 2463 2457 } 2464 2458 2465 IDBError SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, double newKeyNumber )2459 IDBError SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, double newKeyNumber, const LockHolder&) 2466 2460 { 2467 2461 LOG(IndexedDB, "SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber"); … … 2490 2484 } 2491 2485 2492 IDBError SQLiteIDBBackingStore::openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo& info, IDBGetResult& result )2486 IDBError SQLiteIDBBackingStore::openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo& info, IDBGetResult& result, const LockHolder&) 2493 2487 { 2494 2488 ASSERT(m_sqliteDB); … … 2513 2507 } 2514 2508 2515 IDBError SQLiteIDBBackingStore::iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBIterateCursorData& data, IDBGetResult& result )2509 IDBError SQLiteIDBBackingStore::iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBIterateCursorData& data, IDBGetResult& result, const LockHolder&) 2516 2510 { 2517 2511 LOG(IndexedDB, "SQLiteIDBBackingStore::iterateCursor"); … … 2556 2550 } 2557 2551 2558 bool SQLiteIDBBackingStore::prefetchCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier )2552 bool SQLiteIDBBackingStore::prefetchCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const LockHolder&) 2559 2553 { 2560 2554 LOG(IndexedDB, "SQLiteIDBBackingStore::prefetchCursor"); … … 2572 2566 } 2573 2567 2568 IDBObjectStoreInfo* SQLiteIDBBackingStore::infoForObjectStore(uint64_t objectStoreIdentifier, const LockHolder&) 2569 { 2570 return infoForObjectStore(objectStoreIdentifier); 2571 } 2572 2574 2573 IDBObjectStoreInfo* SQLiteIDBBackingStore::infoForObjectStore(uint64_t objectStoreIdentifier) 2575 2574 { … … 2578 2577 } 2579 2578 2580 void SQLiteIDBBackingStore::deleteBackingStore( )2579 void SQLiteIDBBackingStore::deleteBackingStore(const LockHolder&) 2581 2580 { 2582 2581 String dbFilename = fullDatabasePath(); … … 2648 2647 } 2649 2648 2650 void SQLiteIDBBackingStore::close( )2649 void SQLiteIDBBackingStore::close(const LockHolder&) 2651 2650 { 2652 2651 closeSQLiteDB(); … … 2664 2663 } 2665 2664 2666 bool SQLiteIDBBackingStore::hasTransaction(const IDBResourceIdentifier& transactionIdentifier ) const2665 bool SQLiteIDBBackingStore::hasTransaction(const IDBResourceIdentifier& transactionIdentifier, const LockHolder&) const 2667 2666 { 2668 2667 ASSERT(isMainThread()); -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h
r251404 r252787 55 55 ~SQLiteIDBBackingStore() final; 56 56 57 IDBError getOrEstablishDatabaseInfo(IDBDatabaseInfo&) final; 58 59 IDBError beginTransaction(const IDBTransactionInfo&) final; 60 IDBError abortTransaction(const IDBResourceIdentifier& transactionIdentifier) final; 61 IDBError commitTransaction(const IDBResourceIdentifier& transactionIdentifier) final; 62 IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&) final; 63 IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) final; 64 IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName) final; 65 IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) final; 66 IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) final; 67 IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) final; 68 IDBError renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) final; 69 IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) final; 70 IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) final; 71 IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const IDBValue&) final; 72 IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IDBGetRecordDataType, IDBGetResult& outValue) final; 73 IDBError getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData&, IDBGetAllResult& outValue) final; 74 IDBError getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&, IDBGetResult& outValue) final; 75 IDBError getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, uint64_t& outCount) final; 76 IDBError generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber) final; 77 IDBError revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t keyNumber) final; 78 IDBError maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, double newKeyNumber) final; 79 IDBError openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo&, IDBGetResult& outResult) final; 80 IDBError iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBIterateCursorData&, IDBGetResult& outResult) final; 81 bool prefetchCursor(const IDBResourceIdentifier&, const IDBResourceIdentifier&) final; 82 83 IDBObjectStoreInfo* infoForObjectStore(uint64_t objectStoreIdentifier) final; 84 void deleteBackingStore() final; 85 86 bool supportsSimultaneousTransactions() final { return false; } 87 bool isEphemeral() final { return false; } 57 IDBError getOrEstablishDatabaseInfo(IDBDatabaseInfo&, const LockHolder&) final; 58 59 IDBError beginTransaction(const IDBTransactionInfo&, const LockHolder&) final; 60 IDBError abortTransaction(const IDBResourceIdentifier& transactionIdentifier, const LockHolder&) final; 61 IDBError commitTransaction(const IDBResourceIdentifier& transactionIdentifier, const LockHolder&) final; 62 IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const LockHolder&) final; 63 IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const LockHolder&) final; 64 IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName, const LockHolder&) final; 65 IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const LockHolder&) final; 66 IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&, const LockHolder&) final; 67 IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const LockHolder&) final; 68 IDBError renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName, const LockHolder&) final; 69 IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists, const LockHolder&) final; 70 IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, const LockHolder&) final; 71 IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&, const IDBKeyData&, const IDBValue&, const LockHolder&) final; 72 IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IDBGetRecordDataType, IDBGetResult& outValue, const LockHolder&) final; 73 IDBError getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData&, IDBGetAllResult& outValue, const LockHolder&) final; 74 IDBError getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&, IDBGetResult& outValue, const LockHolder&) final; 75 IDBError getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, uint64_t& outCount, const LockHolder&) final; 76 IDBError generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber, const LockHolder&) final; 77 IDBError revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t keyNumber, const LockHolder&) final; 78 IDBError maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, double newKeyNumber, const LockHolder&) final; 79 IDBError openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo&, IDBGetResult& outResult, const LockHolder&) final; 80 IDBError iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBIterateCursorData&, IDBGetResult& outResult, const LockHolder&) final; 81 bool prefetchCursor(const IDBResourceIdentifier&, const IDBResourceIdentifier&, const LockHolder&) final; 82 83 IDBObjectStoreInfo* infoForObjectStore(uint64_t objectStoreIdentifier, const LockHolder&) final; 84 void deleteBackingStore(const LockHolder&) final; 85 86 bool supportsSimultaneousTransactions(const LockHolder&) final { return false; } 87 bool isEphemeral(const LockHolder&) final { return false; } 88 89 bool hasTransaction(const IDBResourceIdentifier&, const LockHolder&) const final; 88 90 89 91 void unregisterCursor(SQLiteIDBCursor&); 90 92 91 93 IDBError getBlobRecordsForObjectStoreRecord(int64_t objectStoreRecord, Vector<String>& blobURLs, Vector<String>& blobFilePaths); 94 IDBObjectStoreInfo* infoForObjectStore(uint64_t objectStoreIdentifier); 92 95 93 96 static String databaseNameFromEncodedFilename(const String&); … … 97 100 static String fullDatabasePathForDirectory(const String&); 98 101 static String databaseNameFromFile(const String&); 99 100 bool hasTransaction(const IDBResourceIdentifier&) const final;101 102 102 103 PAL::SessionID sessionID() const { return m_sessionID; } … … 133 134 134 135 void closeSQLiteDB(); 135 void close() final; 136 137 uint64_t databaseSize() const final; 136 void close(const LockHolder&) final; 138 137 139 138 enum class SQL : size_t { -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r252673 r252787 123 123 , m_operationAndTransactionTimer(*this, &UniqueIDBDatabase::operationAndTransactionTimerFired) 124 124 { 125 m_server->addDatabase(*this); 125 126 LOG(IndexedDB, "UniqueIDBDatabase::UniqueIDBDatabase() (%p) %s", this, m_identifier.debugString().utf8().data()); 126 127 } … … 140 141 RELEASE_ASSERT(m_databaseReplyQueue.isKilled()); 141 142 RELEASE_ASSERT(!m_backingStore); 143 144 m_server->removeDatabase(*this); 142 145 } 143 146 … … 378 381 uint64_t deletedVersion = 0; 379 382 380 if (m_backingStore) { 381 m_backingStore->deleteBackingStore(); 382 383 m_backingStore = nullptr; 384 m_backingStoreSupportsSimultaneousTransactions = false; 385 m_backingStoreIsEphemeral = false; 386 } else { 387 auto backingStore = m_server->createBackingStore(identifier); 388 389 IDBDatabaseInfo databaseInfo; 390 auto error = backingStore->getOrEstablishDatabaseInfo(databaseInfo); 391 if (!error.isNull()) 392 LOG_ERROR("Error getting database info from database %s that we are trying to delete", identifier.debugString().utf8().data()); 393 394 deletedVersion = databaseInfo.version(); 395 backingStore->deleteBackingStore(); 383 { 384 LockHolder locker(m_backingStoreLock); 385 if (m_backingStore) { 386 m_backingStore->deleteBackingStore(locker); 387 m_backingStore = nullptr; 388 m_backingStoreSupportsSimultaneousTransactions = false; 389 m_backingStoreIsEphemeral = false; 390 } else { 391 auto backingStore = m_server->createBackingStore(identifier); 392 393 IDBDatabaseInfo databaseInfo; 394 auto error = backingStore->getOrEstablishDatabaseInfo(databaseInfo, locker); 395 if (!error.isNull()) 396 LOG_ERROR("Error getting database info from database %s that we are trying to delete", identifier.debugString().utf8().data()); 397 398 deletedVersion = databaseInfo.version(); 399 backingStore->deleteBackingStore(locker); 400 } 396 401 } 397 402 … … 404 409 LOG(IndexedDB, "(db) UniqueIDBDatabase::performUnconditionalDeleteBackingStore"); 405 410 406 if (m_backingStore) 407 m_backingStore->deleteBackingStore(); 411 { 412 LockHolder locker(m_backingStoreLock); 413 if (m_backingStore) 414 m_backingStore->deleteBackingStore(locker); 415 } 408 416 409 417 shutdownForClose(); … … 429 437 LOG(IndexedDB, "(db) UniqueIDBDatabase::shutdownForClose"); 430 438 431 if (m_backingStore) 432 m_backingStore->close(); 433 434 m_backingStore = nullptr; 439 if (m_backingStore) { 440 LockHolder locker(m_backingStoreLock); 441 m_backingStore->close(locker); 442 m_backingStore = nullptr; 443 } 435 444 m_backingStoreSupportsSimultaneousTransactions = false; 436 445 m_backingStoreIsEphemeral = false; … … 671 680 LOG(IndexedDB, "(db) UniqueIDBDatabase::performStartVersionChangeTransaction"); 672 681 673 IDBError error = m_backingStore->beginTransaction(info); 682 IDBError error; 683 { 684 LockHolder locker(m_backingStoreLock); 685 error = m_backingStore->beginTransaction(info, locker); 686 } 687 674 688 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformStartVersionChangeTransaction, error)); 675 689 } … … 828 842 829 843 ASSERT(!m_backingStore); 830 m_backingStore = m_server->createBackingStore(identifier);831 m_backingStoreSupportsSimultaneousTransactions = m_backingStore->supportsSimultaneousTransactions();832 m_backingStoreIsEphemeral = m_backingStore->isEphemeral();833 844 834 845 IDBDatabaseInfo databaseInfo; 835 auto error = m_backingStore->getOrEstablishDatabaseInfo(databaseInfo); 846 IDBError error; 847 { 848 LockHolder locker(m_backingStoreLock); 849 m_backingStore = m_server->createBackingStore(identifier); 850 m_backingStoreSupportsSimultaneousTransactions = m_backingStore->supportsSimultaneousTransactions(locker); 851 m_backingStoreIsEphemeral = m_backingStore->isEphemeral(locker); 852 error = m_backingStore->getOrEstablishDatabaseInfo(databaseInfo, locker); 853 } 836 854 837 855 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didOpenBackingStore, databaseInfo, error, taskIdentifier)); … … 893 911 894 912 ASSERT(m_backingStore); 895 IDBError error = m_backingStore->createObjectStore(transactionIdentifier, info); 913 IDBError error; 914 { 915 LockHolder locker(m_backingStoreLock); 916 error = m_backingStore->createObjectStore(transactionIdentifier, info, locker); 917 } 896 918 897 919 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformCreateObjectStore, callbackIdentifier, error, info)); … … 945 967 946 968 ASSERT(m_backingStore); 947 IDBError error = m_backingStore->deleteObjectStore(transactionIdentifier, objectStoreIdentifier); 969 IDBError error; 970 { 971 LockHolder locker(m_backingStoreLock); 972 error = m_backingStore->deleteObjectStore(transactionIdentifier, objectStoreIdentifier, locker); 973 } 948 974 949 975 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformDeleteObjectStore, callbackIdentifier, error, objectStoreIdentifier)); … … 1002 1028 1003 1029 ASSERT(m_backingStore); 1004 m_backingStore->renameObjectStore(transactionIdentifier, objectStoreIdentifier, newName); 1030 { 1031 LockHolder locker(m_backingStoreLock); 1032 m_backingStore->renameObjectStore(transactionIdentifier, objectStoreIdentifier, newName, locker); 1033 } 1005 1034 1006 1035 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformRenameObjectStore, callbackIdentifier, error, objectStoreIdentifier, newName)); … … 1047 1076 1048 1077 ASSERT(m_backingStore); 1049 IDBError error = m_backingStore->clearObjectStore(transactionIdentifier, objectStoreIdentifier); 1078 IDBError error; 1079 { 1080 LockHolder locker(m_backingStoreLock); 1081 error = m_backingStore->clearObjectStore(transactionIdentifier, objectStoreIdentifier, locker); 1082 } 1050 1083 1051 1084 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformClearObjectStore, callbackIdentifier, error)); … … 1097 1130 IDBError error; 1098 1131 ASSERT(m_backingStore); 1099 if (!m_backingStore) { 1100 RELEASE_LOG_ERROR(IndexedDB, "%p - UniqueIDBDatabase::performCreateIndex: m_backingStore is null", this); 1101 error = IDBError(InvalidStateError, "Backing store is invalid for call to create index"_s); 1102 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformCreateIndex, callbackIdentifier, error, info)); 1103 return; 1104 } 1105 1106 error = m_backingStore->createIndex(transactionIdentifier, info); 1132 { 1133 LockHolder locker(m_backingStoreLock); 1134 if (!m_backingStore) { 1135 RELEASE_LOG_ERROR(IndexedDB, "%p - UniqueIDBDatabase::performCreateIndex: m_backingStore is null", this); 1136 error = IDBError(InvalidStateError, "Backing store is invalid for call to create index"_s); 1137 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformCreateIndex, callbackIdentifier, error, info)); 1138 return; 1139 } 1140 error = m_backingStore->createIndex(transactionIdentifier, info, locker); 1141 } 1142 1107 1143 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformCreateIndex, callbackIdentifier, error, info)); 1108 1144 } … … 1166 1202 1167 1203 ASSERT(m_backingStore); 1168 IDBError error = m_backingStore->deleteIndex(transactionIdentifier, objectStoreIdentifier, indexIdentifier); 1204 IDBError error; 1205 { 1206 LockHolder locker(m_backingStoreLock); 1207 error = m_backingStore->deleteIndex(transactionIdentifier, objectStoreIdentifier, indexIdentifier, locker); 1208 } 1169 1209 1170 1210 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformDeleteIndex, callbackIdentifier, error, objectStoreIdentifier, indexIdentifier)); … … 1230 1270 1231 1271 ASSERT(m_backingStore); 1232 m_backingStore->renameIndex(transactionIdentifier, objectStoreIdentifier, indexIdentifier, newName); 1272 { 1273 LockHolder locker(m_backingStoreLock); 1274 m_backingStore->renameIndex(transactionIdentifier, objectStoreIdentifier, indexIdentifier, newName, locker); 1275 } 1233 1276 1234 1277 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformRenameIndex, callbackIdentifier, error, objectStoreIdentifier, indexIdentifier, newName)); … … 1300 1343 } 1301 1344 1302 if (!m_backingStore) { 1303 RELEASE_LOG_ERROR(IndexedDB, "%p - UniqueIDBDatabase::performPutOrAdd: m_backingStore is null", this); 1304 error = IDBError(InvalidStateError, "Backing store is invalid for call to put or add"_s); 1305 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); 1306 return; 1307 } 1308 1309 auto* objectStoreInfo = m_backingStore->infoForObjectStore(objectStoreIdentifier); 1310 if (!objectStoreInfo) { 1311 error = IDBError(InvalidStateError, "Object store cannot be found in the backing store"_s); 1312 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); 1313 return; 1314 } 1315 1316 bool usedKeyIsGenerated = false; 1317 uint64_t keyNumber; 1318 auto generatedKeyResetter = WTF::makeScopeExit([this, transactionIdentifier, objectStoreIdentifier, &keyNumber, &usedKeyIsGenerated]() { 1319 if (usedKeyIsGenerated) 1320 m_backingStore->revertGeneratedKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber); 1321 }); 1322 if (objectStoreInfo->autoIncrement() && !keyData.isValid()) { 1323 error = m_backingStore->generateKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber); 1345 { 1346 LockHolder locker(m_backingStoreLock); 1347 if (!m_backingStore) { 1348 RELEASE_LOG_ERROR(IndexedDB, "%p - UniqueIDBDatabase::performPutOrAdd: m_backingStore is null", this); 1349 error = IDBError(InvalidStateError, "Backing store is invalid for call to put or add"_s); 1350 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); 1351 return; 1352 } 1353 1354 auto* objectStoreInfo = m_backingStore->infoForObjectStore(objectStoreIdentifier, locker); 1355 if (!objectStoreInfo) { 1356 error = IDBError(InvalidStateError, "Object store cannot be found in the backing store"_s); 1357 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); 1358 return; 1359 } 1360 1361 bool usedKeyIsGenerated = false; 1362 uint64_t keyNumber; 1363 auto generatedKeyResetter = WTF::makeScopeExit([this, transactionIdentifier, objectStoreIdentifier, &keyNumber, &usedKeyIsGenerated, &locker]() { 1364 if (usedKeyIsGenerated) 1365 m_backingStore->revertGeneratedKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber, locker); 1366 }); 1367 if (objectStoreInfo->autoIncrement() && !keyData.isValid()) { 1368 error = m_backingStore->generateKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber, locker); 1369 if (!error.isNull()) { 1370 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); 1371 return; 1372 } 1373 1374 usedKey.setNumberValue(keyNumber); 1375 usedKeyIsGenerated = true; 1376 } else 1377 usedKey = keyData; 1378 1379 if (overwriteMode == IndexedDB::ObjectStoreOverwriteMode::NoOverwrite) { 1380 bool keyExists; 1381 error = m_backingStore->keyExistsInObjectStore(transactionIdentifier, objectStoreIdentifier, usedKey, keyExists, locker); 1382 if (error.isNull() && keyExists) 1383 error = IDBError(ConstraintError, "Key already exists in the object store"_s); 1384 1385 if (!error.isNull()) { 1386 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); 1387 return; 1388 } 1389 } 1390 1391 // 3.4.1 Object Store Storage Operation 1392 // ...If a record already exists in store ... 1393 // then remove the record from store using the steps for deleting records from an object store... 1394 // This is important because formally deleting it from from the object store also removes it from the appropriate indexes. 1395 error = m_backingStore->deleteRange(transactionIdentifier, objectStoreIdentifier, usedKey, locker); 1324 1396 if (!error.isNull()) { 1325 1397 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); 1326 1398 return; 1327 1399 } 1328 1329 usedKey.setNumberValue(keyNumber); 1330 usedKeyIsGenerated = true; 1331 } else 1332 usedKey = keyData; 1333 1334 if (overwriteMode == IndexedDB::ObjectStoreOverwriteMode::NoOverwrite) { 1335 bool keyExists; 1336 error = m_backingStore->keyExistsInObjectStore(transactionIdentifier, objectStoreIdentifier, usedKey, keyExists); 1337 if (error.isNull() && keyExists) 1338 error = IDBError(ConstraintError, "Key already exists in the object store"_s); 1400 1401 error = m_backingStore->addRecord(transactionIdentifier, *objectStoreInfo, usedKey, originalRecordValue, locker); 1339 1402 1340 1403 if (!error.isNull()) { … … 1342 1405 return; 1343 1406 } 1344 } 1345 1346 // 3.4.1 Object Store Storage Operation 1347 // ...If a record already exists in store ... 1348 // then remove the record from store using the steps for deleting records from an object store... 1349 // This is important because formally deleting it from from the object store also removes it from the appropriate indexes. 1350 error = m_backingStore->deleteRange(transactionIdentifier, objectStoreIdentifier, usedKey); 1351 if (!error.isNull()) { 1352 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); 1353 return; 1354 } 1355 1356 error = m_backingStore->addRecord(transactionIdentifier, *objectStoreInfo, usedKey, originalRecordValue); 1357 1358 if (!error.isNull()) { 1359 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); 1360 return; 1361 } 1362 1363 if (overwriteMode != IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor && objectStoreInfo->autoIncrement() && keyData.type() == IndexedDB::KeyType::Number) 1364 error = m_backingStore->maybeUpdateKeyGeneratorNumber(transactionIdentifier, objectStoreIdentifier, keyData.number()); 1365 1366 generatedKeyResetter.release(); 1407 1408 if (overwriteMode != IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor && objectStoreInfo->autoIncrement() && keyData.type() == IndexedDB::KeyType::Number) 1409 error = m_backingStore->maybeUpdateKeyGeneratorNumber(transactionIdentifier, objectStoreIdentifier, keyData.number(), locker); 1410 1411 generatedKeyResetter.release(); 1412 } 1367 1413 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey)); 1368 1414 } … … 1434 1480 1435 1481 IDBGetResult result; 1436 IDBError error = m_backingStore->getRecord(transactionIdentifier, objectStoreIdentifier, keyRangeData, type, result); 1482 IDBError error; 1483 { 1484 LockHolder locker(m_backingStoreLock); 1485 error = m_backingStore->getRecord(transactionIdentifier, objectStoreIdentifier, keyRangeData, type, result, locker); 1486 } 1437 1487 1438 1488 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformGetRecord, callbackIdentifier, error, result)); … … 1445 1495 1446 1496 ASSERT(m_backingStore); 1447 1448 1497 IDBGetResult result; 1449 IDBError error = m_backingStore->getIndexRecord(transactionIdentifier, objectStoreIdentifier, indexIdentifier, recordType, range, result); 1498 IDBError error; 1499 { 1500 LockHolder locker(m_backingStoreLock); 1501 error = m_backingStore->getIndexRecord(transactionIdentifier, objectStoreIdentifier, indexIdentifier, recordType, range, result, locker); 1502 } 1450 1503 1451 1504 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformGetRecord, callbackIdentifier, error, result)); … … 1468 1521 1469 1522 IDBGetAllResult result; 1470 IDBError error = m_backingStore->getAllRecords(transactionIdentifier, getAllRecordsData, result); 1523 IDBError error; 1524 { 1525 LockHolder locker(m_backingStoreLock); 1526 error = m_backingStore->getAllRecords(transactionIdentifier, getAllRecordsData, result, locker); 1527 } 1471 1528 1472 1529 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformGetAllRecords, callbackIdentifier, error, WTFMove(result))); … … 1512 1569 1513 1570 uint64_t count; 1514 IDBError error = m_backingStore->getCount(transactionIdentifier, objectStoreIdentifier, indexIdentifier, keyRangeData, count); 1571 IDBError error; 1572 { 1573 LockHolder locker(m_backingStoreLock); 1574 error = m_backingStore->getCount(transactionIdentifier, objectStoreIdentifier, indexIdentifier, keyRangeData, count, locker); 1575 } 1515 1576 1516 1577 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformGetCount, callbackIdentifier, error, count)); … … 1552 1613 LOG(IndexedDB, "(db) UniqueIDBDatabase::performDeleteRecord"); 1553 1614 1554 IDBError error = m_backingStore->deleteRange(transactionIdentifier, objectStoreIdentifier, range); 1615 IDBError error; 1616 { 1617 LockHolder locker(m_backingStoreLock); 1618 error = m_backingStore->deleteRange(transactionIdentifier, objectStoreIdentifier, range, locker); 1619 } 1555 1620 1556 1621 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformDeleteRecord, callbackIdentifier, error)); … … 1593 1658 1594 1659 IDBGetResult result; 1595 IDBError error = m_backingStore->openCursor(transactionIdentifier, info, result); 1660 IDBError error; 1661 { 1662 LockHolder locker(m_backingStoreLock); 1663 error = m_backingStore->openCursor(transactionIdentifier, info, result, locker); 1664 } 1596 1665 1597 1666 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformOpenCursor, callbackIdentifier, error, result)); … … 1634 1703 1635 1704 IDBGetResult result; 1636 IDBError error = m_backingStore->iterateCursor(transactionIdentifier, cursorIdentifier, data, result); 1705 IDBError error; 1706 { 1707 LockHolder locker(m_backingStoreLock); 1708 error = m_backingStore->iterateCursor(transactionIdentifier, cursorIdentifier, data, result, locker); 1709 } 1637 1710 1638 1711 if (error.isNull()) { … … 1651 1724 LOG(IndexedDB, "(db) UniqueIDBDatabase::performPrefetchCursor"); 1652 1725 1653 if (m_hardClosedForUserDelete || !m_backingStore->prefetchCursor(transactionIdentifier, cursorIdentifier))1726 if (m_hardClosedForUserDelete) { 1654 1727 m_cursorPrefetches.remove(cursorIdentifier); 1655 else 1656 postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performPrefetchCursor, transactionIdentifier, cursorIdentifier)); 1728 return; 1729 } 1730 1731 { 1732 LockHolder locker(m_backingStoreLock); 1733 if (!m_backingStore->prefetchCursor(transactionIdentifier, cursorIdentifier, locker)) { 1734 m_cursorPrefetches.remove(cursorIdentifier); 1735 return; 1736 } 1737 } 1738 1739 postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performPrefetchCursor, transactionIdentifier, cursorIdentifier)); 1657 1740 } 1658 1741 … … 1719 1802 LOG(IndexedDB, "(db) UniqueIDBDatabase::performCommitTransaction - %s", transactionIdentifier.loggingString().utf8().data()); 1720 1803 1721 IDBError error = m_backingStore->commitTransaction(transactionIdentifier); 1804 IDBError error; 1805 { 1806 LockHolder locker(m_backingStoreLock); 1807 error = m_backingStore->commitTransaction(transactionIdentifier, locker); 1808 } 1722 1809 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformCommitTransaction, callbackIdentifier, error, transactionIdentifier)); 1723 1810 } … … 1809 1896 LOG(IndexedDB, "(db) UniqueIDBDatabase::performAbortTransaction - %s", transactionIdentifier.loggingString().utf8().data()); 1810 1897 1811 IDBError error = m_backingStore->abortTransaction(transactionIdentifier); 1898 IDBError error; 1899 { 1900 LockHolder locker(m_backingStoreLock); 1901 error = m_backingStore->abortTransaction(transactionIdentifier, locker); 1902 } 1812 1903 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformAbortTransaction, callbackIdentifier, error, transactionIdentifier)); 1813 1904 } … … 2019 2110 LOG(IndexedDB, "(db) UniqueIDBDatabase::performActivateTransactionInBackingStore"); 2020 2111 2021 IDBError error = m_backingStore->beginTransaction(info); 2112 IDBError error; 2113 { 2114 LockHolder locker(m_backingStoreLock); 2115 error = m_backingStore->beginTransaction(info, locker); 2116 } 2117 2022 2118 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformActivateTransactionInBackingStore, callbackIdentifier, error)); 2023 2119 } … … 2352 2448 } 2353 2449 2354 void UniqueIDBDatabase::abortTransactionOnMainThread(UniqueIDBDatabaseTransaction& transaction )2355 { 2356 transaction.setResult(m_backingStore->abortTransaction(transaction.info().identifier() ));2450 void UniqueIDBDatabase::abortTransactionOnMainThread(UniqueIDBDatabaseTransaction& transaction, const LockHolder& locker) 2451 { 2452 transaction.setResult(m_backingStore->abortTransaction(transaction.info().identifier(), locker)); 2357 2453 transaction.setState(UniqueIDBDatabaseTransaction::State::Aborted); 2358 2454 } 2359 2455 2360 void UniqueIDBDatabase::commitTransactionOnMainThread(UniqueIDBDatabaseTransaction& transaction )2361 { 2362 transaction.setResult(m_backingStore->commitTransaction(transaction.info().identifier() ));2456 void UniqueIDBDatabase::commitTransactionOnMainThread(UniqueIDBDatabaseTransaction& transaction, const LockHolder& locker) 2457 { 2458 transaction.setResult(m_backingStore->commitTransaction(transaction.info().identifier(), locker)); 2363 2459 transaction.setState(UniqueIDBDatabaseTransaction::State::Committed); 2364 2460 } 2365 2461 2366 void UniqueIDBDatabase::finishActiveTransactions() 2367 { 2368 ASSERT(isMainThread()); 2369 2370 for (auto& identifier : copyToVector(m_inProgressTransactions.keys())) { 2371 auto transaction = m_inProgressTransactions.get(identifier); 2372 abortTransactionOnMainThread(*transaction); 2373 } 2374 2375 for (auto& identifier : copyToVector(m_finishingTransactions.keys())) { 2376 if (!m_backingStore->hasTransaction(identifier)) 2377 continue; 2378 2379 auto transaction = m_finishingTransactions.get(identifier); 2380 switch (transaction->state()) { 2381 case UniqueIDBDatabaseTransaction::State::Aborting: 2382 abortTransactionOnMainThread(*transaction); 2383 break; 2384 case UniqueIDBDatabaseTransaction::State::Committing: 2385 commitTransactionOnMainThread(*transaction); 2386 break; 2387 case UniqueIDBDatabaseTransaction::State::Running: 2388 case UniqueIDBDatabaseTransaction::State::Aborted: 2389 case UniqueIDBDatabaseTransaction::State::Committed: 2390 ASSERT_NOT_REACHED(); 2391 } 2392 } 2462 void UniqueIDBDatabase::suspend() 2463 { 2464 ASSERT(isMainThread()); 2465 2466 if (m_isSuspended) 2467 return; 2468 m_isSuspended = true; 2469 2470 { 2471 LockHolder locker(m_backingStoreLock); 2472 for (auto& identifier : copyToVector(m_inProgressTransactions.keys())) { 2473 auto transaction = m_inProgressTransactions.get(identifier); 2474 abortTransactionOnMainThread(*transaction, locker); 2475 } 2476 2477 for (auto& identifier : copyToVector(m_finishingTransactions.keys())) { 2478 if (!m_backingStore->hasTransaction(identifier, locker)) 2479 continue; 2480 2481 auto transaction = m_finishingTransactions.get(identifier); 2482 switch (transaction->state()) { 2483 case UniqueIDBDatabaseTransaction::State::Aborting: 2484 abortTransactionOnMainThread(*transaction, locker); 2485 break; 2486 case UniqueIDBDatabaseTransaction::State::Committing: 2487 commitTransactionOnMainThread(*transaction, locker); 2488 break; 2489 case UniqueIDBDatabaseTransaction::State::Running: 2490 case UniqueIDBDatabaseTransaction::State::Aborted: 2491 case UniqueIDBDatabaseTransaction::State::Committed: 2492 ASSERT_NOT_REACHED(); 2493 } 2494 } 2495 } 2496 2497 m_backingStoreLock.lock(); 2498 } 2499 2500 void UniqueIDBDatabase::resume() 2501 { 2502 ASSERT(isMainThread()); 2503 2504 if (!m_isSuspended) 2505 return; 2506 m_isSuspended = false; 2507 2508 ASSERT(m_backingStoreLock.isHeld()); 2509 m_backingStoreLock.unlock(); 2393 2510 } 2394 2511 -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
r252060 r252787 117 117 bool hardClosedForUserDelete() const { return m_hardClosedForUserDelete; } 118 118 119 void finishActiveTransactions(); 119 void suspend(); 120 void resume(); 120 121 121 122 private: … … 233 234 234 235 bool prepareToFinishTransaction(UniqueIDBDatabaseTransaction&, UniqueIDBDatabaseTransaction::State); 235 void abortTransactionOnMainThread(UniqueIDBDatabaseTransaction& );236 void commitTransactionOnMainThread(UniqueIDBDatabaseTransaction& );237 236 void abortTransactionOnMainThread(UniqueIDBDatabaseTransaction&, const LockHolder&); 237 void commitTransactionOnMainThread(UniqueIDBDatabaseTransaction&, const LockHolder&); 238 238 239 void clearStalePendingOpenDBRequests(); 239 240 … … 270 271 bool m_isOpeningBackingStore { false }; 271 272 IDBError m_backingStoreOpenError; 273 274 // Usually IDBBackingStore activities happens on the background thread only, but on process suspension, 275 // we need to force transactions of IDBBackingStore to stop on the main thread, and we need to make sure 276 // no IDBBackingStore activity can happen after process acknowledges suspension. 277 Lock m_backingStoreLock; 272 278 std::unique_ptr<IDBBackingStore> m_backingStore; 273 279 std::unique_ptr<IDBDatabaseInfo> m_databaseInfo; … … 307 313 308 314 HashMap<uint64_t, uint64_t> m_pendingSpaceIncreaseTasks; 315 316 bool m_isSuspended { false }; 309 317 }; 310 318
Note:
See TracChangeset
for help on using the changeset viewer.