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

Unified Diff: net/nqe/network_quality_estimator.cc

Issue 2481373004: NQE: Add default RTT and throughput observations (Closed)
Patch Set: Rebased, addressed bengr comments Created 4 years 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/nqe/network_quality_estimator.h ('k') | net/nqe/network_quality_estimator_params.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/network_quality_estimator.cc
diff --git a/net/nqe/network_quality_estimator.cc b/net/nqe/network_quality_estimator.cc
index 7e29eee87e3d037615a89fa5a1fa8ded9fddd82f..ab61fe1cfe31533c05e4cd768d0b3591025fe08a 100644
--- a/net/nqe/network_quality_estimator.cc
+++ b/net/nqe/network_quality_estimator.cc
@@ -220,6 +220,18 @@ NetworkQualityEstimator::NetworkQualityEstimator(
const std::map<std::string, std::string>& variation_params,
bool use_local_host_requests_for_tests,
bool use_smaller_responses_for_tests)
+ : NetworkQualityEstimator(std::move(external_estimates_provider),
+ variation_params,
+ use_local_host_requests_for_tests,
+ use_smaller_responses_for_tests,
+ true) {}
+
+NetworkQualityEstimator::NetworkQualityEstimator(
+ std::unique_ptr<ExternalEstimateProvider> external_estimates_provider,
+ const std::map<std::string, std::string>& variation_params,
+ bool use_local_host_requests_for_tests,
+ bool use_smaller_responses_for_tests,
+ bool add_default_platform_observations)
: algorithm_name_to_enum_({{"HttpRTTAndDownstreamThroughput",
EffectiveConnectionTypeAlgorithm::
HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT},
@@ -228,6 +240,7 @@ NetworkQualityEstimator::NetworkQualityEstimator(
TRANSPORT_RTT_OR_DOWNSTREAM_THROUGHOUT}}),
use_localhost_requests_(use_local_host_requests_for_tests),
use_small_responses_(use_smaller_responses_for_tests),
+ add_default_platform_observations_(add_default_platform_observations),
weight_multiplier_per_second_(
nqe::internal::GetWeightMultiplierPerSecond(variation_params)),
effective_connection_type_algorithm_(
@@ -322,6 +335,9 @@ void NetworkQualityEstimator::ObtainOperatingParams(
void NetworkQualityEstimator::AddDefaultEstimates() {
DCHECK(thread_checker_.CalledOnValidThread());
+ if (!add_default_platform_observations_)
+ return;
+
if (default_observations_[current_network_id_.type].http_rtt() !=
nqe::internal::InvalidRTT()) {
RttObservation rtt_observation(
@@ -332,6 +348,16 @@ void NetworkQualityEstimator::AddDefaultEstimates() {
NotifyObserversOfRTT(rtt_observation);
}
+ if (default_observations_[current_network_id_.type].transport_rtt() !=
+ nqe::internal::InvalidRTT()) {
+ RttObservation rtt_observation(
+ default_observations_[current_network_id_.type].transport_rtt(),
+ tick_clock_->NowTicks(),
+ NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_TRANSPORT_FROM_PLATFORM);
+ rtt_observations_.AddObservation(rtt_observation);
+ NotifyObserversOfRTT(rtt_observation);
+ }
+
if (default_observations_[current_network_id_.type]
.downstream_throughput_kbps() != nqe::internal::kInvalidThroughput) {
ThroughputObservation throughput_observation(
@@ -831,6 +857,10 @@ void NetworkQualityEstimator::RecordMetricsOnConnectionTypeChanged() const {
NETWORK_QUALITY_OBSERVATION_SOURCE_TCP);
disallowed_observation_sources.push_back(
NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC);
+ disallowed_observation_sources.push_back(
+ NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT_CACHED_ESTIMATE);
+ disallowed_observation_sources.push_back(
+ NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_TRANSPORT_FROM_PLATFORM);
for (size_t i = 0; i < arraysize(kPercentiles); ++i) {
rtt = GetRTTEstimateInternal(disallowed_observation_sources,
base::TimeTicks(), kPercentiles[i]);
@@ -1195,6 +1225,10 @@ bool NetworkQualityEstimator::GetRecentHttpRTT(
NETWORK_QUALITY_OBSERVATION_SOURCE_TCP);
disallowed_observation_sources.push_back(
NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC);
+ disallowed_observation_sources.push_back(
+ NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT_CACHED_ESTIMATE);
+ disallowed_observation_sources.push_back(
+ NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_TRANSPORT_FROM_PLATFORM);
*rtt = GetRTTEstimateInternal(disallowed_observation_sources, start_time, 50);
return (*rtt != nqe::internal::InvalidRTT());
}
« no previous file with comments | « net/nqe/network_quality_estimator.h ('k') | net/nqe/network_quality_estimator_params.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698