Chromium Code Reviews| Index: content/browser/indexed_db/indexed_db_transaction.h |
| diff --git a/content/browser/indexed_db/indexed_db_transaction.h b/content/browser/indexed_db/indexed_db_transaction.h |
| index ad5c03e79102e99a48dd11d08be61be749d8bd5e..d9a9180c68ff9cf9496bb891650e0d4397833c41 100644 |
| --- a/content/browser/indexed_db/indexed_db_transaction.h |
| +++ b/content/browser/indexed_db/indexed_db_transaction.h |
| @@ -35,7 +35,9 @@ class IndexedDBObserverChanges; |
| class CONTENT_EXPORT IndexedDBTransaction |
| : public NON_EXPORTED_BASE(base::RefCounted<IndexedDBTransaction>) { |
| public: |
| - typedef base::Callback<void(IndexedDBTransaction*)> Operation; |
| + using OperationResult = leveldb::Status; |
|
cmumford
2016/11/21 18:29:22
I'm not a fan of introducing OperationResult. It o
dmurph
2016/11/22 23:33:11
Done.
|
| + using Operation = base::Callback<OperationResult(IndexedDBTransaction*)>; |
| + using AbortOperation = base::Closure; |
| enum State { |
| CREATED, // Created, but not yet started by coordinator. |
| @@ -59,7 +61,7 @@ class CONTENT_EXPORT IndexedDBTransaction |
| ScheduleTask(blink::WebIDBTaskTypeNormal, task); |
| } |
| void ScheduleTask(blink::WebIDBTaskType, Operation task); |
| - void ScheduleAbortTask(Operation abort_task); |
| + void ScheduleAbortTask(AbortOperation abort_task); |
| void RegisterOpenCursor(IndexedDBCursor* cursor); |
| void UnregisterOpenCursor(IndexedDBCursor* cursor); |
| void AddPreemptiveEvent() { pending_preemptive_events_++; } |
| @@ -127,6 +129,7 @@ class CONTENT_EXPORT IndexedDBTransaction |
| SchedulePreemptiveTask); |
| FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTestMode, |
| ScheduleNormalTask); |
| + FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTestMode, TaskFails); |
| FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTest, Timeout); |
| FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTest, IndexedDBObserver); |
| @@ -145,9 +148,9 @@ class CONTENT_EXPORT IndexedDBTransaction |
| const std::set<int64_t> object_store_ids_; |
| const blink::WebIDBTransactionMode mode_; |
| - bool used_; |
| - State state_; |
| - bool commit_pending_; |
| + bool used_ = false; |
| + State state_ = CREATED; |
| + bool commit_pending_ = false; |
| base::WeakPtr<IndexedDBConnection> connection_; |
| scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; |
| scoped_refptr<IndexedDBDatabase> database_; |
| @@ -162,7 +165,7 @@ class CONTENT_EXPORT IndexedDBTransaction |
| TaskQueue(); |
| ~TaskQueue(); |
| bool empty() const { return queue_.empty(); } |
| - void push(Operation task) { queue_.push(task); } |
| + void push(Operation task) { queue_.push(std::move(task)); } |
| Operation pop(); |
| void clear(); |
| @@ -177,12 +180,12 @@ class CONTENT_EXPORT IndexedDBTransaction |
| TaskStack(); |
| ~TaskStack(); |
| bool empty() const { return stack_.empty(); } |
| - void push(Operation task) { stack_.push(task); } |
| - Operation pop(); |
| + void push(AbortOperation task) { stack_.push(std::move(task)); } |
| + AbortOperation pop(); |
| void clear(); |
| private: |
| - std::stack<Operation> stack_; |
| + std::stack<AbortOperation> stack_; |
| DISALLOW_COPY_AND_ASSIGN(TaskStack); |
| }; |
| @@ -192,10 +195,11 @@ class CONTENT_EXPORT IndexedDBTransaction |
| TaskStack abort_task_stack_; |
| std::unique_ptr<IndexedDBBackingStore::Transaction> transaction_; |
| - bool backing_store_transaction_begun_; |
| + bool backing_store_transaction_begun_ = false; |
| - bool should_process_queue_; |
| - int pending_preemptive_events_; |
| + bool should_process_queue_ = false; |
| + int pending_preemptive_events_ = 0; |
| + bool processing_event_queue_ = false; |
| std::set<IndexedDBCursor*> open_cursors_; |