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

Unified Diff: components/offline_pages/background/request_queue_store_sql.h

Issue 2379353003: [Offline pages] Applying StoreState to track RequestQueueStore state (Closed)
Patch Set: Addressing feedback Created 4 years, 3 months 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/background/request_queue_store_sql.h
diff --git a/components/offline_pages/background/request_queue_store_sql.h b/components/offline_pages/background/request_queue_store_sql.h
index 80ef7223c2990bd70f7e32fa2def20e9a9f19630..69855f7728e07f03b12c16906a702e09ead2a45f 100644
--- a/components/offline_pages/background/request_queue_store_sql.h
+++ b/components/offline_pages/background/request_queue_store_sql.h
@@ -6,7 +6,6 @@
#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_SQL_H_
#include <stdint.h>
-
#include <memory>
#include <vector>
@@ -45,6 +44,7 @@ class RequestQueueStoreSQL : public RequestQueueStore {
const SavePageRequest::RequestState new_state,
const UpdateMultipleRequestsCallback& callback) override;
void Reset(const ResetCallback& callback) override;
+ StoreState state() const override;
private:
// Helper functions to return immediately if no database is found.
@@ -52,10 +52,10 @@ class RequestQueueStoreSQL : public RequestQueueStore {
// Used to initialize DB connection.
void OpenConnection();
- void OnOpenConnectionDone(bool success);
+ void OnOpenConnectionDone(StoreState state);
// Used to finalize connection reset.
- void OnResetDone(const ResetCallback& callback, bool success);
+ void OnResetDone(const ResetCallback& callback, StoreState state);
// Background thread where all SQL access should be run.
scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
@@ -66,6 +66,9 @@ class RequestQueueStoreSQL : public RequestQueueStore {
// Database connection.
std::unique_ptr<sql::Connection> db_;
+ // State of the store.
+ StoreState state_;
+
base::WeakPtrFactory<RequestQueueStoreSQL> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(RequestQueueStoreSQL);
};

Powered by Google App Engine
This is Rietveld 408576698