void IDBDatabase::willAbortTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::willAbortTransaction"); auto refTransaction = m_activeTransactions.take(transaction.info().identifier()); ASSERT(refTransaction); m_abortingTransactions.set(transaction.info().identifier(), WTF::move(refTransaction)); }
void IDBDatabase::willCommitTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::willCommitTransaction %s", transaction.info().identifier().loggingString().utf8().data()); auto refTransaction = m_activeTransactions.take(transaction.info().identifier()); ASSERT(refTransaction); m_committingTransactions.set(transaction.info().identifier(), WTFMove(refTransaction)); }
void IDBDatabase::didCommitTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::didCommitTransaction %s", transaction.info().identifier().loggingString().utf8().data()); if (m_versionChangeTransaction == &transaction) m_info.setVersion(transaction.info().newVersion()); didCommitOrAbortTransaction(transaction); }
void IDBConnectionToServer::abortTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBConnectionToServer::abortTransaction"); ASSERT(!m_abortingTransactions.contains(transaction.info().identifier())); m_abortingTransactions.set(transaction.info().identifier(), &transaction); auto identifier = transaction.info().identifier(); m_delegate->abortTransaction(identifier); }
void IDBConnectionProxy::abortTransaction(IDBTransaction& transaction) { { Locker<Lock> locker(m_transactionMapLock); ASSERT(!m_abortingTransactions.contains(transaction.info().identifier())); m_abortingTransactions.set(transaction.info().identifier(), &transaction); } callConnectionOnMainThread(&IDBConnectionToServer::abortTransaction, transaction.info().identifier()); }
void IDBDatabase::willAbortTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::willAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data()); auto refTransaction = m_activeTransactions.take(transaction.info().identifier()); ASSERT(refTransaction); m_abortingTransactions.set(transaction.info().identifier(), WTF::move(refTransaction)); if (transaction.isVersionChange()) m_closePending = true; }
void IDBDatabase::didStartTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::didStartTransaction %s", transaction.info().identifier().loggingString().utf8().data()); ASSERT(!m_versionChangeTransaction); // It is possible for the client to have aborted a transaction before the server replies back that it has started. if (m_abortingTransactions.contains(transaction.info().identifier())) return; m_activeTransactions.set(transaction.info().identifier(), &transaction); }
void IDBDatabase::didCommitOrAbortTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::didCommitOrAbortTransaction"); if (m_versionChangeTransaction == &transaction) m_versionChangeTransaction = nullptr; ASSERT(m_activeTransactions.contains(transaction.info().identifier()) || m_committingTransactions.contains(transaction.info().identifier())); m_activeTransactions.remove(transaction.info().identifier()); m_committingTransactions.remove(transaction.info().identifier()); }
bool IDBConnectionProxy::hasRecordOfTransaction(const IDBTransaction& transaction) const { ASSERT(m_transactionMapLock.isLocked()); auto identifier = transaction.info().identifier(); return m_pendingTransactions.contains(identifier) || m_committingTransactions.contains(identifier) || m_abortingTransactions.contains(identifier); }
void IDBDatabase::didStartTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::didStartTransaction"); ASSERT(!m_versionChangeTransaction); m_activeTransactions.set(transaction.info().identifier(), &transaction); }
void IDBDatabase::didCommitOrAbortTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::didCommitOrAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data()); if (m_versionChangeTransaction == &transaction) m_versionChangeTransaction = nullptr; #ifndef NDBEBUG unsigned count = 0; if (m_activeTransactions.contains(transaction.info().identifier())) ++count; if (m_committingTransactions.contains(transaction.info().identifier())) ++count; if (m_abortingTransactions.contains(transaction.info().identifier())) ++count; ASSERT(count == 1); #endif m_activeTransactions.remove(transaction.info().identifier()); m_committingTransactions.remove(transaction.info().identifier()); m_abortingTransactions.remove(transaction.info().identifier()); if (m_closePending) maybeCloseInServer(); }
void IDBConnectionToServer::establishTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBConnectionToServer::establishTransaction"); ASSERT(!hasRecordOfTransaction(transaction)); m_pendingTransactions.set(transaction.info().identifier(), &transaction); m_delegate->establishTransaction(transaction.database().databaseConnectionIdentifier(), transaction.info()); }
void IDBDatabase::didCommitTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::didCommitTransaction"); if (m_versionChangeTransaction == &transaction) m_info.setVersion(transaction.info().newVersion()); didCommitOrAbortTransaction(transaction); }
void IDBConnectionProxy::establishTransaction(IDBTransaction& transaction) { { Locker<Lock> locker(m_transactionMapLock); ASSERT(!hasRecordOfTransaction(transaction)); m_pendingTransactions.set(transaction.info().identifier(), &transaction); } callConnectionOnMainThread(&IDBConnectionToServer::establishTransaction, transaction.database().databaseConnectionIdentifier(), transaction.info()); }
void IDBDatabase::willAbortTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::willAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data()); ASSERT(&originThread() == &Thread::current()); auto refTransaction = m_activeTransactions.take(transaction.info().identifier()); if (!refTransaction) refTransaction = m_committingTransactions.take(transaction.info().identifier()); ASSERT(refTransaction); m_abortingTransactions.set(transaction.info().identifier(), WTFMove(refTransaction)); if (transaction.isVersionChange()) { ASSERT(transaction.originalDatabaseInfo()); m_info = *transaction.originalDatabaseInfo(); m_closePending = true; } }
void IDBDatabase::didAbortTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::didAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data()); if (transaction.isVersionChange()) { ASSERT(transaction.originalDatabaseInfo()); ASSERT(m_info.version() == transaction.originalDatabaseInfo()->version()); m_closePending = true; maybeCloseInServer(); } didCommitOrAbortTransaction(transaction); }
void IDBDatabase::didAbortTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::didAbortTransaction %s", transaction.info().identifier().loggingString().utf8().data()); if (transaction.isVersionChange()) { ASSERT(transaction.originalDatabaseInfo()); m_info = *transaction.originalDatabaseInfo(); m_closePending = true; m_closedInServer = true; m_serverConnection->databaseConnectionClosed(*this); } didCommitOrAbortTransaction(transaction); }
void IDBDatabase::didCommitOrAbortTransaction(IDBTransaction& transaction) { LOG(IndexedDB, "IDBDatabase::didCommitOrAbortTransaction"); if (m_versionChangeTransaction == &transaction) m_versionChangeTransaction = nullptr; #ifndef NDBEBUG unsigned count = 0; if (m_activeTransactions.contains(transaction.info().identifier())) ++count; if (m_committingTransactions.contains(transaction.info().identifier())) ++count; if (m_abortingTransactions.contains(transaction.info().identifier())) ++count; ASSERT(count == 1); #endif m_activeTransactions.remove(transaction.info().identifier()); m_committingTransactions.remove(transaction.info().identifier()); m_abortingTransactions.remove(transaction.info().identifier()); }
bool IDBConnectionToServer::hasRecordOfTransaction(const IDBTransaction& transaction) const { auto identifier = transaction.info().identifier(); return m_pendingTransactions.contains(identifier) || m_committingTransactions.contains(identifier) || m_abortingTransactions.contains(identifier); }
void IDBConnectionProxy::didFinishHandlingVersionChangeTransaction(uint64_t databaseConnectionIdentifier, IDBTransaction& transaction) { callConnectionOnMainThread(&IDBConnectionToServer::didFinishHandlingVersionChangeTransaction, databaseConnectionIdentifier, transaction.info().identifier()); }