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

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

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: rebase Created 3 years, 11 months 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 "content/browser/indexed_db/list_set.h" 16 #include "content/browser/indexed_db/list_set.h"
17 #include "content/common/content_export.h"
17 18
18 namespace content { 19 namespace content {
19 20
20 class IndexedDBTransaction; 21 class IndexedDBTransaction;
21 22
22 // Transactions are executed in the order the were created. 23 // Transactions are executed in the order the were created.
23 class IndexedDBTransactionCoordinator { 24 class CONTENT_EXPORT IndexedDBTransactionCoordinator {
24 public: 25 public:
25 IndexedDBTransactionCoordinator(); 26 IndexedDBTransactionCoordinator();
26 ~IndexedDBTransactionCoordinator(); 27 ~IndexedDBTransactionCoordinator();
27 28
28 // Called by transactions as they start and finish. 29 // Called by transactions as they start and finish.
29 void DidCreateTransaction(IndexedDBTransaction* transaction); 30 void DidCreateTransaction(IndexedDBTransaction* transaction);
31 void DidCreateObserverTransaction(IndexedDBTransaction* transaction);
30 void DidFinishTransaction(IndexedDBTransaction* transaction); 32 void DidFinishTransaction(IndexedDBTransaction* transaction);
31 33
32 bool IsRunningVersionChangeTransaction() const; 34 bool IsRunningVersionChangeTransaction() const;
33 35
34 #ifndef NDEBUG 36 #ifndef NDEBUG
35 bool IsActive(IndexedDBTransaction* transaction); 37 bool IsActive(IndexedDBTransaction* transaction);
36 #endif 38 #endif
37 39
38 // Makes a snapshot of the transaction queue. For diagnostics only. 40 // Makes a snapshot of the transaction queue. For diagnostics only.
39 std::vector<const IndexedDBTransaction*> GetTransactions() const; 41 std::vector<const IndexedDBTransaction*> GetTransactions() const;
40 42
41 private: 43 private:
44 friend class IndexedDBTransactionCoordinatorTest;
45
42 void ProcessQueuedTransactions(); 46 void ProcessQueuedTransactions();
43 bool CanStartTransaction(IndexedDBTransaction* const transaction, 47 bool CanStartTransaction(IndexedDBTransaction* const transaction,
44 const std::set<int64_t>& locked_scope) const; 48 const std::set<int64_t>& locked_scope) const;
45 49
46 // Transactions in different states are grouped below. 50 // Transactions in different states are grouped below.
47 // list_set is used to provide stable ordering; required by spec 51 // list_set is used to provide stable ordering; required by spec
48 // for the queue, convenience for diagnostics for the rest. 52 // for the queue, convenience for diagnostics for the rest.
49 list_set<IndexedDBTransaction*> queued_transactions_; 53 list_set<IndexedDBTransaction*> queued_transactions_;
50 list_set<IndexedDBTransaction*> started_transactions_; 54 list_set<IndexedDBTransaction*> started_transactions_;
51 55
52 DISALLOW_COPY_AND_ASSIGN(IndexedDBTransactionCoordinator); 56 DISALLOW_COPY_AND_ASSIGN(IndexedDBTransactionCoordinator);
53 }; 57 };
54 58
55 } // namespace content 59 } // namespace content
56 60
57 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_ 61 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698