Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Side by Side Diff: content/browser/indexed_db/indexed_db_transaction_coordinator.h

Issue 2472213003: [IndexedDB] Refactoring to remove ref ptrs and host transaction ids. (Closed)
Patch Set: comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <vector> 13 #include <vector>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h"
17 #include "content/browser/indexed_db/list_set.h" 16 #include "content/browser/indexed_db/list_set.h"
18 17
19 namespace content { 18 namespace content {
20 19
21 class IndexedDBTransaction; 20 class IndexedDBTransaction;
22 21
23 // Transactions are executed in the order the were created. 22 // Transactions are executed in the order the were created.
24 class IndexedDBTransactionCoordinator { 23 class IndexedDBTransactionCoordinator {
25 public: 24 public:
26 IndexedDBTransactionCoordinator(); 25 IndexedDBTransactionCoordinator();
27 ~IndexedDBTransactionCoordinator(); 26 ~IndexedDBTransactionCoordinator();
28 27
29 // Called by transactions as they start and finish. 28 // Called by transactions as they start and finish.
30 void DidCreateTransaction(scoped_refptr<IndexedDBTransaction> transaction); 29 void DidCreateTransaction(IndexedDBTransaction* transaction);
31 void DidFinishTransaction(IndexedDBTransaction* transaction); 30 void DidFinishTransaction(IndexedDBTransaction* transaction);
32 31
33 bool IsRunningVersionChangeTransaction() const; 32 bool IsRunningVersionChangeTransaction() const;
34 33
35 #ifndef NDEBUG 34 #ifndef NDEBUG
36 bool IsActive(IndexedDBTransaction* transaction); 35 bool IsActive(IndexedDBTransaction* transaction);
37 #endif 36 #endif
38 37
39 // Makes a snapshot of the transaction queue. For diagnostics only. 38 // Makes a snapshot of the transaction queue. For diagnostics only.
40 std::vector<const IndexedDBTransaction*> GetTransactions() const; 39 std::vector<const IndexedDBTransaction*> GetTransactions() const;
41 40
42 private: 41 private:
43 void ProcessQueuedTransactions(); 42 void ProcessQueuedTransactions();
44 bool CanStartTransaction(IndexedDBTransaction* const transaction, 43 bool CanStartTransaction(IndexedDBTransaction* const transaction,
45 const std::set<int64_t>& locked_scope) const; 44 const std::set<int64_t>& locked_scope) const;
46 45
47 // Transactions in different states are grouped below. 46 // Transactions in different states are grouped below.
48 // list_set is used to provide stable ordering; required by spec 47 // list_set is used to provide stable ordering; required by spec
49 // for the queue, convenience for diagnostics for the rest. 48 // for the queue, convenience for diagnostics for the rest.
50 list_set<scoped_refptr<IndexedDBTransaction>> queued_transactions_; 49 list_set<IndexedDBTransaction*> queued_transactions_;
51 list_set<scoped_refptr<IndexedDBTransaction>> started_transactions_; 50 list_set<IndexedDBTransaction*> started_transactions_;
52 51
53 DISALLOW_COPY_AND_ASSIGN(IndexedDBTransactionCoordinator); 52 DISALLOW_COPY_AND_ASSIGN(IndexedDBTransactionCoordinator);
54 }; 53 };
55 54
56 } // namespace content 55 } // namespace content
57 56
58 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ 57 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698