Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Unified Diff: components/offline_pages/offline_page_metadata_store_sql.h

Issue 2497703002: [Offline pages] Resetting offline page metadata store to handle LOAD/INIT failures (Closed)
Patch Set: Fixing newly added test Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 afe69ce194b88c7e39cff474422221294a2c3473..71e3c0f8e0fbb2dd79770104fc77e8827a859b11 100644
--- a/components/offline_pages/offline_page_metadata_store_sql.h
+++ b/components/offline_pages/offline_page_metadata_store_sql.h
@@ -59,6 +59,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;
@@ -73,17 +74,12 @@ class OfflinePageMetadataStoreSQL : public OfflinePageMetadataStore {
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_;

Powered by Google App Engine
This is Rietveld 408576698