| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 | 113 |
| 114 processPendingTransactions(info); | 114 processPendingTransactions(info); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void SQLTransactionCoordinator::shutdown() { | 117 void SQLTransactionCoordinator::shutdown() { |
| 118 // Prevent releaseLock() from accessing / changing the coordinationInfo | 118 // Prevent releaseLock() from accessing / changing the coordinationInfo |
| 119 // while we're shutting down. | 119 // while we're shutting down. |
| 120 m_isShuttingDown = true; | 120 m_isShuttingDown = true; |
| 121 | 121 |
| 122 // Notify all transactions in progress that the database thread is shutting do
wn | 122 // Notify all transactions in progress that the database thread is shutting |
| 123 // down. |
| 123 for (CoordinationInfoHeapMap::iterator coordinationInfoIterator = | 124 for (CoordinationInfoHeapMap::iterator coordinationInfoIterator = |
| 124 m_coordinationInfoMap.begin(); | 125 m_coordinationInfoMap.begin(); |
| 125 coordinationInfoIterator != m_coordinationInfoMap.end(); | 126 coordinationInfoIterator != m_coordinationInfoMap.end(); |
| 126 ++coordinationInfoIterator) { | 127 ++coordinationInfoIterator) { |
| 127 CoordinationInfo& info = coordinationInfoIterator->value; | 128 CoordinationInfo& info = coordinationInfoIterator->value; |
| 128 | 129 |
| 129 // Clean up transactions that have reached "lockAcquired": | 130 // Clean up transactions that have reached "lockAcquired": |
| 130 // Transaction phase 4 cleanup. See comment on "What happens if a | 131 // Transaction phase 4 cleanup. See comment on "What happens if a |
| 131 // transaction is interrupted?" at the top of SQLTransactionBackend.cpp. | 132 // transaction is interrupted?" at the top of SQLTransactionBackend.cpp. |
| 132 if (info.activeWriteTransaction) | 133 if (info.activeWriteTransaction) |
| 133 info.activeWriteTransaction->notifyDatabaseThreadIsShuttingDown(); | 134 info.activeWriteTransaction->notifyDatabaseThreadIsShuttingDown(); |
| 134 for (auto& it : info.activeReadTransactions) { | 135 for (auto& it : info.activeReadTransactions) { |
| 135 it->notifyDatabaseThreadIsShuttingDown(); | 136 it->notifyDatabaseThreadIsShuttingDown(); |
| 136 } | 137 } |
| 137 | 138 |
| 138 // Clean up transactions that have NOT reached "lockAcquired": | 139 // Clean up transactions that have NOT reached "lockAcquired": |
| 139 // Transaction phase 3 cleanup. See comment on "What happens if a | 140 // Transaction phase 3 cleanup. See comment on "What happens if a |
| 140 // transaction is interrupted?" at the top of SQLTransactionBackend.cpp. | 141 // transaction is interrupted?" at the top of SQLTransactionBackend.cpp. |
| 141 while (!info.pendingTransactions.isEmpty()) { | 142 while (!info.pendingTransactions.isEmpty()) { |
| 142 SQLTransactionBackend* transaction = info.pendingTransactions.takeFirst(); | 143 SQLTransactionBackend* transaction = info.pendingTransactions.takeFirst(); |
| 143 transaction->notifyDatabaseThreadIsShuttingDown(); | 144 transaction->notifyDatabaseThreadIsShuttingDown(); |
| 144 } | 145 } |
| 145 } | 146 } |
| 146 | 147 |
| 147 // Clean up all pending transactions for all databases | 148 // Clean up all pending transactions for all databases |
| 148 m_coordinationInfoMap.clear(); | 149 m_coordinationInfoMap.clear(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 } // namespace blink | 152 } // namespace blink |
| OLD | NEW |