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

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

Issue 2717153002: NQE: Plumb RTT and throughput estimates to the UI thread (Closed)
Patch Set: ryansturm comments Created 3 years, 9 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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 return "UnweightedAverage"; 1826 return "UnweightedAverage";
1816 case STATISTIC_LAST: 1827 case STATISTIC_LAST:
1817 NOTREACHED(); 1828 NOTREACHED();
1818 return ""; 1829 return "";
1819 } 1830 }
1820 NOTREACHED(); 1831 NOTREACHED();
1821 return ""; 1832 return "";
1822 } 1833 }
1823 1834
1824 } // namespace net 1835 } // namespace net
OLDNEW
« net/nqe/network_quality_estimator.h ('K') | « net/nqe/network_quality_estimator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698