void IDBServer::unregisterTransaction(UniqueIDBDatabaseTransaction& transaction) { ASSERT(m_transactions.contains(transaction.info().identifier())); ASSERT(m_transactions.get(transaction.info().identifier()) == &transaction); m_transactions.remove(transaction.info().identifier()); }
void UniqueIDBDatabaseConnection::abortTransactionWithoutCallback(UniqueIDBDatabaseTransaction& transaction) { ASSERT(m_transactionMap.contains(transaction.info().identifier())); auto takenTransaction = m_transactionMap.take(transaction.info().identifier()); m_database.abortTransaction(*takenTransaction, [](const IDBError&) { }); }
void UniqueIDBDatabaseConnection::abortTransactionWithoutCallback(UniqueIDBDatabaseTransaction& transaction) { ASSERT(m_transactionMap.contains(transaction.info().identifier())); const auto& transactionIdentifier = transaction.info().identifier(); RefPtr<UniqueIDBDatabaseConnection> protectedThis(this); m_database.abortTransaction(transaction, [this, protectedThis, transactionIdentifier](const IDBError&) { ASSERT(m_transactionMap.contains(transactionIdentifier)); m_transactionMap.remove(transactionIdentifier); }); }
void UniqueIDBDatabaseConnection::didCommitTransaction(UniqueIDBDatabaseTransaction& transaction, const IDBError& error) { LOG(IndexedDB, "UniqueIDBDatabaseConnection::didCommitTransaction"); auto transactionIdentifier = transaction.info().identifier(); ASSERT(m_transactionMap.contains(transactionIdentifier)); m_transactionMap.remove(transactionIdentifier); m_connectionToClient.didCommitTransaction(transactionIdentifier, error); }
void UniqueIDBDatabaseConnection::didCommitTransaction(UniqueIDBDatabaseTransaction& transaction, const IDBError& error) { LOG(IndexedDB, "UniqueIDBDatabaseConnection::didCommitTransaction - %s - %" PRIu64, m_openRequestIdentifier.loggingString().utf8().data(), m_identifier); auto transactionIdentifier = transaction.info().identifier(); ASSERT(m_transactionMap.contains(transactionIdentifier)); m_transactionMap.remove(transactionIdentifier); m_connectionToClient.didCommitTransaction(transactionIdentifier, error); }
void UniqueIDBDatabaseConnection::didAbortTransaction(UniqueIDBDatabaseTransaction& transaction, const IDBError& error) { LOG(IndexedDB, "UniqueIDBDatabaseConnection::didAbortTransaction - %s - %" PRIu64, m_openRequestIdentifier.loggingString().utf8().data(), m_identifier); auto transactionIdentifier = transaction.info().identifier(); auto takenTransaction = m_transactionMap.take(transactionIdentifier); ASSERT(takenTransaction || m_database.hardClosedForUserDelete()); if (takenTransaction) m_connectionToClient.didAbortTransaction(transactionIdentifier, error); }
void UniqueIDBDatabase::commitTransaction(UniqueIDBDatabaseTransaction& transaction, ErrorCallback callback) { ASSERT(isMainThread()); LOG(IndexedDB, "(main) UniqueIDBDatabase::commitTransaction"); if (m_versionChangeTransaction == &transaction) { ASSERT(&m_versionChangeTransaction->databaseConnection() == m_versionChangeDatabaseConnection); m_databaseInfo->setVersion(transaction.info().newVersion()); m_versionChangeTransaction = nullptr; m_versionChangeDatabaseConnection = nullptr; } uint64_t callbackID = storeCallback(callback); m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performCommitTransaction, callbackID, transaction.info().identifier())); }
void IDBServer::registerTransaction(UniqueIDBDatabaseTransaction& transaction) { ASSERT(!m_transactions.contains(transaction.info().identifier())); m_transactions.set(transaction.info().identifier(), &transaction); }
void UniqueIDBDatabase::activateTransactionInBackingStore(UniqueIDBDatabaseTransaction& transaction) { LOG(IndexedDB, "(main) UniqueIDBDatabase::activateTransactionInBackingStore"); RefPtr<UniqueIDBDatabase> self(this); RefPtr<UniqueIDBDatabaseTransaction> refTransaction(&transaction); auto callback = [this, self, refTransaction](const IDBError& error) { refTransaction->didActivateInBackingStore(error); }; uint64_t callbackID = storeCallback(callback); m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performActivateTransactionInBackingStore, callbackID, transaction.info())); }
void UniqueIDBDatabase::abortTransaction(UniqueIDBDatabaseTransaction& transaction, ErrorCallback callback) { ASSERT(isMainThread()); LOG(IndexedDB, "(main) UniqueIDBDatabase::abortTransaction"); ASSERT(&transaction.databaseConnection().database() == this); uint64_t callbackID = storeCallback(callback); m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performAbortTransaction, callbackID, transaction.info().identifier())); }
void UniqueIDBDatabase::createIndex(UniqueIDBDatabaseTransaction& transaction, const IDBIndexInfo& info, ErrorCallback callback) { ASSERT(isMainThread()); LOG(IndexedDB, "(main) UniqueIDBDatabase::createIndex"); uint64_t callbackID = storeCallback(callback); m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performCreateIndex, callbackID, transaction.info().identifier(), info)); }
void UniqueIDBDatabase::clearObjectStore(UniqueIDBDatabaseTransaction& transaction, uint64_t objectStoreIdentifier, ErrorCallback callback) { ASSERT(isMainThread()); LOG(IndexedDB, "(main) UniqueIDBDatabase::clearObjectStore"); uint64_t callbackID = storeCallback(callback); m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performClearObjectStore, callbackID, transaction.info().identifier(), objectStoreIdentifier)); }