void Database::runTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback, bool readOnly) { m_transactionQueue.append(SQLTransaction::create(this, callback, errorCallback, successCallback, 0, readOnly)); MutexLocker locker(m_transactionInProgressMutex); if (!m_transactionInProgress) scheduleTransaction(); }
void Database::changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback) { m_transactionQueue.append(SQLTransaction::create(this, callback, errorCallback, successCallback, ChangeVersionWrapper::create(oldVersion, newVersion))); MutexLocker locker(m_transactionInProgressMutex); if (!m_transactionInProgress) scheduleTransaction(); }
void Database::runTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback, PassRefPtr<SQLTransactionWrapper> wrapper, bool readOnly) { MutexLocker locker(m_transactionInProgressMutex); if (!m_isTransactionQueueEnabled) { if (errorCallback) { RefPtr<SQLError> error = SQLError::create(SQLError::UNKNOWN_ERR, "database has been closed"); scriptExecutionContext()->postTask(createCallbackTask(&callTransactionErrorCallback, errorCallback, error.release())); } return; } RefPtr<SQLTransaction> transaction = SQLTransaction::create(this, callback, errorCallback, successCallback, wrapper, readOnly); m_transactionQueue.append(transaction.release()); if (!m_transactionInProgress) scheduleTransaction(); }
PassRefPtr<SQLTransactionBackend> Database::runTransaction(PassRefPtr<SQLTransaction> transaction, bool readOnly, const ChangeVersionData* data) { MutexLocker locker(m_transactionInProgressMutex); if (!m_isTransactionQueueEnabled) return 0; RefPtr<SQLTransactionWrapper> wrapper; if (data) wrapper = ChangeVersionWrapper::create(data->oldVersion(), data->newVersion()); RefPtr<SQLTransactionBackend> transactionBackend = SQLTransactionBackend::create(this, transaction, wrapper, readOnly); m_transactionQueue.append(transactionBackend); if (!m_transactionInProgress) scheduleTransaction(); return transactionBackend; }
void DatabaseBackend::inProgressTransactionCompleted() { MutexLocker locker(m_transactionInProgressMutex); m_transactionInProgress = false; scheduleTransaction(); }