| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return database->stringIdentifier(); | 43 return database->stringIdentifier(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 SQLTransactionCoordinator::SQLTransactionCoordinator() | 46 SQLTransactionCoordinator::SQLTransactionCoordinator() |
| 47 : m_isShuttingDown(false) | 47 : m_isShuttingDown(false) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 DEFINE_TRACE(SQLTransactionCoordinator) | 51 DEFINE_TRACE(SQLTransactionCoordinator) |
| 52 { | 52 { |
| 53 visitor->trace(m_coordinationInfoMap); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void SQLTransactionCoordinator::processPendingTransactions(CoordinationInfo& inf
o) | 56 void SQLTransactionCoordinator::processPendingTransactions(CoordinationInfo& inf
o) |
| 56 { | 57 { |
| 57 if (info.activeWriteTransaction || info.pendingTransactions.isEmpty()) | 58 if (info.activeWriteTransaction || info.pendingTransactions.isEmpty()) |
| 58 return; | 59 return; |
| 59 | 60 |
| 60 SQLTransactionBackend* firstPendingTransaction = info.pendingTransactions.fi
rst(); | 61 SQLTransactionBackend* firstPendingTransaction = info.pendingTransactions.fi
rst(); |
| 61 if (firstPendingTransaction->isReadOnly()) { | 62 if (firstPendingTransaction->isReadOnly()) { |
| 62 do { | 63 do { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // Notify all transactions in progress that the database thread is shutting
down | 123 // Notify all transactions in progress that the database thread is shutting
down |
| 123 for (CoordinationInfoHeapMap::iterator coordinationInfoIterator = m_coordina
tionInfoMap.begin(); | 124 for (CoordinationInfoHeapMap::iterator coordinationInfoIterator = m_coordina
tionInfoMap.begin(); |
| 124 coordinationInfoIterator != m_coordinationInfoMap.end(); ++coordination
InfoIterator) { | 125 coordinationInfoIterator != m_coordinationInfoMap.end(); ++coordination
InfoIterator) { |
| 125 CoordinationInfo& info = coordinationInfoIterator->value; | 126 CoordinationInfo& info = coordinationInfoIterator->value; |
| 126 | 127 |
| 127 // Clean up transactions that have reached "lockAcquired": | 128 // Clean up transactions that have reached "lockAcquired": |
| 128 // Transaction phase 4 cleanup. See comment on "What happens if a | 129 // Transaction phase 4 cleanup. See comment on "What happens if a |
| 129 // transaction is interrupted?" at the top of SQLTransactionBackend.cpp. | 130 // transaction is interrupted?" at the top of SQLTransactionBackend.cpp. |
| 130 if (info.activeWriteTransaction) | 131 if (info.activeWriteTransaction) |
| 131 info.activeWriteTransaction->notifyDatabaseThreadIsShuttingDown(); | 132 info.activeWriteTransaction->notifyDatabaseThreadIsShuttingDown(); |
| 132 for (auto& it : info.activeReadTransactions) { | 133 for (HeapHashSet<Member<SQLTransactionBackend>>::iterator activeReadTran
sactionsIterator = |
| 133 it->notifyDatabaseThreadIsShuttingDown(); | 134 info.activeReadTransactions.begin(); |
| 135 activeReadTransactionsIterator != info.activeReadTransactions.end()
; |
| 136 ++activeReadTransactionsIterator) { |
| 137 (*activeReadTransactionsIterator)->notifyDatabaseThreadIsShuttingDow
n(); |
| 134 } | 138 } |
| 135 | 139 |
| 136 // Clean up transactions that have NOT reached "lockAcquired": | 140 // Clean up transactions that have NOT reached "lockAcquired": |
| 137 // Transaction phase 3 cleanup. See comment on "What happens if a | 141 // Transaction phase 3 cleanup. See comment on "What happens if a |
| 138 // transaction is interrupted?" at the top of SQLTransactionBackend.cpp. | 142 // transaction is interrupted?" at the top of SQLTransactionBackend.cpp. |
| 139 while (!info.pendingTransactions.isEmpty()) { | 143 while (!info.pendingTransactions.isEmpty()) { |
| 140 SQLTransactionBackend* transaction = info.pendingTransactions.takeFi
rst(); | 144 SQLTransactionBackend* transaction = info.pendingTransactions.takeFi
rst(); |
| 141 transaction->notifyDatabaseThreadIsShuttingDown(); | 145 transaction->notifyDatabaseThreadIsShuttingDown(); |
| 142 } | 146 } |
| 143 } | 147 } |
| 144 | 148 |
| 145 // Clean up all pending transactions for all databases | 149 // Clean up all pending transactions for all databases |
| 146 m_coordinationInfoMap.clear(); | 150 m_coordinationInfoMap.clear(); |
| 147 } | 151 } |
| 148 | 152 |
| 149 } // namespace blink | 153 } // namespace blink |
| OLD | NEW |