| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 ASSERT(state < SQLTransactionState::NumberOfStates); | 112 ASSERT(state < SQLTransactionState::NumberOfStates); |
| 113 | 113 |
| 114 return stateFunctions[static_cast<int>(state)]; | 114 return stateFunctions[static_cast<int>(state)]; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // requestTransitToState() can be called from the backend. Hence, it should | 117 // requestTransitToState() can be called from the backend. Hence, it should |
| 118 // NOT be modifying SQLTransactionBackend in general. The only safe field to | 118 // NOT be modifying SQLTransactionBackend in general. The only safe field to |
| 119 // modify is m_requestedState which is meant for this purpose. | 119 // modify is m_requestedState which is meant for this purpose. |
| 120 void SQLTransaction::requestTransitToState(SQLTransactionState nextState) | 120 void SQLTransaction::requestTransitToState(SQLTransactionState nextState) |
| 121 { | 121 { |
| 122 LOG(StorageAPI, "Scheduling %s for transaction %p\n", nameForSQLTransactionS
tate(nextState), this); | 122 LOG_INFO(StorageAPI, "Scheduling %s for transaction %p\n", nameForSQLTransac
tionState(nextState), this); |
| 123 m_requestedState = nextState; | 123 m_requestedState = nextState; |
| 124 m_database->scheduleTransactionCallback(this); | 124 m_database->scheduleTransactionCallback(this); |
| 125 } | 125 } |
| 126 | 126 |
| 127 SQLTransactionState SQLTransaction::nextStateForTransactionError() | 127 SQLTransactionState SQLTransaction::nextStateForTransactionError() |
| 128 { | 128 { |
| 129 ASSERT(m_transactionError); | 129 ASSERT(m_transactionError); |
| 130 if (m_errorCallbackWrapper.hasCallback()) | 130 if (m_errorCallbackWrapper.hasCallback()) |
| 131 return SQLTransactionState::DeliverTransactionErrorCallback; | 131 return SQLTransactionState::DeliverTransactionErrorCallback; |
| 132 | 132 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // cleaning up and shutting down: | 274 // cleaning up and shutting down: |
| 275 if (m_database->opened() && !m_database->isInterrupted()) { | 275 if (m_database->opened() && !m_database->isInterrupted()) { |
| 276 setStateToRequestedState(); | 276 setStateToRequestedState(); |
| 277 ASSERT(m_nextState == SQLTransactionState::End | 277 ASSERT(m_nextState == SQLTransactionState::End |
| 278 || m_nextState == SQLTransactionState::DeliverTransactionCallback | 278 || m_nextState == SQLTransactionState::DeliverTransactionCallback |
| 279 || m_nextState == SQLTransactionState::DeliverTransactionErrorCallba
ck | 279 || m_nextState == SQLTransactionState::DeliverTransactionErrorCallba
ck |
| 280 || m_nextState == SQLTransactionState::DeliverStatementCallback | 280 || m_nextState == SQLTransactionState::DeliverStatementCallback |
| 281 || m_nextState == SQLTransactionState::DeliverQuotaIncreaseCallback | 281 || m_nextState == SQLTransactionState::DeliverQuotaIncreaseCallback |
| 282 || m_nextState == SQLTransactionState::DeliverSuccessCallback); | 282 || m_nextState == SQLTransactionState::DeliverSuccessCallback); |
| 283 | 283 |
| 284 LOG(StorageAPI, "Callback %s\n", nameForSQLTransactionState(m_nextState)
); | 284 LOG_INFO(StorageAPI, "Callback %s\n", nameForSQLTransactionState(m_nextS
tate)); |
| 285 return false; | 285 return false; |
| 286 } | 286 } |
| 287 | 287 |
| 288 clearCallbackWrappers(); | 288 clearCallbackWrappers(); |
| 289 m_nextState = SQLTransactionState::CleanupAndTerminate; | 289 m_nextState = SQLTransactionState::CleanupAndTerminate; |
| 290 | 290 |
| 291 return true; | 291 return true; |
| 292 } | 292 } |
| 293 | 293 |
| 294 void SQLTransaction::clearCallbackWrappers() | 294 void SQLTransaction::clearCallbackWrappers() |
| 295 { | 295 { |
| 296 // Release the unneeded callbacks, to break reference cycles. | 296 // Release the unneeded callbacks, to break reference cycles. |
| 297 m_callbackWrapper.clear(); | 297 m_callbackWrapper.clear(); |
| 298 m_successCallbackWrapper.clear(); | 298 m_successCallbackWrapper.clear(); |
| 299 m_errorCallbackWrapper.clear(); | 299 m_errorCallbackWrapper.clear(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 } // namespace WebCore | 302 } // namespace WebCore |
| 303 | 303 |
| 304 #endif // ENABLE(SQL_DATABASE) | 304 #endif // ENABLE(SQL_DATABASE) |
| OLD | NEW |