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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 = |
| 223 base::Bind(&RequestCoordinator::UpdateRequestCallback, | 223 base::Bind(&RequestCoordinator::UpdateRequestCallback, |
| 224 weak_ptr_factory_.GetWeakPtr()); | 224 weak_ptr_factory_.GetWeakPtr()); |
| 225 queue_->UpdateRequest( | 225 queue_->UpdateRequest( |
| 226 updated_request, | 226 updated_request, |
| 227 base::Bind(&RequestCoordinator::UpdateRequestCallback, | 227 base::Bind(&RequestCoordinator::UpdateRequestCallback, |
| 228 weak_ptr_factory_.GetWeakPtr())); | 228 weak_ptr_factory_.GetWeakPtr())); |
| 229 } | 229 } |
| 230 | 230 |
| 231 TryNextRequest(); | 231 // Determine whether we might try another request in this |
| 232 // processing window based on how the previous request completed. | |
| 233 // | |
| 234 // TODO(dougarnett): Support trying another request for some | |
| 235 // whitelisted types of rendering failures (but not for cancels | |
| 236 // or rendering process killed). | |
| 237 if (status == Offliner::RequestStatus::SAVED) { | |
|
Pete Williamson
2016/08/01 19:56:27
Let's fix this right while we are here.
THere aren
| |
| 238 TryNextRequest(); | |
| 239 } | |
| 232 } | 240 } |
| 233 | 241 |
| 234 const Scheduler::TriggerConditions | 242 const Scheduler::TriggerConditions |
| 235 RequestCoordinator::GetTriggerConditionsForUserRequest() { | 243 RequestCoordinator::GetTriggerConditionsForUserRequest() { |
| 236 Scheduler::TriggerConditions trigger_conditions( | 244 Scheduler::TriggerConditions trigger_conditions( |
| 237 policy_->PowerRequiredForUserRequestedPage(), | 245 policy_->PowerRequiredForUserRequestedPage(), |
| 238 policy_->BatteryPercentageRequiredForUserRequestedPage(), | 246 policy_->BatteryPercentageRequiredForUserRequestedPage(), |
| 239 policy_->UnmeteredNetworkRequiredForUserRequestedPage()); | 247 policy_->UnmeteredNetworkRequiredForUserRequestedPage()); |
| 240 return trigger_conditions; | 248 return trigger_conditions; |
| 241 } | 249 } |
| 242 | 250 |
| 243 void RequestCoordinator::GetOffliner() { | 251 void RequestCoordinator::GetOffliner() { |
| 244 if (!offliner_) { | 252 if (!offliner_) { |
| 245 offliner_ = factory_->GetOffliner(policy_.get()); | 253 offliner_ = factory_->GetOffliner(policy_.get()); |
| 246 } | 254 } |
| 247 } | 255 } |
| 248 | 256 |
| 249 } // namespace offline_pages | 257 } // namespace offline_pages |
| OLD | NEW |