| 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> |
| 9 |
| 8 #include <map> | 10 #include <map> |
| 9 #include <set> | 11 #include <set> |
| 10 #include <vector> | 12 #include <vector> |
| 11 | 13 |
| 14 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 14 #include "content/browser/indexed_db/list_set.h" | 17 #include "content/browser/indexed_db/list_set.h" |
| 15 | 18 |
| 16 namespace content { | 19 namespace content { |
| 17 | 20 |
| 18 class IndexedDBTransaction; | 21 class IndexedDBTransaction; |
| 19 | 22 |
| 20 // Transactions are executed in the order the were created. | 23 // Transactions are executed in the order the were created. |
| 21 class IndexedDBTransactionCoordinator { | 24 class IndexedDBTransactionCoordinator { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 #endif | 37 #endif |
| 35 | 38 |
| 36 // Makes a snapshot of the transaction queue. For diagnostics only. | 39 // Makes a snapshot of the transaction queue. For diagnostics only. |
| 37 std::vector<const IndexedDBTransaction*> GetTransactions() const; | 40 std::vector<const IndexedDBTransaction*> GetTransactions() const; |
| 38 | 41 |
| 39 private: | 42 private: |
| 40 typedef list_set<scoped_refptr<IndexedDBTransaction> > TransactionSet; | 43 typedef list_set<scoped_refptr<IndexedDBTransaction> > TransactionSet; |
| 41 | 44 |
| 42 void ProcessQueuedTransactions(); | 45 void ProcessQueuedTransactions(); |
| 43 bool CanStartTransaction(IndexedDBTransaction* const transaction, | 46 bool CanStartTransaction(IndexedDBTransaction* const transaction, |
| 44 const std::set<int64>& locked_scope) const; | 47 const std::set<int64_t>& locked_scope) const; |
| 45 | 48 |
| 46 // Transactions in different states are grouped below. | 49 // Transactions in different states are grouped below. |
| 47 // list_set is used to provide stable ordering; required by spec | 50 // list_set is used to provide stable ordering; required by spec |
| 48 // for the queue, convenience for diagnostics for the rest. | 51 // for the queue, convenience for diagnostics for the rest. |
| 49 TransactionSet queued_transactions_; | 52 TransactionSet queued_transactions_; |
| 50 TransactionSet started_transactions_; | 53 TransactionSet started_transactions_; |
| 51 | 54 |
| 52 DISALLOW_COPY_AND_ASSIGN(IndexedDBTransactionCoordinator); | 55 DISALLOW_COPY_AND_ASSIGN(IndexedDBTransactionCoordinator); |
| 53 }; | 56 }; |
| 54 | 57 |
| 55 } // namespace content | 58 } // namespace content |
| 56 | 59 |
| 57 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ | 60 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ |
| OLD | NEW |