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

Unified Diff: components/offline_pages/background/request_coordinator.cc

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: Fix unit test break introduced by merge 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_coordinator.cc
diff --git a/components/offline_pages/background/request_coordinator.cc b/components/offline_pages/background/request_coordinator.cc
index 3033972fa845c1886f12d240fc1cc2b0bfefa8ff..fe6e83232f8ec02c884ccf425d749dbe62e2e4d0 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -112,6 +112,23 @@ void RequestCoordinator::RemoveRequests(
weak_ptr_factory_.GetWeakPtr()));
}
+void RequestCoordinator::PauseRequests(
+ const std::vector<int64_t>& request_ids) {
+ queue_->ChangeRequestsState(
+ request_ids, SavePageRequest::RequestState::PAUSED,
+ base::Bind(&RequestCoordinator::UpdateMultipleRequestCallback,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void RequestCoordinator::ResumeRequests(
+ const std::vector<int64_t>& request_ids) {
+ queue_->ChangeRequestsState(
+ request_ids, SavePageRequest::RequestState::AVAILABLE,
+ base::Bind(&RequestCoordinator::UpdateMultipleRequestCallback,
+ weak_ptr_factory_.GetWeakPtr()));
+ // TODO: Should we also schedule a task, in case there is not one scheduled?
+}
+
void RequestCoordinator::AddRequestResultCallback(
RequestQueue::AddRequestResult result,
const SavePageRequest& request) {
« no previous file with comments | « components/offline_pages/background/request_coordinator.h ('k') | components/offline_pages/background/request_picker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698