OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_connection.h" | 5 #include "content/browser/indexed_db/indexed_db_connection.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "content/browser/indexed_db/indexed_db_class_factory.h" | 9 #include "content/browser/indexed_db/indexed_db_class_factory.h" |
10 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" | 10 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 base::WeakPtr<IndexedDBTransaction> transaction_ptr = | 151 base::WeakPtr<IndexedDBTransaction> transaction_ptr = |
152 transaction->ptr_factory_.GetWeakPtr(); | 152 transaction->ptr_factory_.GetWeakPtr(); |
153 transactions_[transaction->id()] = std::move(transaction); | 153 transactions_[transaction->id()] = std::move(transaction); |
154 return transaction_ptr; | 154 return transaction_ptr; |
155 } | 155 } |
156 | 156 |
157 void IndexedDBConnection::RemoveTransaction(int64_t id) { | 157 void IndexedDBConnection::RemoveTransaction(int64_t id) { |
158 transactions_.erase(id); | 158 transactions_.erase(id); |
159 } | 159 } |
160 | 160 |
| 161 int64_t IndexedDBConnection::NewObserverTransactionId() { |
| 162 // When we overflow to 0, reset the ID to 1 (id of 0 is reserved for upgrade |
| 163 // transactions). |
| 164 if (next_observer_transaction_id_ == 0) |
| 165 next_observer_transaction_id_ = 1; |
| 166 return static_cast<int64_t>(next_observer_transaction_id_++) << 32; |
| 167 } |
| 168 |
161 } // namespace content | 169 } // namespace content |
OLD | NEW |