| 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_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <stack> | 10 #include <stack> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 void AddPreemptiveEvent() { pending_preemptive_events_++; } | 63 void AddPreemptiveEvent() { pending_preemptive_events_++; } |
| 64 void DidCompletePreemptiveEvent() { | 64 void DidCompletePreemptiveEvent() { |
| 65 pending_preemptive_events_--; | 65 pending_preemptive_events_--; |
| 66 DCHECK_GE(pending_preemptive_events_, 0); | 66 DCHECK_GE(pending_preemptive_events_, 0); |
| 67 } | 67 } |
| 68 IndexedDBBackingStore::Transaction* BackingStoreTransaction() { | 68 IndexedDBBackingStore::Transaction* BackingStoreTransaction() { |
| 69 return &transaction_; | 69 return &transaction_; |
| 70 } | 70 } |
| 71 int64 id() const { return id_; } | 71 int64 id() const { return id_; } |
| 72 | 72 |
| 73 IndexedDBDatabase* database() const { return database_.get(); } | 73 IndexedDBDatabase* database() const { return database_; } |
| 74 IndexedDBDatabaseCallbacks* connection() const { | 74 IndexedDBDatabaseCallbacks* connection() const { return callbacks_; } |
| 75 return callbacks_.get(); | |
| 76 } | |
| 77 | 75 |
| 78 protected: | 76 protected: |
| 79 virtual ~IndexedDBTransaction(); | 77 virtual ~IndexedDBTransaction(); |
| 80 friend class base::RefCounted<IndexedDBTransaction>; | 78 friend class base::RefCounted<IndexedDBTransaction>; |
| 81 | 79 |
| 82 private: | 80 private: |
| 83 IndexedDBTransaction( | 81 IndexedDBTransaction(int64 id, |
| 84 int64 id, | 82 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, |
| 85 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, | 83 const std::set<int64>& object_store_ids, |
| 86 const std::set<int64>& object_store_ids, | 84 indexed_db::TransactionMode, |
| 87 indexed_db::TransactionMode, | 85 IndexedDBDatabase* db); |
| 88 IndexedDBDatabase* db); | |
| 89 | 86 |
| 90 enum State { | 87 enum State { |
| 91 UNUSED, // Created, but no tasks yet. | 88 UNUSED, // Created, but no tasks yet. |
| 92 START_PENDING, // Enqueued tasks, but backing store transaction not yet | 89 START_PENDING, // Enqueued tasks, but backing store transaction not yet |
| 93 // started. | 90 // started. |
| 94 RUNNING, // Backing store transaction started but not yet finished. | 91 RUNNING, // Backing store transaction started but not yet finished. |
| 95 FINISHED, // Either aborted or committed. | 92 FINISHED, // Either aborted or committed. |
| 96 }; | 93 }; |
| 97 | 94 |
| 98 void Start(); | 95 void Start(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 143 |
| 147 base::OneShotTimer<IndexedDBTransaction> task_timer_; | 144 base::OneShotTimer<IndexedDBTransaction> task_timer_; |
| 148 int pending_preemptive_events_; | 145 int pending_preemptive_events_; |
| 149 | 146 |
| 150 std::set<IndexedDBCursor*> open_cursors_; | 147 std::set<IndexedDBCursor*> open_cursors_; |
| 151 }; | 148 }; |
| 152 | 149 |
| 153 } // namespace content | 150 } // namespace content |
| 154 | 151 |
| 155 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ | 152 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ |
| OLD | NEW |