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

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

Issue 2648353003: Add effective connection type to throughput mapping (Closed)
Patch Set: Created 3 years, 11 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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 return false; 1399 return false;
1400 1400
1401 const base::TimeTicks now = tick_clock_->NowTicks(); 1401 const base::TimeTicks now = tick_clock_->NowTicks();
1402 1402
1403 if (effective_connection_type_ == EFFECTIVE_CONNECTION_TYPE_UNKNOWN) { 1403 if (effective_connection_type_ == EFFECTIVE_CONNECTION_TYPE_UNKNOWN) {
1404 // Read the effective connection type from the cached estimate. 1404 // Read the effective connection type from the cached estimate.
1405 last_effective_connection_type_computation_ = now; 1405 last_effective_connection_type_computation_ = now;
1406 network_quality_ = cached_network_quality.network_quality(); 1406 network_quality_ = cached_network_quality.network_quality();
1407 effective_connection_type_ = 1407 effective_connection_type_ =
1408 cached_network_quality.effective_connection_type(); 1408 cached_network_quality.effective_connection_type();
1409
1410 if (effective_connection_type_ != EFFECTIVE_CONNECTION_TYPE_UNKNOWN)
1411 NotifyObserversOfEffectiveConnectionTypeChanged();
1412 } 1409 }
1413 1410
1414 if (cached_network_quality.network_quality().downstream_throughput_kbps() != 1411 if (cached_network_quality.network_quality().downstream_throughput_kbps() !=
1415 nqe::internal::kInvalidThroughput) { 1412 nqe::internal::kInvalidThroughput) {
1416 ThroughputObservation througphput_observation( 1413 ThroughputObservation througphput_observation(
1417 cached_network_quality.network_quality().downstream_throughput_kbps(), 1414 cached_network_quality.network_quality().downstream_throughput_kbps(),
1418 now, INT32_MIN, 1415 now, INT32_MIN,
1419 NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE); 1416 NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE);
1420 downstream_throughput_kbps_observations_.AddObservation( 1417 downstream_throughput_kbps_observations_.AddObservation(
1421 througphput_observation); 1418 througphput_observation);
(...skipping 11 matching lines...) Expand all
1433 1430
1434 if (cached_network_quality.network_quality().transport_rtt() != 1431 if (cached_network_quality.network_quality().transport_rtt() !=
1435 nqe::internal::InvalidRTT()) { 1432 nqe::internal::InvalidRTT()) {
1436 RttObservation rtt_observation( 1433 RttObservation rtt_observation(
1437 cached_network_quality.network_quality().transport_rtt(), now, 1434 cached_network_quality.network_quality().transport_rtt(), now,
1438 INT32_MIN, 1435 INT32_MIN,
1439 NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT_CACHED_ESTIMATE); 1436 NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT_CACHED_ESTIMATE);
1440 rtt_observations_.AddObservation(rtt_observation); 1437 rtt_observations_.AddObservation(rtt_observation);
1441 NotifyObserversOfRTT(rtt_observation); 1438 NotifyObserversOfRTT(rtt_observation);
1442 } 1439 }
1440 ComputeEffectiveConnectionType();
RyanSturm 2017/01/25 19:15:34 If the computed type doesn't change from the ect o
tbansal1 2017/01/26 22:00:05 I removed that unnecessary code. ComputeECT() func
1443 return true; 1441 return true;
1444 } 1442 }
1445 1443
1446 void NetworkQualityEstimator::OnUpdatedEstimateAvailable( 1444 void NetworkQualityEstimator::OnUpdatedEstimateAvailable(
1447 const base::TimeDelta& rtt, 1445 const base::TimeDelta& rtt,
1448 int32_t downstream_throughput_kbps, 1446 int32_t downstream_throughput_kbps,
1449 int32_t upstream_throughput_kbps) { 1447 int32_t upstream_throughput_kbps) {
1450 DCHECK(thread_checker_.CalledOnValidThread()); 1448 DCHECK(thread_checker_.CalledOnValidThread());
1451 DCHECK(external_estimate_provider_); 1449 DCHECK(external_estimate_provider_);
1452 1450
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE); 1718 NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE);
1721 downstream_throughput_kbps_observations_.AddObservation( 1719 downstream_throughput_kbps_observations_.AddObservation(
1722 throughput_observation); 1720 throughput_observation);
1723 NotifyObserversOfThroughput(throughput_observation); 1721 NotifyObserversOfThroughput(throughput_observation);
1724 } 1722 }
1725 1723
1726 ComputeEffectiveConnectionType(); 1724 ComputeEffectiveConnectionType();
1727 } 1725 }
1728 1726
1729 } // namespace net 1727 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator_params.cc » ('j') | net/nqe/network_quality_estimator_params.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698