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 8356a138ffbfd3d3a742fff3c0d09daa6d60c43a..011a804b90f514dc2c03f417f2a878233b0dbcc9 100644 |
| --- a/content/browser/indexed_db/indexed_db_transaction.h |
| +++ b/content/browser/indexed_db/indexed_db_transaction.h |
| @@ -18,6 +18,7 @@ |
| namespace content { |
| +class BlobWriteCallbackImpl; |
| class IndexedDBCursor; |
| class IndexedDBDatabaseCallbacks; |
| @@ -65,13 +66,23 @@ class IndexedDBTransaction : public base::RefCounted<IndexedDBTransaction> { |
| friend class base::RefCounted<IndexedDBTransaction>; |
| private: |
| + friend class BlobWriteCallbackImpl; |
| + |
| enum State { |
| UNUSED, // Created, but no tasks yet. |
| START_PENDING, // Enqueued tasks, but backing store transaction not yet |
| // started. |
| RUNNING, // Backing store transaction started but not yet finished. |
| + COMMITTING, // In the process of committing, possibly waiting for blobs |
|
jsbell
2013/09/13 00:12:21
Happy fun state transition diagram.
ericu
2013/11/20 23:05:39
Yup. At least it's still pretty non-branchy.
jsbell
2013/11/21 22:54:32
FYI, I just learned we have a bug here. The UNUSED
|
| + // to be written. |
| FINISHED, // Either aborted or committed. |
| }; |
| + enum TransactionUseState { WAS_USED, WAS_NOT_USED }; |
| + enum ShouldSkipCommit { DO_COMMIT, SKIP_COMMIT }; |
|
jsbell
2013/09/13 00:12:21
Seems like we should be able to combine WAS_NOT_US
ericu
2013/11/20 23:05:39
They could be sliced differently, but we do need t
|
| + |
| + bool IsStatePastRunning() const { |
|
jsbell
2013/09/13 00:12:21
We'll want context to call into this, to report it
ericu
2013/11/20 23:05:39
Added a TODO.
|
| + return state_ == COMMITTING || state_ == FINISHED; |
| + } |
| void EnsureTasksRunning(); |
| void Start(); |
| @@ -79,8 +90,11 @@ class IndexedDBTransaction : public base::RefCounted<IndexedDBTransaction> { |
| bool IsTaskQueueEmpty() const; |
| bool HasPendingTasks() const; |
| + void BlobWriteComplete(bool success); |
| void ProcessTaskQueue(); |
| void CloseOpenCursors(); |
| + void CommitPhaseTwo(TransactionUseState use_state, |
| + ShouldSkipCommit skip_commit); |
| const int64 id_; |
| const std::set<int64> object_store_ids_; |
| @@ -88,6 +102,7 @@ class IndexedDBTransaction : public base::RefCounted<IndexedDBTransaction> { |
| State state_; |
| bool commit_pending_; |
| + bool blob_write_success_; |
| scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; |
| scoped_refptr<IndexedDBDatabase> database_; |