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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/timer/timer.h" | |
17 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 16 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
18 #include "content/browser/indexed_db/indexed_db_database.h" | 17 #include "content/browser/indexed_db/indexed_db_database.h" |
19 #include "content/browser/indexed_db/indexed_db_database_error.h" | 18 #include "content/browser/indexed_db/indexed_db_database_error.h" |
20 | 19 |
21 namespace content { | 20 namespace content { |
22 | 21 |
23 class IndexedDBCursor; | 22 class IndexedDBCursor; |
24 class IndexedDBDatabaseCallbacks; | 23 class IndexedDBDatabaseCallbacks; |
25 | 24 |
26 class IndexedDBTransaction : public base::RefCounted<IndexedDBTransaction> { | 25 class IndexedDBTransaction : public base::RefCounted<IndexedDBTransaction> { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // started. | 89 // started. |
91 RUNNING, // Backing store transaction started but not yet finished. | 90 RUNNING, // Backing store transaction started but not yet finished. |
92 FINISHED, // Either aborted or committed. | 91 FINISHED, // Either aborted or committed. |
93 }; | 92 }; |
94 | 93 |
95 void Start(); | 94 void Start(); |
96 | 95 |
97 bool IsTaskQueueEmpty() const; | 96 bool IsTaskQueueEmpty() const; |
98 bool HasPendingTasks() const; | 97 bool HasPendingTasks() const; |
99 | 98 |
100 void TaskTimerFired(); | 99 void ProcessTaskQueue(); |
101 void CloseOpenCursors(); | 100 void CloseOpenCursors(); |
102 | 101 |
103 const int64 id_; | 102 const int64 id_; |
104 const std::set<int64> object_store_ids_; | 103 const std::set<int64> object_store_ids_; |
105 const indexed_db::TransactionMode mode_; | 104 const indexed_db::TransactionMode mode_; |
106 | 105 |
107 State state_; | 106 State state_; |
108 bool commit_pending_; | 107 bool commit_pending_; |
109 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; | 108 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; |
110 scoped_refptr<IndexedDBDatabase> database_; | 109 scoped_refptr<IndexedDBDatabase> database_; |
(...skipping 23 matching lines...) Expand all Loading... |
134 private: | 133 private: |
135 std::stack<Operation*> stack_; | 134 std::stack<Operation*> stack_; |
136 }; | 135 }; |
137 | 136 |
138 TaskQueue task_queue_; | 137 TaskQueue task_queue_; |
139 TaskQueue preemptive_task_queue_; | 138 TaskQueue preemptive_task_queue_; |
140 TaskStack abort_task_stack_; | 139 TaskStack abort_task_stack_; |
141 | 140 |
142 IndexedDBBackingStore::Transaction transaction_; | 141 IndexedDBBackingStore::Transaction transaction_; |
143 | 142 |
144 base::OneShotTimer<IndexedDBTransaction> task_timer_; | 143 bool should_process_queue_; |
145 int pending_preemptive_events_; | 144 int pending_preemptive_events_; |
146 | 145 |
147 std::set<IndexedDBCursor*> open_cursors_; | 146 std::set<IndexedDBCursor*> open_cursors_; |
148 }; | 147 }; |
149 | 148 |
150 } // namespace content | 149 } // namespace content |
151 | 150 |
152 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ | 151 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ |
OLD | NEW |