| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 { | 84 { |
| 85 ASSERT(databaseContext()->databaseThread()); | 85 ASSERT(databaseContext()->databaseThread()); |
| 86 ASSERT(databaseContext()->databaseThread()->isDatabaseThread()); | 86 ASSERT(databaseContext()->databaseThread()->isDatabaseThread()); |
| 87 | 87 |
| 88 { | 88 { |
| 89 MutexLocker locker(m_transactionInProgressMutex); | 89 MutexLocker locker(m_transactionInProgressMutex); |
| 90 | 90 |
| 91 // Clean up transactions that have not been scheduled yet: | 91 // Clean up transactions that have not been scheduled yet: |
| 92 // Transaction phase 1 cleanup. See comment on "What happens if a | 92 // Transaction phase 1 cleanup. See comment on "What happens if a |
| 93 // transaction is interrupted?" at the top of SQLTransactionBackend.cpp. | 93 // transaction is interrupted?" at the top of SQLTransactionBackend.cpp. |
| 94 RefPtrWillBeRawPtr<SQLTransactionBackend> transaction; | 94 RefPtrWillBeRawPtr<SQLTransactionBackend> transaction = nullptr; |
| 95 while (!m_transactionQueue.isEmpty()) { | 95 while (!m_transactionQueue.isEmpty()) { |
| 96 transaction = m_transactionQueue.takeFirst(); | 96 transaction = m_transactionQueue.takeFirst(); |
| 97 transaction->notifyDatabaseThreadIsShuttingDown(); | 97 transaction->notifyDatabaseThreadIsShuttingDown(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 m_isTransactionQueueEnabled = false; | 100 m_isTransactionQueueEnabled = false; |
| 101 m_transactionInProgress = false; | 101 m_transactionInProgress = false; |
| 102 } | 102 } |
| 103 | 103 |
| 104 closeDatabase(); | 104 closeDatabase(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 127 void DatabaseBackend::inProgressTransactionCompleted() | 127 void DatabaseBackend::inProgressTransactionCompleted() |
| 128 { | 128 { |
| 129 MutexLocker locker(m_transactionInProgressMutex); | 129 MutexLocker locker(m_transactionInProgressMutex); |
| 130 m_transactionInProgress = false; | 130 m_transactionInProgress = false; |
| 131 scheduleTransaction(); | 131 scheduleTransaction(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void DatabaseBackend::scheduleTransaction() | 134 void DatabaseBackend::scheduleTransaction() |
| 135 { | 135 { |
| 136 ASSERT(!m_transactionInProgressMutex.tryLock()); // Locked by caller. | 136 ASSERT(!m_transactionInProgressMutex.tryLock()); // Locked by caller. |
| 137 RefPtrWillBeRawPtr<SQLTransactionBackend> transaction; | 137 RefPtrWillBeRawPtr<SQLTransactionBackend> transaction = nullptr; |
| 138 | 138 |
| 139 if (m_isTransactionQueueEnabled && !m_transactionQueue.isEmpty()) | 139 if (m_isTransactionQueueEnabled && !m_transactionQueue.isEmpty()) |
| 140 transaction = m_transactionQueue.takeFirst(); | 140 transaction = m_transactionQueue.takeFirst(); |
| 141 | 141 |
| 142 if (transaction && databaseContext()->databaseThread()) { | 142 if (transaction && databaseContext()->databaseThread()) { |
| 143 OwnPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(t
ransaction); | 143 OwnPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(t
ransaction); |
| 144 WTF_LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for transacti
on %p\n", task.get(), task->transaction()); | 144 WTF_LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for transacti
on %p\n", task.get(), task->transaction()); |
| 145 m_transactionInProgress = true; | 145 m_transactionInProgress = true; |
| 146 databaseContext()->databaseThread()->scheduleTask(task.release()); | 146 databaseContext()->databaseThread()->scheduleTask(task.release()); |
| 147 } else | 147 } else |
| (...skipping 14 matching lines...) Expand all Loading... |
| 162 { | 162 { |
| 163 return databaseContext()->databaseThread()->transactionClient(); | 163 return databaseContext()->databaseThread()->transactionClient(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 SQLTransactionCoordinator* DatabaseBackend::transactionCoordinator() const | 166 SQLTransactionCoordinator* DatabaseBackend::transactionCoordinator() const |
| 167 { | 167 { |
| 168 return databaseContext()->databaseThread()->transactionCoordinator(); | 168 return databaseContext()->databaseThread()->transactionCoordinator(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace WebCore | 171 } // namespace WebCore |
| OLD | NEW |