Chromium Code Reviews| 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 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <unordered_map> | |
|
cmumford
2016/11/04 23:33:13
Unused.
dmurph
2016/11/07 20:05:23
Done.
| |
| 13 #include <vector> | 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | |
| 17 #include "content/browser/indexed_db/list_set.h" | 17 #include "content/browser/indexed_db/list_set.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 class IndexedDBTransaction; | 21 class IndexedDBTransaction; |
| 22 | 22 |
| 23 // Transactions are executed in the order the were created. | 23 // Transactions are executed in the order the were created. |
| 24 class IndexedDBTransactionCoordinator { | 24 class IndexedDBTransactionCoordinator { |
| 25 public: | 25 public: |
| 26 IndexedDBTransactionCoordinator(); | 26 IndexedDBTransactionCoordinator(); |
| 27 ~IndexedDBTransactionCoordinator(); | 27 ~IndexedDBTransactionCoordinator(); |
| 28 | 28 |
| 29 // Called by transactions as they start and finish. | 29 // Called by transactions as they start and finish. |
| 30 void DidCreateTransaction(scoped_refptr<IndexedDBTransaction> transaction); | 30 void DidCreateTransaction(IndexedDBTransaction* transaction); |
| 31 void DidFinishTransaction(IndexedDBTransaction* transaction); | 31 void DidFinishTransaction(IndexedDBTransaction* transaction); |
| 32 | 32 |
| 33 bool IsRunningVersionChangeTransaction() const; | 33 bool IsRunningVersionChangeTransaction() const; |
| 34 | 34 |
| 35 #ifndef NDEBUG | 35 #ifndef NDEBUG |
| 36 bool IsActive(IndexedDBTransaction* transaction); | 36 bool IsActive(IndexedDBTransaction* transaction); |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 // Makes a snapshot of the transaction queue. For diagnostics only. | 39 // Makes a snapshot of the transaction queue. For diagnostics only. |
| 40 std::vector<const IndexedDBTransaction*> GetTransactions() const; | 40 std::vector<const IndexedDBTransaction*> GetTransactions() const; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 void ProcessQueuedTransactions(); | 43 void ProcessQueuedTransactions(); |
| 44 bool CanStartTransaction(IndexedDBTransaction* const transaction, | 44 bool CanStartTransaction(IndexedDBTransaction* const transaction, |
| 45 const std::set<int64_t>& locked_scope) const; | 45 const std::set<int64_t>& locked_scope) const; |
| 46 | 46 |
| 47 // Transactions in different states are grouped below. | 47 // Transactions in different states are grouped below. |
| 48 // list_set is used to provide stable ordering; required by spec | 48 // list_set is used to provide stable ordering; required by spec |
| 49 // for the queue, convenience for diagnostics for the rest. | 49 // for the queue, convenience for diagnostics for the rest. |
| 50 list_set<scoped_refptr<IndexedDBTransaction>> queued_transactions_; | 50 list_set<IndexedDBTransaction*> queued_transactions_; |
| 51 list_set<scoped_refptr<IndexedDBTransaction>> started_transactions_; | 51 list_set<IndexedDBTransaction*> started_transactions_; |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(IndexedDBTransactionCoordinator); | 53 DISALLOW_COPY_AND_ASSIGN(IndexedDBTransactionCoordinator); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace content | 56 } // namespace content |
| 57 | 57 |
| 58 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ | 58 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ |
| OLD | NEW |