Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: net/nqe/network_quality_estimator.cc

Issue 2369673004: Wire NQE Prefs to Profile (Closed)
Patch Set: Addressed bengr comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 DCHECK(thread_checker_.CalledOnValidThread()); 977 DCHECK(thread_checker_.CalledOnValidThread());
978 use_small_responses_ = use_small_responses; 978 use_small_responses_ = use_small_responses;
979 throughput_analyzer_->SetUseSmallResponsesForTesting(use_small_responses_); 979 throughput_analyzer_->SetUseSmallResponsesForTesting(use_small_responses_);
980 } 980 }
981 981
982 void NetworkQualityEstimator::ReportEffectiveConnectionTypeForTesting( 982 void NetworkQualityEstimator::ReportEffectiveConnectionTypeForTesting(
983 EffectiveConnectionType effective_connection_type) { 983 EffectiveConnectionType effective_connection_type) {
984 DCHECK(thread_checker_.CalledOnValidThread()); 984 DCHECK(thread_checker_.CalledOnValidThread());
985 for (auto& observer : effective_connection_type_observer_list_) 985 for (auto& observer : effective_connection_type_observer_list_)
986 observer.OnEffectiveConnectionTypeChanged(effective_connection_type); 986 observer.OnEffectiveConnectionTypeChanged(effective_connection_type);
987
988 network_quality_store_->Add(
989 current_network_id_,
990 nqe::internal::CachedNetworkQuality(tick_clock_->NowTicks(),
991 estimated_quality_at_last_main_frame_,
992 effective_connection_type));
987 } 993 }
988 994
989 bool NetworkQualityEstimator::RequestProvidesRTTObservation( 995 bool NetworkQualityEstimator::RequestProvidesRTTObservation(
990 const URLRequest& request) const { 996 const URLRequest& request) const {
991 DCHECK(thread_checker_.CalledOnValidThread()); 997 DCHECK(thread_checker_.CalledOnValidThread());
992 998
993 return (use_localhost_requests_ || !IsLocalhost(request.url().host())) && 999 return (use_localhost_requests_ || !IsLocalhost(request.url().host())) &&
994 // Verify that response headers are received, so it can be ensured that 1000 // Verify that response headers are received, so it can be ensured that
995 // response is not cached. 1001 // response is not cached.
996 !request.response_info().response_time.is_null() && 1002 !request.response_info().response_time.is_null() &&
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 network_quality_store_->AddNetworkQualitiesCacheObserver(observer); 1786 network_quality_store_->AddNetworkQualitiesCacheObserver(observer);
1781 } 1787 }
1782 1788
1783 void NetworkQualityEstimator::RemoveNetworkQualitiesCacheObserver( 1789 void NetworkQualityEstimator::RemoveNetworkQualitiesCacheObserver(
1784 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* 1790 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver*
1785 observer) { 1791 observer) {
1786 DCHECK(thread_checker_.CalledOnValidThread()); 1792 DCHECK(thread_checker_.CalledOnValidThread());
1787 network_quality_store_->RemoveNetworkQualitiesCacheObserver(observer); 1793 network_quality_store_->RemoveNetworkQualitiesCacheObserver(observer);
1788 } 1794 }
1789 1795
1796 void NetworkQualityEstimator::OnPrefsRead(
1797 const std::map<nqe::internal::NetworkID,
1798 nqe::internal::CachedNetworkQuality> read_prefs) {
1799 DCHECK(thread_checker_.CalledOnValidThread());
1800 UMA_HISTOGRAM_COUNTS("NQE.Prefs.ReadSize", read_prefs.size());
1801 // TODO(tbansal): Incorporate the network quality into the current estimates.
bengr 2016/10/18 21:47:36 Reference a bug.
tbansal1 2016/10/19 18:34:47 Done.
1802 }
1803
1790 } // namespace net 1804 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698