Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 // TODO(dougarnett): See if we can conclusively identify other attempt | 274 // TODO(dougarnett): See if we can conclusively identify other attempt |
| 275 // aborted cases to treat this way (eg, for Render Process Killed). | 275 // aborted cases to treat this way (eg, for Render Process Killed). |
| 276 SavePageRequest updated_request(request); | 276 SavePageRequest updated_request(request); |
| 277 updated_request.MarkAttemptAborted(); | 277 updated_request.MarkAttemptAborted(); |
| 278 queue_->UpdateRequest(updated_request, | 278 queue_->UpdateRequest(updated_request, |
| 279 base::Bind(&RequestCoordinator::UpdateRequestCallback, | 279 base::Bind(&RequestCoordinator::UpdateRequestCallback, |
| 280 weak_ptr_factory_.GetWeakPtr(), | 280 weak_ptr_factory_.GetWeakPtr(), |
| 281 updated_request.client_id())); | 281 updated_request.client_id())); |
| 282 | 282 |
| 283 } else if (status == Offliner::RequestStatus::SAVED || | 283 } else if (status == Offliner::RequestStatus::SAVED || |
| 284 request.attempt_count() >= policy_->GetMaxTries()) { | 284 request.completed_attempt_count() + 1 >= |
|
fgorski
2016/08/08 17:48:05
What is going on with the +1. Please explain it.
Pete Williamson
2016/08/08 18:44:28
comment added.
| |
| 285 policy_->GetMaxCompletedTries()) { | |
|
fgorski
2016/08/08 17:48:05
Do you plan to check for GetMaxStartedTries() here
Pete Williamson
2016/08/08 18:44:28
Checking GetMaxStartedTries is coming in a future
| |
| 285 // Remove the request from the queue if it either succeeded or exceeded the | 286 // Remove the request from the queue if it either succeeded or exceeded the |
| 286 // max number of retries. | 287 // max number of retries. |
| 287 queue_->RemoveRequest( | 288 queue_->RemoveRequest( |
| 288 request.request_id(), | 289 request.request_id(), |
| 289 base::Bind(&RequestCoordinator::UpdateRequestCallback, | 290 base::Bind(&RequestCoordinator::UpdateRequestCallback, |
| 290 weak_ptr_factory_.GetWeakPtr(), request.client_id())); | 291 weak_ptr_factory_.GetWeakPtr(), request.client_id())); |
| 291 } else { | 292 } else { |
| 292 // If we failed, but are not over the limit, update the request in the | 293 // If we failed, but are not over the limit, update the request in the |
| 293 // queue. | 294 // queue. |
| 294 SavePageRequest updated_request(request); | 295 SavePageRequest updated_request(request); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 return trigger_conditions; | 333 return trigger_conditions; |
| 333 } | 334 } |
| 334 | 335 |
| 335 void RequestCoordinator::GetOffliner() { | 336 void RequestCoordinator::GetOffliner() { |
| 336 if (!offliner_) { | 337 if (!offliner_) { |
| 337 offliner_ = factory_->GetOffliner(policy_.get()); | 338 offliner_ = factory_->GetOffliner(policy_.get()); |
| 338 } | 339 } |
| 339 } | 340 } |
| 340 | 341 |
| 341 } // namespace offline_pages | 342 } // namespace offline_pages |
| OLD | NEW |