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

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

Issue 2409823002: Implement MarkRequestCompleted. (Closed)
Patch Set: rebase-update Created 4 years, 2 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 a1fcd7d93d97c92a8239d147d09709efaa3ef495..c4d602e0aecdb5a67c671041ef82a39b9c130300 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -357,6 +357,13 @@ void RequestCoordinator::UpdateMultipleRequestsCallback(
StartProcessingIfConnected();
}
+// When we successfully remove a request that completed successfully, move on to
+// the next request.
+void RequestCoordinator::CompletedRequestCallback(
+ const MultipleItemStatuses& status) {
+ TryNextRequest();
+}
+
void RequestCoordinator::HandleRemovedRequestsAndCallback(
const RemoveRequestsCallback& callback,
BackgroundSavePageResult status,
@@ -637,7 +644,15 @@ void RequestCoordinator::EnableForOffliner(int64_t request_id) {
}
void RequestCoordinator::MarkRequestCompleted(int64_t request_id) {
- // TODO: Remove the request, but send out SUCCEEDED instead of removed.
+ // Remove the request, but send out SUCCEEDED instead of removed.
+ std::vector<int64_t> request_ids { request_id };
+ queue_->RemoveRequests(
+ request_ids,
+ base::Bind(&RequestCoordinator::HandleRemovedRequestsAndCallback,
+ weak_ptr_factory_.GetWeakPtr(),
+ base::Bind(&RequestCoordinator::CompletedRequestCallback,
+ weak_ptr_factory_.GetWeakPtr()),
+ BackgroundSavePageResult::SUCCESS));
}
const Scheduler::TriggerConditions RequestCoordinator::GetTriggerConditions(

Powered by Google App Engine
This is Rietveld 408576698