| 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 120c08db9b92122170187545e8727f4c00faff31..87b8f9ccbd7b5e0512d8672950a4d23ca2047c10 100644
|
| --- a/components/offline_pages/background/request_coordinator.cc
|
| +++ b/components/offline_pages/background/request_coordinator.cc
|
| @@ -474,7 +474,6 @@ bool RequestCoordinator::StartProcessingInternal(
|
| current_conditions_.reset(new DeviceConditions(device_conditions));
|
| if (is_starting_ || is_busy_)
|
| return false;
|
| - is_starting_ = true;
|
| processing_state_ = processing_state;
|
| scheduler_callback_ = callback;
|
|
|
| @@ -533,6 +532,7 @@ RequestCoordinator::TryImmediateStart() {
|
| }
|
|
|
| void RequestCoordinator::TryNextRequest() {
|
| + is_starting_ = true;
|
| base::TimeDelta processing_time_budget;
|
| if (processing_state_ == ProcessingWindowState::SCHEDULED_WINDOW) {
|
| processing_time_budget = base::TimeDelta::FromSeconds(
|
| @@ -543,11 +543,13 @@ void RequestCoordinator::TryNextRequest() {
|
| policy_->GetProcessingTimeBudgetForImmediateLoadInSeconds());
|
| }
|
|
|
| - // If there is no time left in the budget, return to the scheduler.
|
| - // We do not remove the pending task that was set up earlier in case
|
| - // we run out of time, so the background scheduler will return to us
|
| - // at the next opportunity to run background tasks.
|
| - if ((base::Time::Now() - operation_start_time_) > processing_time_budget) {
|
| + // If there is no network or no time left in the budget, return to the
|
| + // scheduler. We do not remove the pending scheduler task that was set
|
| + // up earlier in case we run out of time, so the background scheduler
|
| + // will return to us at the next opportunity to run background tasks.
|
| + if (GetConnectionType() ==
|
| + net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE ||
|
| + (base::Time::Now() - operation_start_time_) > processing_time_budget) {
|
| is_starting_ = false;
|
|
|
| // Let the scheduler know we are done processing.
|
|
|