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

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

Issue 110983004: IndexedDB: More database<->transaction relationship simplification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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 | Annotate | Revision Log
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 <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "content/browser/indexed_db/list_set.h" 14 #include "content/browser/indexed_db/list_set.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 class IndexedDBTransaction; 18 class IndexedDBTransaction;
19 19
20 // Transactions are executed in the order the were created. 20 // Transactions are executed in the order the were created.
21 class IndexedDBTransactionCoordinator { 21 class IndexedDBTransactionCoordinator {
22 public: 22 public:
23 IndexedDBTransactionCoordinator(); 23 IndexedDBTransactionCoordinator();
24 ~IndexedDBTransactionCoordinator(); 24 ~IndexedDBTransactionCoordinator();
25 25
26 // Called by transactions as they start and finish. 26 // Called by transactions as they start and finish.
27 void DidCreateTransaction(scoped_refptr<IndexedDBTransaction> transaction); 27 void DidCreateTransaction(scoped_refptr<IndexedDBTransaction> transaction);
28 void DidFinishTransaction(scoped_refptr<IndexedDBTransaction> transaction); 28 void DidFinishTransaction(IndexedDBTransaction* transaction);
29
30 bool IsRunningVersionChangeTransaction() const;
29 31
30 #ifndef NDEBUG 32 #ifndef NDEBUG
31 bool IsActive(IndexedDBTransaction* transaction); 33 bool IsActive(IndexedDBTransaction* transaction);
32 #endif 34 #endif
33 35
34 // Makes a snapshot of the transaction queue. For diagnostics only. 36 // Makes a snapshot of the transaction queue. For diagnostics only.
35 std::vector<const IndexedDBTransaction*> GetTransactions() const; 37 std::vector<const IndexedDBTransaction*> GetTransactions() const;
36 38
37 private: 39 private:
38 void ProcessQueuedTransactions(); 40 void ProcessQueuedTransactions();
39 bool CanStartTransaction(IndexedDBTransaction* const transaction, 41 bool CanStartTransaction(IndexedDBTransaction* const transaction,
40 const std::set<int64>& locked_scope) const; 42 const std::set<int64>& locked_scope) const;
41 43
42 // Transactions in different states are grouped below. 44 // Transactions in different states are grouped below.
43 // list_set is used to provide stable ordering; required by spec 45 // list_set is used to provide stable ordering; required by spec
44 // for the queue, convenience for diagnostics for the rest. 46 // for the queue, convenience for diagnostics for the rest.
45 typedef list_set<scoped_refptr<IndexedDBTransaction> > TransactionSet; 47 typedef list_set<scoped_refptr<IndexedDBTransaction> > TransactionSet;
46 TransactionSet queued_transactions_; 48 TransactionSet queued_transactions_;
47 TransactionSet started_transactions_; 49 TransactionSet started_transactions_;
48 }; 50 };
49 51
50 } // namespace content 52 } // namespace content
51 53
52 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ 54 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_transaction.cc ('k') | content/browser/indexed_db/indexed_db_transaction_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698