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

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

Issue 2433923005: Revert of Expose RTT and throughput estimates from Cronet (Closed)
Patch Set: 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
« no previous file with comments | « net/nqe/network_quality.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 0.0)), 402 0.0)),
403 forced_effective_connection_type_set_( 403 forced_effective_connection_type_set_(
404 !GetStringValueForVariationParamWithDefaultValue( 404 !GetStringValueForVariationParamWithDefaultValue(
405 variation_params, 405 variation_params,
406 "force_effective_connection_type", 406 "force_effective_connection_type",
407 "") 407 "")
408 .empty()), 408 .empty()),
409 weak_ptr_factory_(this) { 409 weak_ptr_factory_(this) {
410 static_assert(kDefaultHalfLifeSeconds > 0, 410 static_assert(kDefaultHalfLifeSeconds > 0,
411 "Default half life duration must be > 0"); 411 "Default half life duration must be > 0");
412 static_assert(kMinimumRTTVariationParameterMsec > 0 &&
413 kMinimumRTTVariationParameterMsec >
414 nqe::internal::INVALID_RTT_THROUGHPUT,
415 "kMinimumRTTVariationParameterMsec is set incorrectly");
416 static_assert(kMinimumThroughputVariationParameterKbps > 0 &&
417 kMinimumThroughputVariationParameterKbps >
418 nqe::internal::kInvalidThroughput,
419 "kMinimumThroughputVariationParameterKbps is set incorrectly");
420 // None of the algorithms can have an empty name. 412 // None of the algorithms can have an empty name.
421 DCHECK(algorithm_name_to_enum_.end() == 413 DCHECK(algorithm_name_to_enum_.end() ==
422 algorithm_name_to_enum_.find(std::string())); 414 algorithm_name_to_enum_.find(std::string()));
423 415
424 DCHECK_EQ(algorithm_name_to_enum_.size(), 416 DCHECK_EQ(algorithm_name_to_enum_.size(),
425 static_cast<size_t>(EffectiveConnectionTypeAlgorithm:: 417 static_cast<size_t>(EffectiveConnectionTypeAlgorithm::
426 EFFECTIVE_CONNECTION_TYPE_ALGORITHM_LAST)); 418 EFFECTIVE_CONNECTION_TYPE_ALGORITHM_LAST));
427 DCHECK_NE(EffectiveConnectionTypeAlgorithm:: 419 DCHECK_NE(EffectiveConnectionTypeAlgorithm::
428 EFFECTIVE_CONNECTION_TYPE_ALGORITHM_LAST, 420 EFFECTIVE_CONNECTION_TYPE_ALGORITHM_LAST,
429 effective_connection_type_algorithm_); 421 effective_connection_type_algorithm_);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 load_timing_info.receive_headers_end.is_null()) { 707 load_timing_info.receive_headers_end.is_null()) {
716 return; 708 return;
717 } 709 }
718 DCHECK(!request.response_info().was_cached); 710 DCHECK(!request.response_info().was_cached);
719 711
720 // Duration between when the resource was requested and when the response 712 // Duration between when the resource was requested and when the response
721 // headers were received. 713 // headers were received.
722 base::TimeDelta observed_http_rtt = 714 base::TimeDelta observed_http_rtt =
723 load_timing_info.receive_headers_end - load_timing_info.send_start; 715 load_timing_info.receive_headers_end - load_timing_info.send_start;
724 DCHECK_GE(observed_http_rtt, base::TimeDelta()); 716 DCHECK_GE(observed_http_rtt, base::TimeDelta());
725 if (observed_http_rtt < peak_network_quality_.http_rtt() || 717 if (observed_http_rtt < peak_network_quality_.http_rtt()) {
726 peak_network_quality_.http_rtt() == nqe::internal::InvalidRTT()) {
727 peak_network_quality_ = nqe::internal::NetworkQuality( 718 peak_network_quality_ = nqe::internal::NetworkQuality(
728 observed_http_rtt, peak_network_quality_.transport_rtt(), 719 observed_http_rtt, peak_network_quality_.transport_rtt(),
729 peak_network_quality_.downstream_throughput_kbps()); 720 peak_network_quality_.downstream_throughput_kbps());
730 } 721 }
731 722
732 RttObservation http_rtt_observation( 723 RttObservation http_rtt_observation(
733 observed_http_rtt, now, NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST); 724 observed_http_rtt, now, NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST);
734 rtt_observations_.AddObservation(http_rtt_observation); 725 rtt_observations_.AddObservation(http_rtt_observation);
735 NotifyObserversOfRTT(http_rtt_observation); 726 NotifyObserversOfRTT(http_rtt_observation);
736 } 727 }
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 1696
1706 void NetworkQualityEstimator::OnNewThroughputObservationAvailable( 1697 void NetworkQualityEstimator::OnNewThroughputObservationAvailable(
1707 int32_t downstream_kbps) { 1698 int32_t downstream_kbps) {
1708 DCHECK(thread_checker_.CalledOnValidThread()); 1699 DCHECK(thread_checker_.CalledOnValidThread());
1709 1700
1710 if (downstream_kbps == 0) 1701 if (downstream_kbps == 0)
1711 return; 1702 return;
1712 1703
1713 DCHECK_NE(nqe::internal::kInvalidThroughput, downstream_kbps); 1704 DCHECK_NE(nqe::internal::kInvalidThroughput, downstream_kbps);
1714 1705
1715 if (downstream_kbps > peak_network_quality_.downstream_throughput_kbps() || 1706 if (downstream_kbps > peak_network_quality_.downstream_throughput_kbps()) {
1716 peak_network_quality_.downstream_throughput_kbps() ==
1717 nqe::internal::kInvalidThroughput) {
1718 peak_network_quality_ = nqe::internal::NetworkQuality( 1707 peak_network_quality_ = nqe::internal::NetworkQuality(
1719 peak_network_quality_.http_rtt(), peak_network_quality_.transport_rtt(), 1708 peak_network_quality_.http_rtt(), peak_network_quality_.transport_rtt(),
1720 downstream_kbps); 1709 downstream_kbps);
1721 } 1710 }
1722 ThroughputObservation throughput_observation( 1711 ThroughputObservation throughput_observation(
1723 downstream_kbps, tick_clock_->NowTicks(), 1712 downstream_kbps, tick_clock_->NowTicks(),
1724 NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST); 1713 NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST);
1725 downstream_throughput_kbps_observations_.AddObservation( 1714 downstream_throughput_kbps_observations_.AddObservation(
1726 throughput_observation); 1715 throughput_observation);
1727 NotifyObserversOfThroughput(throughput_observation); 1716 NotifyObserversOfThroughput(throughput_observation);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 } 1781 }
1793 1782
1794 void NetworkQualityEstimator::RemoveNetworkQualitiesCacheObserver( 1783 void NetworkQualityEstimator::RemoveNetworkQualitiesCacheObserver(
1795 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* 1784 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver*
1796 observer) { 1785 observer) {
1797 DCHECK(thread_checker_.CalledOnValidThread()); 1786 DCHECK(thread_checker_.CalledOnValidThread());
1798 network_quality_store_->RemoveNetworkQualitiesCacheObserver(observer); 1787 network_quality_store_->RemoveNetworkQualitiesCacheObserver(observer);
1799 } 1788 }
1800 1789
1801 } // namespace net 1790 } // namespace net
OLDNEW
« no previous file with comments | « net/nqe/network_quality.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698