| Index: components/offline_pages/background/request_picker.cc
|
| diff --git a/components/offline_pages/background/request_picker.cc b/components/offline_pages/background/request_picker.cc
|
| index b05fc1dc8660b52630ddf95e1ed65184b74d1387..c1d27838165d837bb70bc28bf3768e63a597441d 100644
|
| --- a/components/offline_pages/background/request_picker.cc
|
| +++ b/components/offline_pages/background/request_picker.cc
|
| @@ -37,7 +37,8 @@ RequestPicker::~RequestPicker() {}
|
| void RequestPicker::ChooseNextRequest(
|
| RequestCoordinator::RequestPickedCallback picked_callback,
|
| RequestCoordinator::RequestNotPickedCallback not_picked_callback,
|
| - DeviceConditions* device_conditions) {
|
| + DeviceConditions* device_conditions,
|
| + const std::set<int64_t>& disabled_requests) {
|
| picked_callback_ = picked_callback;
|
| not_picked_callback_ = not_picked_callback;
|
| fewer_retries_better_ = policy_->ShouldPreferUntriedRequests();
|
| @@ -45,12 +46,14 @@ void RequestPicker::ChooseNextRequest(
|
| current_conditions_.reset(new DeviceConditions(*device_conditions));
|
| // Get all requests from queue (there is no filtering mechanism).
|
| queue_->GetRequests(base::Bind(&RequestPicker::GetRequestResultCallback,
|
| - weak_ptr_factory_.GetWeakPtr()));
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + disabled_requests));
|
| }
|
|
|
| // When we get contents from the queue, use them to pick the next
|
| // request to operate on (if any).
|
| void RequestPicker::GetRequestResultCallback(
|
| + const std::set<int64_t>& disabled_requests,
|
| RequestQueue::GetRequestsResult,
|
| std::vector<std::unique_ptr<SavePageRequest>> requests) {
|
| // If there is nothing to do, return right away.
|
| @@ -86,6 +89,11 @@ void RequestPicker::GetRequestResultCallback(
|
| // Iterate once through the requests, keeping track of best candidate.
|
| bool non_user_requested_tasks_remaining = false;
|
| for (unsigned i = 0; i < valid_requests.size(); ++i) {
|
| + // If the request is on the disabled list, skip it.
|
| + auto search = disabled_requests.find(valid_requests[i]->request_id());
|
| + if (search != disabled_requests.end()) {
|
| + continue;
|
| + }
|
| if (!valid_requests[i]->user_requested())
|
| non_user_requested_tasks_remaining = true;
|
| if (!RequestConditionsSatisfied(valid_requests[i].get()))
|
|
|