Changeset 143489 in webkit
- Timestamp:
- Feb 20, 2013 1:10:18 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143487 r143489 1 2013-02-20 Mark Lam <mark.lam@apple.com> 2 3 Cleanup the SQLTransaction and SQLTransactionBackend state dispatch 4 to only honor a state transition request if the associated database 5 hasn't been interrupted. 6 https://bugs.webkit.org/show_bug.cgi?id=110247. 7 8 Reviewed by Antti Koivisto. 9 10 No new tests. 11 12 * Modules/webdatabase/SQLTransaction.cpp: 13 (WebCore::SQLTransaction::performPendingCallback): 14 (WebCore::SQLTransaction::computeNextStateAndCleanupIfNeeded): 15 * Modules/webdatabase/SQLTransaction.h: 16 * Modules/webdatabase/SQLTransactionBackend.cpp: 17 (WebCore::SQLTransactionBackend::computeNextStateAndCleanupIfNeeded): 18 (WebCore::SQLTransactionBackend::performNextStep): 19 * Modules/webdatabase/SQLTransactionBackend.h: 20 1 21 2013-02-20 Alexey Proskuryakov <ap@apple.com> 2 22 -
trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp
r143412 r143489 248 248 void SQLTransaction::performPendingCallback() 249 249 { 250 LOG(StorageAPI, "Callback %s\n", nameForSQLTransactionState(m_nextState)); 251 252 setStateToRequestedState(); 253 ASSERT(m_nextState == SQLTransactionState::End 254 || m_nextState == SQLTransactionState::DeliverTransactionCallback 255 || m_nextState == SQLTransactionState::DeliverTransactionErrorCallback 256 || m_nextState == SQLTransactionState::DeliverStatementCallback 257 || m_nextState == SQLTransactionState::DeliverQuotaIncreaseCallback 258 || m_nextState == SQLTransactionState::DeliverSuccessCallback); 259 260 checkAndHandleClosedOrInterruptedDatabase(); 250 computeNextStateAndCleanupIfNeeded(); 261 251 runStateMachine(); 262 252 } … … 279 269 } 280 270 281 bool SQLTransaction::checkAndHandleClosedOrInterruptedDatabase() 282 { 283 if (m_database->opened() && !m_database->isInterrupted()) 271 bool SQLTransaction::computeNextStateAndCleanupIfNeeded() 272 { 273 // Only honor the requested state transition if we're not supposed to be 274 // cleaning up and shutting down: 275 if (m_database->opened() && !m_database->isInterrupted()) { 276 setStateToRequestedState(); 277 ASSERT(m_nextState == SQLTransactionState::End 278 || m_nextState == SQLTransactionState::DeliverTransactionCallback 279 || m_nextState == SQLTransactionState::DeliverTransactionErrorCallback 280 || m_nextState == SQLTransactionState::DeliverStatementCallback 281 || m_nextState == SQLTransactionState::DeliverQuotaIncreaseCallback 282 || m_nextState == SQLTransactionState::DeliverSuccessCallback); 283 284 LOG(StorageAPI, "Callback %s\n", nameForSQLTransactionState(m_nextState)); 284 285 return false; 286 } 285 287 286 288 clearCallbackWrappers(); -
trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.h
r143412 r143489 69 69 bool readOnly); 70 70 71 bool checkAndHandleClosedOrInterruptedDatabase();72 71 void clearCallbackWrappers(); 73 72 … … 81 80 // State Machine functions: 82 81 virtual StateFunction stateFunctionFor(SQLTransactionState) OVERRIDE; 82 bool computeNextStateAndCleanupIfNeeded(); 83 83 84 84 // State functions: -
trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp
r143412 r143489 466 466 } 467 467 468 void SQLTransactionBackend::checkAndHandleClosedOrInterruptedDatabase() 469 { 470 if (m_database->opened() && !m_database->isInterrupted()) 468 void SQLTransactionBackend::computeNextStateAndCleanupIfNeeded() 469 { 470 // Only honor the requested state transition if we're not supposed to be 471 // cleaning up and shutting down: 472 if (m_database->opened() && !m_database->isInterrupted()) { 473 setStateToRequestedState(); 474 ASSERT(m_nextState == SQLTransactionState::AcquireLock 475 || m_nextState == SQLTransactionState::OpenTransactionAndPreflight 476 || m_nextState == SQLTransactionState::RunStatements 477 || m_nextState == SQLTransactionState::PostflightAndCommit 478 || m_nextState == SQLTransactionState::CleanupAndTerminate 479 || m_nextState == SQLTransactionState::CleanupAfterTransactionErrorCallback); 480 481 LOG(StorageAPI, "State %s\n", nameForSQLTransactionState(m_nextState)); 471 482 return; 483 } 484 485 if (m_nextState == SQLTransactionState::End) 486 return; 487 m_nextState = SQLTransactionState::End; 472 488 473 489 // If the database was stopped, don't do anything and cancel queued work … … 481 497 482 498 // Terminate the frontend state machine. This also gets the frontend to 483 // call c heckAndHandleClosedOrInterruptedDatabase() and clear its wrappers499 // call computeNextStateAndCleanupIfNeeded() and clear its wrappers 484 500 // if needed. 485 501 m_frontend->requestTransitToState(SQLTransactionState::End); … … 487 503 // Redirect to the end state to abort, clean up, and end the transaction. 488 504 doCleanup(); 489 m_nextState = SQLTransactionState::End;490 505 } 491 506 492 507 void SQLTransactionBackend::performNextStep() 493 508 { 494 LOG(StorageAPI, "State %s\n", nameForSQLTransactionState(m_nextState)); 495 496 setStateToRequestedState(); 497 ASSERT(m_nextState == SQLTransactionState::AcquireLock 498 || m_nextState == SQLTransactionState::OpenTransactionAndPreflight 499 || m_nextState == SQLTransactionState::RunStatements 500 || m_nextState == SQLTransactionState::PostflightAndCommit 501 || m_nextState == SQLTransactionState::CleanupAndTerminate 502 || m_nextState == SQLTransactionState::CleanupAfterTransactionErrorCallback); 503 504 checkAndHandleClosedOrInterruptedDatabase(); 509 computeNextStateAndCleanupIfNeeded(); 505 510 runStateMachine(); 506 511 } -
trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h
r143412 r143489 88 88 void enqueueStatementBackend(PassRefPtr<SQLStatementBackend>); 89 89 90 void checkAndHandleClosedOrInterruptedDatabase();91 92 90 // State Machine functions: 93 91 virtual StateFunction stateFunctionFor(SQLTransactionState) OVERRIDE; 92 void computeNextStateAndCleanupIfNeeded(); 94 93 95 94 // State functions:
Note: See TracChangeset
for help on using the changeset viewer.