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

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

Issue 2221323003: Add an API to Pause and Resume background offlining requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback per Dimich Created 4 years, 4 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 18f6e8792d85715384c7291adfc60cf67944d2db..2ffe904596fb4d3be5b060d80f602fb4e3fecd8d 100644
--- a/components/offline_pages/background/request_queue_store_sql.h
+++ b/components/offline_pages/background/request_queue_store_sql.h
@@ -34,12 +34,18 @@ class RequestQueueStoreSQL : public RequestQueueStore {
// RequestQueueStore implementation.
void GetRequests(const GetRequestsCallback& callback) override;
+
fgorski 2016/08/10 16:00:09 nit: same comment for this and next empty line as
Pete Williamson 2016/08/10 21:38:01 Done.
void AddOrUpdateRequest(const SavePageRequest& offline_page,
const UpdateCallback& callback) override;
void RemoveRequests(const std::vector<int64_t>& request_ids,
const RemoveCallback& callback) override;
void RemoveRequestsByClientId(const std::vector<ClientId>& client_ids,
const RemoveCallback& callback) override;
+
+ void ChangeRequestsState(const std::vector<int64_t>& request_ids,
+ const SavePageRequest::RequestState new_state,
+ const UpdateCallback& callback) override;
+
void Reset(const ResetCallback& callback) override;
private:
@@ -66,11 +72,20 @@ class RequestQueueStoreSQL : public RequestQueueStore {
scoped_refptr<base::SingleThreadTaskRunner> runner,
const std::vector<ClientId>& client_ids,
const RemoveCallback& callback);
+ static void ChangeRequestsStateSync(
+ sql::Connection* db,
+ scoped_refptr<base::SingleThreadTaskRunner> runner,
+ const std::vector<int64_t>& request_ids,
+ const SavePageRequest::RequestState new_state,
+ const UpdateCallback& callback);
static void ResetSync(sql::Connection* db,
const base::FilePath& db_file_path,
scoped_refptr<base::SingleThreadTaskRunner> runner,
const ResetCallback& callback);
+ // Helper functions to return immediately if no database is found.
+ bool CheckDb(const base::Closure& callback);
+
// Used to initialize DB connection.
static void OpenConnectionSync(
sql::Connection* db,

Powered by Google App Engine
This is Rietveld 408576698