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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 DCHECK(!IsRunningVersionChangeTransaction()); | 100 DCHECK(!IsRunningVersionChangeTransaction()); |
101 | 101 |
102 // The locked_scope set accumulates the ids of object stores in the scope of | 102 // The locked_scope set accumulates the ids of object stores in the scope of |
103 // running read/write transactions. Other read-write transactions with | 103 // running read/write transactions. Other read-write transactions with |
104 // stores in this set may not be started. Read-only transactions may start, | 104 // stores in this set may not be started. Read-only transactions may start, |
105 // taking a snapshot of the database, which does not include uncommitted | 105 // taking a snapshot of the database, which does not include uncommitted |
106 // data. ("Version change" transactions are exclusive, but handled by the | 106 // data. ("Version change" transactions are exclusive, but handled by the |
107 // connection sequencing in IndexedDBDatabase.) | 107 // connection sequencing in IndexedDBDatabase.) |
108 std::set<int64_t> locked_scope; | 108 std::set<int64_t> locked_scope; |
109 for (const auto& transaction : started_transactions_) { | 109 for (auto* transaction : started_transactions_) { |
110 if (transaction->mode() == blink::WebIDBTransactionModeReadWrite) { | 110 if (transaction->mode() == blink::WebIDBTransactionModeReadWrite) { |
111 // Started read/write transactions have exclusive access to the object | 111 // Started read/write transactions have exclusive access to the object |
112 // stores within their scopes. | 112 // stores within their scopes. |
113 locked_scope.insert(transaction->scope().begin(), | 113 locked_scope.insert(transaction->scope().begin(), |
114 transaction->scope().end()); | 114 transaction->scope().end()); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 auto it = queued_transactions_.begin(); | 118 auto it = queued_transactions_.begin(); |
119 while (it != queued_transactions_.end()) { | 119 while (it != queued_transactions_.end()) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 case blink::WebIDBTransactionModeReadOnly: | 169 case blink::WebIDBTransactionModeReadOnly: |
170 case blink::WebIDBTransactionModeReadWrite: | 170 case blink::WebIDBTransactionModeReadWrite: |
171 return !DoSetsIntersect(transaction->scope(), locked_scope); | 171 return !DoSetsIntersect(transaction->scope(), locked_scope); |
172 } | 172 } |
173 NOTREACHED(); | 173 NOTREACHED(); |
174 return false; | 174 return false; |
175 } | 175 } |
176 | 176 |
177 } // namespace content | 177 } // namespace content |
OLD | NEW |