| 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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 use_small_responses_ = use_small_responses; | 975 use_small_responses_ = use_small_responses; |
| 976 throughput_analyzer_->SetUseSmallResponsesForTesting(use_small_responses_); | 976 throughput_analyzer_->SetUseSmallResponsesForTesting(use_small_responses_); |
| 977 } | 977 } |
| 978 | 978 |
| 979 void NetworkQualityEstimator::ReportEffectiveConnectionTypeForTesting( | 979 void NetworkQualityEstimator::ReportEffectiveConnectionTypeForTesting( |
| 980 EffectiveConnectionType effective_connection_type) { | 980 EffectiveConnectionType effective_connection_type) { |
| 981 DCHECK(thread_checker_.CalledOnValidThread()); | 981 DCHECK(thread_checker_.CalledOnValidThread()); |
| 982 FOR_EACH_OBSERVER( | 982 FOR_EACH_OBSERVER( |
| 983 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, | 983 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, |
| 984 OnEffectiveConnectionTypeChanged(effective_connection_type)); | 984 OnEffectiveConnectionTypeChanged(effective_connection_type)); |
| 985 |
| 986 network_quality_store_->Add( |
| 987 current_network_id_, |
| 988 nqe::internal::CachedNetworkQuality(tick_clock_->NowTicks(), |
| 989 estimated_quality_at_last_main_frame_, |
| 990 effective_connection_type_)); |
| 985 } | 991 } |
| 986 | 992 |
| 987 bool NetworkQualityEstimator::RequestProvidesRTTObservation( | 993 bool NetworkQualityEstimator::RequestProvidesRTTObservation( |
| 988 const URLRequest& request) const { | 994 const URLRequest& request) const { |
| 989 DCHECK(thread_checker_.CalledOnValidThread()); | 995 DCHECK(thread_checker_.CalledOnValidThread()); |
| 990 | 996 |
| 991 return (use_localhost_requests_ || !IsLocalhost(request.url().host())) && | 997 return (use_localhost_requests_ || !IsLocalhost(request.url().host())) && |
| 992 // Verify that response headers are received, so it can be ensured that | 998 // Verify that response headers are received, so it can be ensured that |
| 993 // response is not cached. | 999 // response is not cached. |
| 994 !request.response_info().response_time.is_null() && | 1000 !request.response_info().response_time.is_null() && |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 } | 1735 } |
| 1730 | 1736 |
| 1731 void NetworkQualityEstimator::RemoveNetworkQualitiesCacheObserver( | 1737 void NetworkQualityEstimator::RemoveNetworkQualitiesCacheObserver( |
| 1732 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* | 1738 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* |
| 1733 observer) { | 1739 observer) { |
| 1734 DCHECK(thread_checker_.CalledOnValidThread()); | 1740 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1735 network_quality_store_->RemoveNetworkQualitiesCacheObserver(observer); | 1741 network_quality_store_->RemoveNetworkQualitiesCacheObserver(observer); |
| 1736 } | 1742 } |
| 1737 | 1743 |
| 1738 } // namespace net | 1744 } // namespace net |
| OLD | NEW |