| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" | 5 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/indexed_db/indexed_db_transaction.h" | 8 #include "content/browser/indexed_db/indexed_db_transaction.h" |
| 9 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 9 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 DCHECK(!IsRunningVersionChangeTransaction()); | 91 DCHECK(!IsRunningVersionChangeTransaction()); |
| 92 | 92 |
| 93 // The locked_scope set accumulates the ids of object stores in the scope of | 93 // The locked_scope set accumulates the ids of object stores in the scope of |
| 94 // running read/write transactions. Other read-write transactions with | 94 // running read/write transactions. Other read-write transactions with |
| 95 // stores in this set may not be started. Read-only transactions may start, | 95 // stores in this set may not be started. Read-only transactions may start, |
| 96 // taking a snapshot of the database, which does not include uncommitted | 96 // taking a snapshot of the database, which does not include uncommitted |
| 97 // data. ("Version change" transactions are exclusive, but handled by the | 97 // data. ("Version change" transactions are exclusive, but handled by the |
| 98 // connection sequencing in IndexedDBDatabase.) | 98 // connection sequencing in IndexedDBDatabase.) |
| 99 std::set<int64_t> locked_scope; | 99 std::set<int64_t> locked_scope; |
| 100 for (const auto& transaction : started_transactions_) { | 100 for (auto* transaction : started_transactions_) { |
| 101 if (transaction->mode() == blink::WebIDBTransactionModeReadWrite) { | 101 if (transaction->mode() == blink::WebIDBTransactionModeReadWrite) { |
| 102 // Started read/write transactions have exclusive access to the object | 102 // Started read/write transactions have exclusive access to the object |
| 103 // stores within their scopes. | 103 // stores within their scopes. |
| 104 locked_scope.insert(transaction->scope().begin(), | 104 locked_scope.insert(transaction->scope().begin(), |
| 105 transaction->scope().end()); | 105 transaction->scope().end()); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 auto it = queued_transactions_.begin(); | 109 auto it = queued_transactions_.begin(); |
| 110 while (it != queued_transactions_.end()) { | 110 while (it != queued_transactions_.end()) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 case blink::WebIDBTransactionModeReadOnly: | 157 case blink::WebIDBTransactionModeReadOnly: |
| 158 case blink::WebIDBTransactionModeReadWrite: | 158 case blink::WebIDBTransactionModeReadWrite: |
| 159 return !DoSetsIntersect(transaction->scope(), locked_scope); | 159 return !DoSetsIntersect(transaction->scope(), locked_scope); |
| 160 } | 160 } |
| 161 NOTREACHED(); | 161 NOTREACHED(); |
| 162 return false; | 162 return false; |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace content | 165 } // namespace content |
| OLD | NEW |