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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 public: | 125 public: |
126 TaskQueue(); | 126 TaskQueue(); |
127 ~TaskQueue(); | 127 ~TaskQueue(); |
128 bool empty() const { return queue_.empty(); } | 128 bool empty() const { return queue_.empty(); } |
129 void push(Operation task) { queue_.push(task); } | 129 void push(Operation task) { queue_.push(task); } |
130 Operation pop(); | 130 Operation pop(); |
131 void clear(); | 131 void clear(); |
132 | 132 |
133 private: | 133 private: |
134 std::queue<Operation> queue_; | 134 std::queue<Operation> queue_; |
| 135 |
| 136 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
135 }; | 137 }; |
136 | 138 |
137 class TaskStack { | 139 class TaskStack { |
138 public: | 140 public: |
139 TaskStack(); | 141 TaskStack(); |
140 ~TaskStack(); | 142 ~TaskStack(); |
141 bool empty() const { return stack_.empty(); } | 143 bool empty() const { return stack_.empty(); } |
142 void push(Operation task) { stack_.push(task); } | 144 void push(Operation task) { stack_.push(task); } |
143 Operation pop(); | 145 Operation pop(); |
144 void clear(); | 146 void clear(); |
145 | 147 |
146 private: | 148 private: |
147 std::stack<Operation> stack_; | 149 std::stack<Operation> stack_; |
| 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(TaskStack); |
148 }; | 152 }; |
149 | 153 |
150 TaskQueue task_queue_; | 154 TaskQueue task_queue_; |
151 TaskQueue preemptive_task_queue_; | 155 TaskQueue preemptive_task_queue_; |
152 TaskStack abort_task_stack_; | 156 TaskStack abort_task_stack_; |
153 | 157 |
154 scoped_ptr<IndexedDBBackingStore::Transaction> transaction_; | 158 scoped_ptr<IndexedDBBackingStore::Transaction> transaction_; |
155 bool backing_store_transaction_begun_; | 159 bool backing_store_transaction_begun_; |
156 | 160 |
157 bool should_process_queue_; | 161 bool should_process_queue_; |
158 int pending_preemptive_events_; | 162 int pending_preemptive_events_; |
159 | 163 |
160 std::set<IndexedDBCursor*> open_cursors_; | 164 std::set<IndexedDBCursor*> open_cursors_; |
161 | 165 |
162 // This timer is started after requests have been processed. If no subsequent | 166 // This timer is started after requests have been processed. If no subsequent |
163 // requests are processed before the timer fires, assume the script is | 167 // requests are processed before the timer fires, assume the script is |
164 // unresponsive and abort to unblock the transaction queue. | 168 // unresponsive and abort to unblock the transaction queue. |
165 base::OneShotTimer<IndexedDBTransaction> timeout_timer_; | 169 base::OneShotTimer<IndexedDBTransaction> timeout_timer_; |
166 | 170 |
167 Diagnostics diagnostics_; | 171 Diagnostics diagnostics_; |
168 }; | 172 }; |
169 | 173 |
170 } // namespace content | 174 } // namespace content |
171 | 175 |
172 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ | 176 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ |
OLD | NEW |