Changeset 54162 in webkit
- Timestamp:
- Feb 1, 2010 3:32:44 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r54156 r54162 1 2010-02-01 Dumitru Daniliuc <dumi@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Making sure that all in-progress transactions are rolled back on 6 the database thread before they're destroyed. Otherwise, 7 SQLiteTransaction's destructor will try to do a rollback and that 8 would cause an assertion failure, if the object is not destroyed 9 on the DB thread. 10 11 https://bugs.webkit.org/show_bug.cgi?id=34152 12 13 * platform/sql/SQLiteTransaction.cpp: 14 (WebCore::SQLiteTransaction::stop): 15 * storage/SQLTransaction.cpp: 16 (WebCore::SQLTransaction::notifyDatabaseThreadIsShuttingDown): 17 * storage/SQLTransaction.h: 18 * storage/SQLTransactionCoordinator.cpp: 19 (WebCore::SQLTransactionCoordinator::shutdown): 20 1 21 2010-02-01 Sam Weinig <sam@webkit.org> 2 22 -
trunk/WebCore/platform/sql/SQLiteTransaction.cpp
r48897 r54162 65 65 void SQLiteTransaction::commit() 66 66 { 67 // FIXME: this code is buggy; it assumes that COMMIT always succeeds which is not the case: 68 // the transaction could've been silently rolled back before getting to the COMMIT statement 69 // (https://bugs.webkit.org/show_bug.cgi?id=34280). However, the rest of the code does not 70 // know how to deal with a premature rollback and a failed COMMIT at this moment, so until 71 // we figure out what to do with bug 34280, it's better to leave this code as it is. 67 72 if (m_inProgress) { 68 73 ASSERT(m_db.m_transactionInProgress); … … 85 90 void SQLiteTransaction::stop() 86 91 { 87 m_inProgress = false; 88 m_db.m_transactionInProgress = false; 92 if (m_inProgress) { 93 m_inProgress = false; 94 m_db.m_transactionInProgress = false; 95 } 89 96 } 90 97 -
trunk/WebCore/storage/SQLTransaction.cpp
r53595 r54162 36 36 #include "DatabaseAuthorizer.h" 37 37 #include "DatabaseDetails.h" 38 #include "DatabaseThread.h" 38 39 #include "ExceptionCode.h" 39 40 #include "Logging.h" … … 84 85 SQLTransaction::~SQLTransaction() 85 86 { 87 ASSERT(!m_sqliteTransaction); 86 88 } 87 89 … … 204 206 } 205 207 208 void SQLTransaction::notifyDatabaseThreadIsShuttingDown() 209 { 210 ASSERT(currentThread() == database()->scriptExecutionContext()->databaseThread()->getThreadID()); 211 212 // If the transaction is in progress, we should roll it back here, since this is our last 213 // oportunity to do something related to this transaction on the DB thread. 214 // Clearing m_sqliteTransaction invokes SQLiteTransaction's destructor which does just that. 215 m_sqliteTransaction.clear(); 216 } 217 206 218 void SQLTransaction::acquireLock() 207 219 { … … 492 504 LOG(StorageAPI, "Transaction %p is complete\n", this); 493 505 ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); 506 m_sqliteTransaction.clear(); 494 507 m_nextStep = 0; 495 508 -
trunk/WebCore/storage/SQLTransaction.h
r48653 r54162 81 81 Database* database() { return m_database.get(); } 82 82 bool isReadOnly() { return m_readOnly; } 83 void notifyDatabaseThreadIsShuttingDown(); 83 84 84 85 private: -
trunk/WebCore/storage/SQLTransactionCoordinator.cpp
r52060 r54162 110 110 void SQLTransactionCoordinator::shutdown() 111 111 { 112 // Notify all transactions in progress that the database thread is shutting down 113 for (CoordinationInfoMap::iterator coordinationInfoIterator = m_coordinationInfoMap.begin(); 114 coordinationInfoIterator != m_coordinationInfoMap.end(); ++coordinationInfoIterator) { 115 CoordinationInfo& info = coordinationInfoIterator->second; 116 if (info.activeWriteTransaction) 117 info.activeWriteTransaction->notifyDatabaseThreadIsShuttingDown(); 118 for (HashSet<RefPtr<SQLTransaction> >::iterator activeReadTransactionsIterator = 119 info.activeReadTransactions.begin(); 120 activeReadTransactionsIterator != info.activeReadTransactions.end(); 121 ++activeReadTransactionsIterator) { 122 (*activeReadTransactionsIterator)->notifyDatabaseThreadIsShuttingDown(); 123 } 124 } 125 112 126 // Clean up all pending transactions for all databases 113 127 m_coordinationInfoMap.clear();
Note: See TracChangeset
for help on using the changeset viewer.