Chromium Code Reviews| Index: content/browser/indexed_db/indexed_db_callbacks.h |
| diff --git a/content/browser/indexed_db/indexed_db_callbacks.h b/content/browser/indexed_db/indexed_db_callbacks.h |
| index b72fc605e8cd53ff426a5fc3e80cafc062876907..426108aa4249540297d32b5e2d9d03beef037e18 100644 |
| --- a/content/browser/indexed_db/indexed_db_callbacks.h |
| +++ b/content/browser/indexed_db/indexed_db_callbacks.h |
| @@ -13,7 +13,7 @@ |
| #include "base/logging.h" |
| #include "base/macros.h" |
| -#include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "base/strings/string16.h" |
| #include "base/threading/thread_checker.h" |
| #include "content/browser/indexed_db/indexed_db_database_error.h" |
| @@ -23,6 +23,10 @@ |
| #include "content/common/indexed_db/indexed_db_key_path.h" |
| #include "url/origin.h" |
| +namespace base { |
| +class SequencedTaskRunner; |
| +} |
| + |
| namespace content { |
| class IndexedDBConnection; |
| class IndexedDBCursor; |
| @@ -32,6 +36,7 @@ struct IndexedDBDatabaseMetadata; |
| struct IndexedDBReturnValue; |
| struct IndexedDBValue; |
| +// Expected to be constructed on IO thread and called/deleted from IDB thread. |
| class CONTENT_EXPORT IndexedDBCallbacks |
| : public base::RefCounted<IndexedDBCallbacks> { |
| public: |
| @@ -40,9 +45,10 @@ class CONTENT_EXPORT IndexedDBCallbacks |
| IndexedDBValue* value); |
| IndexedDBCallbacks( |
| - scoped_refptr<IndexedDBDispatcherHost> dispatcher_host, |
| + base::WeakPtr<IndexedDBDispatcherHost> dispatcher_host, |
| const url::Origin& origin, |
| - ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info); |
| + ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info, |
| + scoped_refptr<base::SequencedTaskRunner> idb_runner); |
| virtual void OnError(const IndexedDBDatabaseError& error); |
| @@ -106,18 +112,14 @@ class CONTENT_EXPORT IndexedDBCallbacks |
| class IOThreadHelper; |
| - // Originally from IndexedDBCallbacks: |
| - scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; |
| - |
| - // IndexedDBDatabase callbacks ------------------------ |
| - url::Origin origin_; |
| - bool database_sent_ = false; |
| + bool closed_ = false; |
|
jsbell
2017/04/11 16:58:04
Add comments about what these mean.
dmurph
2017/04/11 19:32:49
Done.
|
| + bool database_created_ = false; |
| // Used to assert that OnSuccess is only called if there was no data loss. |
| blink::WebIDBDataLoss data_loss_; |
| // The "blocked" event should be sent at most once per request. |
| - bool sent_blocked_; |
| + bool sent_blocked_ = false; |
| base::TimeTicks connection_open_start_time_; |
| std::unique_ptr<IOThreadHelper, BrowserThread::DeleteOnIOThread> io_helper_; |