| 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 <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 RequestCoordinator::OfflinerImmediateStartStatus::STATUS_COUNT); | 440 RequestCoordinator::OfflinerImmediateStartStatus::STATUS_COUNT); |
| 441 } | 441 } |
| 442 | 442 |
| 443 RequestCoordinator::OfflinerImmediateStartStatus | 443 RequestCoordinator::OfflinerImmediateStartStatus |
| 444 RequestCoordinator::TryImmediateStart() { | 444 RequestCoordinator::TryImmediateStart() { |
| 445 // Make sure not already busy processing. | 445 // Make sure not already busy processing. |
| 446 if (is_busy_) | 446 if (is_busy_) |
| 447 return OfflinerImmediateStartStatus::BUSY; | 447 return OfflinerImmediateStartStatus::BUSY; |
| 448 | 448 |
| 449 // Make sure we are not on svelte device to start immediately. | 449 // Make sure we are not on svelte device to start immediately. |
| 450 if (base::SysInfo::IsLowEndDevice()) | 450 // Let the scheduler know we are done processing and failed due to svelte. |
| 451 if (base::SysInfo::IsLowEndDevice()) { |
| 452 immediate_schedule_callback_.Run(false); |
| 451 return OfflinerImmediateStartStatus::NOT_STARTED_ON_SVELTE; | 453 return OfflinerImmediateStartStatus::NOT_STARTED_ON_SVELTE; |
| 454 } |
| 452 | 455 |
| 453 // Make sure we have reasonable network quality (or at least a connection). | 456 // Make sure we have reasonable network quality (or at least a connection). |
| 454 if (network_quality_estimator_) { | 457 if (network_quality_estimator_) { |
| 455 // TODO(dougarnett): Add UMA for quality type experienced. | 458 // TODO(dougarnett): Add UMA for quality type experienced. |
| 456 net::EffectiveConnectionType quality = | 459 net::EffectiveConnectionType quality = |
| 457 network_quality_estimator_->GetEffectiveConnectionType(); | 460 network_quality_estimator_->GetEffectiveConnectionType(); |
| 458 if (quality < net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_2G) | 461 if (quality < net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_2G) |
| 459 return OfflinerImmediateStartStatus::WEAK_CONNECTION; | 462 return OfflinerImmediateStartStatus::WEAK_CONNECTION; |
| 460 } else if (GetConnectionType() == | 463 } else if (GetConnectionType() == |
| 461 net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE) { | 464 net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE) { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 | 753 |
| 751 ClientPolicyController* RequestCoordinator::GetPolicyController() { | 754 ClientPolicyController* RequestCoordinator::GetPolicyController() { |
| 752 return policy_controller_.get(); | 755 return policy_controller_.get(); |
| 753 } | 756 } |
| 754 | 757 |
| 755 void RequestCoordinator::Shutdown() { | 758 void RequestCoordinator::Shutdown() { |
| 756 network_quality_estimator_ = nullptr; | 759 network_quality_estimator_ = nullptr; |
| 757 } | 760 } |
| 758 | 761 |
| 759 } // namespace offline_pages | 762 } // namespace offline_pages |
| OLD | NEW |