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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 | 801 |
802 for (auto& observer : effective_connection_type_observer_list_) | 802 for (auto& observer : effective_connection_type_observer_list_) |
803 observer.OnEffectiveConnectionTypeChanged(effective_connection_type); | 803 observer.OnEffectiveConnectionTypeChanged(effective_connection_type); |
804 | 804 |
805 network_quality_store_->Add(current_network_id_, | 805 network_quality_store_->Add(current_network_id_, |
806 nqe::internal::CachedNetworkQuality( | 806 nqe::internal::CachedNetworkQuality( |
807 tick_clock_->NowTicks(), network_quality_, | 807 tick_clock_->NowTicks(), network_quality_, |
808 effective_connection_type)); | 808 effective_connection_type)); |
809 } | 809 } |
810 | 810 |
| 811 void NetworkQualityEstimator::ReportRTTsAndThroughputForTesting( |
| 812 base::TimeDelta http_rtt, |
| 813 base::TimeDelta transport_rtt, |
| 814 int32_t downstream_throughput_kbps) { |
| 815 DCHECK(thread_checker_.CalledOnValidThread()); |
| 816 |
| 817 for (auto& observer : rtt_and_throughput_estimates_observer_list_) |
| 818 observer.OnRTTOrThroughputEstimatesComputed(http_rtt, transport_rtt, |
| 819 downstream_throughput_kbps); |
| 820 } |
| 821 |
811 bool NetworkQualityEstimator::RequestProvidesRTTObservation( | 822 bool NetworkQualityEstimator::RequestProvidesRTTObservation( |
812 const URLRequest& request) const { | 823 const URLRequest& request) const { |
813 DCHECK(thread_checker_.CalledOnValidThread()); | 824 DCHECK(thread_checker_.CalledOnValidThread()); |
814 | 825 |
815 return (use_localhost_requests_ || !IsLocalhost(request.url().host())) && | 826 return (use_localhost_requests_ || !IsLocalhost(request.url().host())) && |
816 // Verify that response headers are received, so it can be ensured that | 827 // Verify that response headers are received, so it can be ensured that |
817 // response is not cached. | 828 // response is not cached. |
818 !request.response_info().response_time.is_null() && | 829 !request.response_info().response_time.is_null() && |
819 !request.was_cached() && | 830 !request.was_cached() && |
820 request.creation_time() >= last_connection_change_; | 831 request.creation_time() >= last_connection_change_; |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1813 return "UnweightedAverage"; | 1824 return "UnweightedAverage"; |
1814 case STATISTIC_LAST: | 1825 case STATISTIC_LAST: |
1815 NOTREACHED(); | 1826 NOTREACHED(); |
1816 return ""; | 1827 return ""; |
1817 } | 1828 } |
1818 NOTREACHED(); | 1829 NOTREACHED(); |
1819 return ""; | 1830 return ""; |
1820 } | 1831 } |
1821 | 1832 |
1822 } // namespace net | 1833 } // namespace net |
OLD | NEW |