Chromium Code Reviews| Index: components/offline_pages/offline_page_metadata_store_sql.h |
| diff --git a/components/offline_pages/offline_page_metadata_store_sql.h b/components/offline_pages/offline_page_metadata_store_sql.h |
| index c26cae8fb3e6653ee5f3224d2cda2cc55115607c..f286b441491d4e8f4dde9b8e559b579d126f006b 100644 |
| --- a/components/offline_pages/offline_page_metadata_store_sql.h |
| +++ b/components/offline_pages/offline_page_metadata_store_sql.h |
| @@ -58,6 +58,7 @@ class OfflinePageMetadataStoreSQL : public OfflinePageMetadataStore { |
| ~OfflinePageMetadataStoreSQL() override; |
| // Implementation methods. |
| + void Initialize(const InitializeCallback& callback) override; |
| void GetOfflinePages(const LoadCallback& callback) override; |
| void AddOfflinePage(const OfflinePageItem& offline_page, |
| const AddCallback& callback) override; |
| @@ -65,24 +66,19 @@ class OfflinePageMetadataStoreSQL : public OfflinePageMetadataStore { |
| const UpdateCallback& callback) override; |
| void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, |
| const UpdateCallback& callback) override; |
| - void Reset(const ResetCallback& callback) override; |
| + void Reset(const InitializeCallback& callback) override; |
|
jianli
2016/11/16 01:34:50
Will this be ResetCallback?
fgorski
2016/11/16 19:10:13
Done.
|
| StoreState state() const override; |
| // Helper function used to force incorrect state for testing purposes. |
| void SetStateForTesting(StoreState state, bool reset_db); |
| private: |
| - // Used to initialize DB connection. |
| - void OpenConnection(); |
| - void OnOpenConnectionDone(StoreState state); |
| + // Used to conclude opening/resetting DB connection. |
| + void OnOpenConnectionDone(const InitializeCallback& callback, bool success); |
| + void OnResetDone(const ResetCallback& callback, bool success); |
| - // Used to reset DB connection. |
| - void OnResetDone(const ResetCallback& callback, StoreState state); |
| - |
| - // Helper function that checks whether a valid DB connection is present. |
| - // Returns true if valid connection is present, otherwise it returns false and |
| - // calls the provided callback as a shortcut. |
| - bool CheckDb(const base::Closure& callback); |
| + // Checks whether a valid DB connection is present and store state is LOADED. |
| + bool CheckDb(); |
| // Background thread where all SQL access should be run. |
| scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |