Chromium Code Reviews| 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 c4d602e0aecdb5a67c671041ef82a39b9c130300..8de74ce2ecf7b4b75fd83c4e29506183595233bc 100644 |
| --- a/components/offline_pages/background/request_coordinator.cc |
| +++ b/components/offline_pages/background/request_coordinator.cc |
| @@ -133,8 +133,6 @@ RequestCoordinator::RequestCoordinator( |
| network_quality_estimator_(network_quality_estimator), |
| active_request_(nullptr), |
| last_offlining_status_(Offliner::RequestStatus::UNKNOWN), |
| - offliner_timeout_(base::TimeDelta::FromSeconds( |
| - policy_->GetSinglePageTimeLimitInSeconds())), |
| weak_ptr_factory_(this) { |
| DCHECK(policy_ != nullptr); |
| picker_.reset( |
| @@ -406,6 +404,7 @@ void RequestCoordinator::HandleWatchdogTimeout() { |
| // Returns true if the caller should expect a callback, false otherwise. For |
| // instance, this would return false if a request is already in progress. |
| bool RequestCoordinator::StartProcessing( |
| + bool is_background_scheduled, |
| const DeviceConditions& device_conditions, |
| const base::Callback<void(bool)>& callback) { |
| current_conditions_.reset(new DeviceConditions(device_conditions)); |
| @@ -416,6 +415,8 @@ bool RequestCoordinator::StartProcessing( |
| // Mark the time at which we started processing so we can check our time |
| // budget. |
| operation_start_time_ = base::Time::Now(); |
| + offliner_timeout_ = base::TimeDelta::FromSeconds( |
|
Pete Williamson
2016/10/12 22:33:24
It's a bit fragile to have this changing constantl
dougarnett
2016/10/13 19:46:45
It is really tied to the service window though - n
|
| + policy_->GetSinglePageTimeLimitInSeconds(is_background_scheduled)); |
| is_stopped_ = false; |
| scheduler_callback_ = callback; |
| @@ -458,7 +459,8 @@ RequestCoordinator::TryImmediateStart() { |
| // (i.e., assume no battery). |
| // TODO(dougarnett): Obtain actual battery conditions (from Android/Java). |
| DeviceConditions device_conditions(false, 0, GetConnectionType()); |
| - if (StartProcessing(device_conditions, base::Bind(&EmptySchedulerCallback))) |
| + if (StartProcessing(false /* is_background_scheduled */, device_conditions, |
| + base::Bind(&EmptySchedulerCallback))) |
| return OfflinerImmediateStartStatus::STARTED; |
| else |
| return OfflinerImmediateStartStatus::NOT_ACCEPTED; |