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

Unified Diff: net/base/network_quality_estimator.cc

Issue 1889153004: NQE Cleanup in preparation for file splitting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/network_quality_estimator.h ('k') | net/base/network_quality_estimator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_quality_estimator.cc
diff --git a/net/base/network_quality_estimator.cc b/net/base/network_quality_estimator.cc
index 65bc242f12cb6e1da0baf8a7611d5b62354197ae..2233333bcc3c8df4e913d687ec50c9d4996e84e5 100644
--- a/net/base/network_quality_estimator.cc
+++ b/net/base/network_quality_estimator.cc
@@ -233,13 +233,14 @@ NetworkQualityEstimator::NetworkQualityEstimator(
bool allow_smaller_responses_for_tests)
: allow_localhost_requests_(allow_local_host_requests_for_tests),
allow_small_responses_(allow_smaller_responses_for_tests),
+ weight_multiplier_per_second_(
+ GetWeightMultiplierPerSecond(variation_params)),
last_connection_change_(base::TimeTicks::Now()),
current_network_id_(
NetworkID(NetworkChangeNotifier::ConnectionType::CONNECTION_UNKNOWN,
std::string())),
- downstream_throughput_kbps_observations_(
- GetWeightMultiplierPerSecond(variation_params)),
- rtt_observations_(GetWeightMultiplierPerSecond(variation_params)),
+ downstream_throughput_kbps_observations_(weight_multiplier_per_second_),
+ rtt_observations_(weight_multiplier_per_second_),
external_estimate_provider_(std::move(external_estimates_provider)),
weak_ptr_factory_(this) {
static_assert(kMinRequestDurationMicroseconds > 0,
@@ -428,22 +429,22 @@ void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) {
// Duration between when the resource was requested and when response
// headers were received.
- base::TimeDelta observed_rtt = headers_received_time - request_start_time;
- DCHECK_GE(observed_rtt, base::TimeDelta());
- if (observed_rtt < peak_network_quality_.rtt()) {
- peak_network_quality_ = NetworkQuality(
- observed_rtt, peak_network_quality_.downstream_throughput_kbps());
- }
+ base::TimeDelta observed_rtt = headers_received_time - request_start_time;
+ DCHECK_GE(observed_rtt, base::TimeDelta());
+ if (observed_rtt < peak_network_quality_.rtt()) {
+ peak_network_quality_ = NetworkQuality(
+ observed_rtt, peak_network_quality_.downstream_throughput_kbps());
+ }
- RttObservation rtt_observation(observed_rtt, now, URL_REQUEST);
- rtt_observations_.AddObservation(rtt_observation);
- NotifyObserversOfRTT(rtt_observation);
+ RttObservation rtt_observation(observed_rtt, now, URL_REQUEST);
+ rtt_observations_.AddObservation(rtt_observation);
+ NotifyObserversOfRTT(rtt_observation);
- // Compare the RTT observation with the estimated value and record it.
- if (estimated_median_network_quality_.rtt() != InvalidRTT()) {
- RecordRTTUMA(estimated_median_network_quality_.rtt().InMilliseconds(),
- observed_rtt.InMilliseconds());
- }
+ // Compare the RTT observation with the estimated value and record it.
+ if (estimated_median_network_quality_.rtt() != InvalidRTT()) {
+ RecordRTTUMA(estimated_median_network_quality_.rtt().InMilliseconds(),
+ observed_rtt.InMilliseconds());
+ }
}
void NetworkQualityEstimator::NotifyRequestCompleted(
« no previous file with comments | « net/base/network_quality_estimator.h ('k') | net/base/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698