| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 : m_isShuttingDown(false) {} | 46 : m_isShuttingDown(false) {} |
| 47 | 47 |
| 48 DEFINE_TRACE(SQLTransactionCoordinator) {} | 48 DEFINE_TRACE(SQLTransactionCoordinator) {} |
| 49 | 49 |
| 50 void SQLTransactionCoordinator::processPendingTransactions( | 50 void SQLTransactionCoordinator::processPendingTransactions( |
| 51 CoordinationInfo& info) { | 51 CoordinationInfo& info) { |
| 52 if (info.activeWriteTransaction || info.pendingTransactions.isEmpty()) | 52 if (info.activeWriteTransaction || info.pendingTransactions.isEmpty()) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 SQLTransactionBackend* firstPendingTransaction = | 55 SQLTransactionBackend* firstPendingTransaction = |
| 56 info.pendingTransactions.first(); | 56 info.pendingTransactions.front(); |
| 57 if (firstPendingTransaction->isReadOnly()) { | 57 if (firstPendingTransaction->isReadOnly()) { |
| 58 do { | 58 do { |
| 59 firstPendingTransaction = info.pendingTransactions.takeFirst(); | 59 firstPendingTransaction = info.pendingTransactions.takeFirst(); |
| 60 info.activeReadTransactions.insert(firstPendingTransaction); | 60 info.activeReadTransactions.insert(firstPendingTransaction); |
| 61 firstPendingTransaction->lockAcquired(); | 61 firstPendingTransaction->lockAcquired(); |
| 62 } while (!info.pendingTransactions.isEmpty() && | 62 } while (!info.pendingTransactions.isEmpty() && |
| 63 info.pendingTransactions.first()->isReadOnly()); | 63 info.pendingTransactions.front()->isReadOnly()); |
| 64 } else if (info.activeReadTransactions.isEmpty()) { | 64 } else if (info.activeReadTransactions.isEmpty()) { |
| 65 info.pendingTransactions.pop_front(); | 65 info.pendingTransactions.pop_front(); |
| 66 info.activeWriteTransaction = firstPendingTransaction; | 66 info.activeWriteTransaction = firstPendingTransaction; |
| 67 firstPendingTransaction->lockAcquired(); | 67 firstPendingTransaction->lockAcquired(); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 void SQLTransactionCoordinator::acquireLock( | 71 void SQLTransactionCoordinator::acquireLock( |
| 72 SQLTransactionBackend* transaction) { | 72 SQLTransactionBackend* transaction) { |
| 73 ASSERT(!m_isShuttingDown); | 73 ASSERT(!m_isShuttingDown); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 SQLTransactionBackend* transaction = info.pendingTransactions.takeFirst(); | 142 SQLTransactionBackend* transaction = info.pendingTransactions.takeFirst(); |
| 143 transaction->notifyDatabaseThreadIsShuttingDown(); | 143 transaction->notifyDatabaseThreadIsShuttingDown(); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Clean up all pending transactions for all databases | 147 // Clean up all pending transactions for all databases |
| 148 m_coordinationInfoMap.clear(); | 148 m_coordinationInfoMap.clear(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace blink | 151 } // namespace blink |
| OLD | NEW |