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

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

Issue 2395213002: Implement disabled list (Closed)
Patch Set: Pass the disabled list when looking for a new request. 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 f82a7a95bdb64f84c881a63ff22c1901c9551520..337ce093ce1537fc9a9fbeaf0b0402288be7d2d3 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -124,6 +124,11 @@ int64_t RequestCoordinator::SavePageLater(const GURL& url,
offline_pages::SavePageRequest request(id, url, client_id, base::Time::Now(),
user_requested);
+ // If the download manager is not done with the request, put it on the
+ // disabled list.
+ if (availability == RequestAvailability::DISABLED_FOR_OFFLINER)
+ disabled_requests_.insert(id);
+
// Put the request on the request queue.
queue_->AddRequest(request,
base::Bind(&RequestCoordinator::AddRequestResultCallback,
@@ -421,7 +426,8 @@ void RequestCoordinator::TryNextRequest() {
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&RequestCoordinator::RequestNotPicked,
weak_ptr_factory_.GetWeakPtr()),
- current_conditions_.get());
+ current_conditions_.get(),
+ &disabled_requests_);
}
// Called by the request picker when a request has been picked.
@@ -563,7 +569,9 @@ void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request,
}
}
-void RequestCoordinator::EnableForOffliner(int64_t request_id) {}
+void RequestCoordinator::EnableForOffliner(int64_t request_id) {
+ disabled_requests_.erase(request_id);
+}
void RequestCoordinator::MarkRequestCompleted(int64_t request_id) {}

Powered by Google App Engine
This is Rietveld 408576698