| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "net/nqe/network_quality_estimator.h" | 5 #include "net/nqe/network_quality_estimator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 nqe::internal::CachedNetworkQuality cached_network_quality( | 1760 nqe::internal::CachedNetworkQuality cached_network_quality( |
| 1761 base::TimeTicks::Now(), | 1761 base::TimeTicks::Now(), |
| 1762 params_.TypicalNetworkQuality(effective_connection_type), | 1762 params_.TypicalNetworkQuality(effective_connection_type), |
| 1763 effective_connection_type); | 1763 effective_connection_type); |
| 1764 | 1764 |
| 1765 network_quality_store_->Add(it.first, cached_network_quality); | 1765 network_quality_store_->Add(it.first, cached_network_quality); |
| 1766 MaybeUpdateNetworkQualityFromCache(it.first, cached_network_quality); | 1766 MaybeUpdateNetworkQualityFromCache(it.first, cached_network_quality); |
| 1767 } | 1767 } |
| 1768 } | 1768 } |
| 1769 | 1769 |
| 1770 base::Optional<base::TimeDelta> NetworkQualityEstimator::GetTransportRTT() |
| 1771 const { |
| 1772 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1773 |
| 1774 if (network_quality_.transport_rtt() == nqe::internal::InvalidRTT()) |
| 1775 return base::Optional<base::TimeDelta>(); |
| 1776 return network_quality_.transport_rtt(); |
| 1777 } |
| 1778 |
| 1770 void NetworkQualityEstimator::MaybeUpdateNetworkQualityFromCache( | 1779 void NetworkQualityEstimator::MaybeUpdateNetworkQualityFromCache( |
| 1771 const nqe::internal::NetworkID& network_id, | 1780 const nqe::internal::NetworkID& network_id, |
| 1772 const nqe::internal::CachedNetworkQuality& cached_network_quality) { | 1781 const nqe::internal::CachedNetworkQuality& cached_network_quality) { |
| 1773 DCHECK(thread_checker_.CalledOnValidThread()); | 1782 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1774 | 1783 |
| 1775 if (!params_.persistent_cache_reading_enabled()) | 1784 if (!params_.persistent_cache_reading_enabled()) |
| 1776 return; | 1785 return; |
| 1777 if (network_id != current_network_id_) | 1786 if (network_id != current_network_id_) |
| 1778 return; | 1787 return; |
| 1779 | 1788 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 return base::Optional<base::TimeDelta>(); | 1842 return base::Optional<base::TimeDelta>(); |
| 1834 } | 1843 } |
| 1835 | 1844 |
| 1836 base::Optional<int32_t> | 1845 base::Optional<int32_t> |
| 1837 NetworkQualityEstimator::NetworkQualityProvider::GetDownstreamThroughputKbps() | 1846 NetworkQualityEstimator::NetworkQualityProvider::GetDownstreamThroughputKbps() |
| 1838 const { | 1847 const { |
| 1839 return base::Optional<int32_t>(); | 1848 return base::Optional<int32_t>(); |
| 1840 } | 1849 } |
| 1841 | 1850 |
| 1842 } // namespace net | 1851 } // namespace net |
| OLD | NEW |