| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // backend, the state function for Idle is unreachableState(). | 220 // backend, the state function for Idle is unreachableState(). |
| 221 // | 221 // |
| 222 // The states that send a request to their peer across the front/back boundary | 222 // The states that send a request to their peer across the front/back boundary |
| 223 // are implemented with just 2 functions: SQLTransaction::sendToBackendState() | 223 // are implemented with just 2 functions: SQLTransaction::sendToBackendState() |
| 224 // and SQLTransactionBackend::sendToFrontendState(). These state functions do | 224 // and SQLTransactionBackend::sendToFrontendState(). These state functions do |
| 225 // nothing but sends a request to the other side to transit to the current | 225 // nothing but sends a request to the other side to transit to the current |
| 226 // state (indicated by m_nextState), and then transits itself to the Idle state | 226 // state (indicated by m_nextState), and then transits itself to the Idle state |
| 227 // to wait for further action. | 227 // to wait for further action. |
| 228 | 228 |
| 229 | 229 |
| 230 // The Life-Cycle of a SQLTransaction i.e. Who's keeping the SQLTransaction aliv
e? | 230 // The Life-Cycle of a SQLTransaction i.e. Who's keeping the SQLTransaction aliv
e? |
| 231 // =============================================================================
= | 231 // =============================================================================
= |
| 232 // The RefPtr chain goes something like this: | 232 // The RefPtr chain goes something like this: |
| 233 // | 233 // |
| 234 // At birth (in DatabaseBackend::runTransaction()): | 234 // At birth (in DatabaseBackend::runTransaction()): |
| 235 // ==================================================== | 235 // ==================================================== |
| 236 // DatabaseBackend // Deque<RefPtr<SQLTransactionBackend>
> m_transactionQueue points to ... | 236 // DatabaseBackend // Deque<RefPtr<SQLTransactionBackend>
> m_transactionQueue points to ... |
| 237 // --> SQLTransactionBackend // RefPtr<SQLTransaction> m_frontend p
oints to ... | 237 // --> SQLTransactionBackend // RefPtr<SQLTransaction> m_frontend p
oints to ... |
| 238 // --> SQLTransaction // RefPtr<SQLTransactionBackend> m_bac
kend points to ... | 238 // --> SQLTransaction // RefPtr<SQLTransactionBackend> m_bac
kend points to ... |
| 239 // --> SQLTransactionBackend // which is a circular reference. | 239 // --> SQLTransactionBackend // which is a circular reference. |
| 240 // | 240 // |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // SQLTransactionBackend life-cycle. These are the phases and how the clean | 297 // SQLTransactionBackend life-cycle. These are the phases and how the clean |
| 298 // up is done: | 298 // up is done: |
| 299 // | 299 // |
| 300 // Phase 1. After Birth, before scheduling | 300 // Phase 1. After Birth, before scheduling |
| 301 // | 301 // |
| 302 // - To clean up, DatabaseThread::databaseThread() will call | 302 // - To clean up, DatabaseThread::databaseThread() will call |
| 303 // DatabaseBackend::close() during its shutdown. | 303 // DatabaseBackend::close() during its shutdown. |
| 304 // - DatabaseBackend::close() will iterate | 304 // - DatabaseBackend::close() will iterate |
| 305 // DatabaseBackend::m_transactionQueue and call | 305 // DatabaseBackend::m_transactionQueue and call |
| 306 // notifyDatabaseThreadIsShuttingDown() on each transaction there. | 306 // notifyDatabaseThreadIsShuttingDown() on each transaction there. |
| 307 // | 307 // |
| 308 // Phase 2. After scheduling, before state AcquireLock | 308 // Phase 2. After scheduling, before state AcquireLock |
| 309 // | 309 // |
| 310 // - If the interruption occures before the DatabaseTransactionTask is | 310 // - If the interruption occures before the DatabaseTransactionTask is |
| 311 // scheduled in DatabaseThread::m_queue but hasn't gotten to execute | 311 // scheduled in DatabaseThread::m_queue but hasn't gotten to execute |
| 312 // (i.e. DatabaseTransactionTask::performTask() has not been called), | 312 // (i.e. DatabaseTransactionTask::performTask() has not been called), |
| 313 // then the DatabaseTransactionTask may get destructed before it ever | 313 // then the DatabaseTransactionTask may get destructed before it ever |
| 314 // gets to execute. | 314 // gets to execute. |
| 315 // - To clean up, the destructor will check if the task's m_wasExecuted is | 315 // - To clean up, the destructor will check if the task's m_wasExecuted is |
| 316 // set. If not, it will call notifyDatabaseThreadIsShuttingDown() on | 316 // set. If not, it will call notifyDatabaseThreadIsShuttingDown() on |
| 317 // the task's transaction. | 317 // the task's transaction. |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 } | 829 } |
| 830 | 830 |
| 831 SQLTransactionState SQLTransactionBackend::sendToFrontendState() | 831 SQLTransactionState SQLTransactionBackend::sendToFrontendState() |
| 832 { | 832 { |
| 833 ASSERT(m_nextState != SQLTransactionState::Idle); | 833 ASSERT(m_nextState != SQLTransactionState::Idle); |
| 834 m_frontend->requestTransitToState(m_nextState); | 834 m_frontend->requestTransitToState(m_nextState); |
| 835 return SQLTransactionState::Idle; | 835 return SQLTransactionState::Idle; |
| 836 } | 836 } |
| 837 | 837 |
| 838 } // namespace WebCore | 838 } // namespace WebCore |
| OLD | NEW |