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

Side by Side Diff: components/offline_pages/background/request_coordinator.cc

Issue 2191733004: [Offline Pages] Configure for no retries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/offline_pages/background/request_coordinator.h" 5 #include "components/offline_pages/background/request_coordinator.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 RecordOfflinerResultUMA(last_offlining_status_); 202 RecordOfflinerResultUMA(last_offlining_status_);
203 watchdog_timer_.Stop(); 203 watchdog_timer_.Stop();
204 204
205 is_busy_ = false; 205 is_busy_ = false;
206 206
207 int64_t new_attempt_count = request.attempt_count() + 1; 207 int64_t new_attempt_count = request.attempt_count() + 1;
208 208
209 // Remove the request from the queue if it either succeeded or exceeded the 209 // Remove the request from the queue if it either succeeded or exceeded the
210 // max number of retries. 210 // max number of retries.
211 if (status == Offliner::RequestStatus::SAVED 211 if (status == Offliner::RequestStatus::SAVED
212 || new_attempt_count > policy_->GetMaxRetries()) { 212 || new_attempt_count > policy_->GetMaxTries()) {
213 queue_->RemoveRequest(request.request_id(), 213 queue_->RemoveRequest(request.request_id(),
214 base::Bind(&RequestCoordinator::UpdateRequestCallback, 214 base::Bind(&RequestCoordinator::UpdateRequestCallback,
215 weak_ptr_factory_.GetWeakPtr())); 215 weak_ptr_factory_.GetWeakPtr()));
216 } else { 216 } else {
217 // If we failed, but are not over the limit, update the request in the 217 // If we failed, but are not over the limit, update the request in the
218 // queue. 218 // queue.
219 SavePageRequest updated_request(request); 219 SavePageRequest updated_request(request);
220 updated_request.set_attempt_count(new_attempt_count); 220 updated_request.set_attempt_count(new_attempt_count);
221 updated_request.set_last_attempt_time(base::Time::Now()); 221 updated_request.set_last_attempt_time(base::Time::Now());
222 RequestQueue::UpdateRequestCallback update_callback = 222 RequestQueue::UpdateRequestCallback update_callback =
(...skipping 17 matching lines...) Expand all
240 return trigger_conditions; 240 return trigger_conditions;
241 } 241 }
242 242
243 void RequestCoordinator::GetOffliner() { 243 void RequestCoordinator::GetOffliner() {
244 if (!offliner_) { 244 if (!offliner_) {
245 offliner_ = factory_->GetOffliner(policy_.get()); 245 offliner_ = factory_->GetOffliner(policy_.get());
246 } 246 }
247 } 247 }
248 248
249 } // namespace offline_pages 249 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/background/offliner_policy.h ('k') | components/offline_pages/background/request_picker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698