| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 class BlobWriteCallbackImpl; | 24 class BlobWriteCallbackImpl; |
| 25 class IndexedDBCursor; | 25 class IndexedDBCursor; |
| 26 class IndexedDBDatabaseCallbacks; | 26 class IndexedDBDatabaseCallbacks; |
| 27 | 27 |
| 28 class CONTENT_EXPORT IndexedDBTransaction | 28 class CONTENT_EXPORT IndexedDBTransaction |
| 29 : public NON_EXPORTED_BASE(base::RefCounted<IndexedDBTransaction>) { | 29 : public NON_EXPORTED_BASE(base::RefCounted<IndexedDBTransaction>) { |
| 30 public: | 30 public: |
| 31 typedef base::Callback<void(IndexedDBTransaction*)> Operation; | 31 typedef base::Callback<void(IndexedDBTransaction*)> Operation; |
| 32 | 32 |
| 33 enum State { |
| 34 CREATED, // Created, but not yet started by coordinator. |
| 35 STARTED, // Started by the coordinator. |
| 36 COMMITTING, // In the process of committing, possibly waiting for blobs |
| 37 // to be written. |
| 38 FINISHED, // Either aborted or committed. |
| 39 }; |
| 40 |
| 33 IndexedDBTransaction( | 41 IndexedDBTransaction( |
| 34 int64 id, | 42 int64 id, |
| 35 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, | 43 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, |
| 36 const std::set<int64>& object_store_ids, | 44 const std::set<int64>& object_store_ids, |
| 37 blink::WebIDBTransactionMode, | 45 blink::WebIDBTransactionMode, |
| 38 IndexedDBDatabase* db, | 46 IndexedDBDatabase* db, |
| 39 IndexedDBBackingStore::Transaction* backing_store_transaction); | 47 IndexedDBBackingStore::Transaction* backing_store_transaction); |
| 40 | 48 |
| 41 virtual void Abort(); | 49 virtual void Abort(); |
| 42 leveldb::Status Commit(); | 50 leveldb::Status Commit(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 61 DCHECK_GE(pending_preemptive_events_, 0); | 69 DCHECK_GE(pending_preemptive_events_, 0); |
| 62 } | 70 } |
| 63 IndexedDBBackingStore::Transaction* BackingStoreTransaction() { | 71 IndexedDBBackingStore::Transaction* BackingStoreTransaction() { |
| 64 return transaction_.get(); | 72 return transaction_.get(); |
| 65 } | 73 } |
| 66 int64 id() const { return id_; } | 74 int64 id() const { return id_; } |
| 67 | 75 |
| 68 IndexedDBDatabase* database() const { return database_; } | 76 IndexedDBDatabase* database() const { return database_; } |
| 69 IndexedDBDatabaseCallbacks* connection() const { return callbacks_; } | 77 IndexedDBDatabaseCallbacks* connection() const { return callbacks_; } |
| 70 | 78 |
| 71 enum State { | |
| 72 CREATED, // Created, but not yet started by coordinator. | |
| 73 STARTED, // Started by the coordinator. | |
| 74 COMMITTING, // In the process of committing, possibly waiting for blobs | |
| 75 // to be written. | |
| 76 FINISHED, // Either aborted or committed. | |
| 77 }; | |
| 78 | |
| 79 State state() const { return state_; } | 79 State state() const { return state_; } |
| 80 bool IsTimeoutTimerRunning() const { return timeout_timer_.IsRunning(); } | 80 bool IsTimeoutTimerRunning() const { return timeout_timer_.IsRunning(); } |
| 81 | 81 |
| 82 struct Diagnostics { | 82 struct Diagnostics { |
| 83 base::Time creation_time; | 83 base::Time creation_time; |
| 84 base::Time start_time; | 84 base::Time start_time; |
| 85 int tasks_scheduled; | 85 int tasks_scheduled; |
| 86 int tasks_completed; | 86 int tasks_completed; |
| 87 }; | 87 }; |
| 88 | 88 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // requests are processed before the timer fires, assume the script is | 168 // requests are processed before the timer fires, assume the script is |
| 169 // unresponsive and abort to unblock the transaction queue. | 169 // unresponsive and abort to unblock the transaction queue. |
| 170 base::OneShotTimer<IndexedDBTransaction> timeout_timer_; | 170 base::OneShotTimer<IndexedDBTransaction> timeout_timer_; |
| 171 | 171 |
| 172 Diagnostics diagnostics_; | 172 Diagnostics diagnostics_; |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 } // namespace content | 175 } // namespace content |
| 176 | 176 |
| 177 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ | 177 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ |
| OLD | NEW |