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

Unified Diff: net/nqe/network_quality_estimator.cc

Issue 2453653002: Separate out observation sources as either HTTP layer or transport layer (Closed)
Patch Set: ps Created 4 years, 1 month 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
Index: net/nqe/network_quality_estimator.cc
diff --git a/net/nqe/network_quality_estimator.cc b/net/nqe/network_quality_estimator.cc
index fc6ed937aeb11eee266a16b302954de116f77aea..0102edf5204d6ada81ba904af77e05d7230a5265 100644
--- a/net/nqe/network_quality_estimator.cc
+++ b/net/nqe/network_quality_estimator.cc
@@ -201,18 +201,6 @@ std::string GetEffectiveConnectionTypeAlgorithm(
return it->second;
}
-net::NetworkQualityObservationSource ProtocolSourceToObservationSource(
- net::SocketPerformanceWatcherFactory::Protocol protocol) {
- switch (protocol) {
- case net::SocketPerformanceWatcherFactory::PROTOCOL_TCP:
- return net::NETWORK_QUALITY_OBSERVATION_SOURCE_TCP;
- case net::SocketPerformanceWatcherFactory::PROTOCOL_QUIC:
- return net::NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC;
- }
- NOTREACHED();
- return net::NETWORK_QUALITY_OBSERVATION_SOURCE_TCP;
-}
-
// Returns true if the scheme of the |request| is either HTTP or HTTPS.
bool RequestSchemeIsHTTPOrHTTPS(const net::URLRequest& request) {
return request.url().is_valid() && request.url().SchemeIsHTTPOrHTTPS();
@@ -612,7 +600,7 @@ void NetworkQualityEstimator::AddDefaultEstimates() {
RttObservation rtt_observation(
default_observations_[current_network_id_.type].http_rtt(),
tick_clock_->NowTicks(),
- NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_FROM_PLATFORM);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_HTTP_FROM_PLATFORM);
rtt_observations_.AddObservation(rtt_observation);
NotifyObserversOfRTT(rtt_observation);
}
@@ -623,7 +611,7 @@ void NetworkQualityEstimator::AddDefaultEstimates() {
default_observations_[current_network_id_.type]
.downstream_throughput_kbps(),
tick_clock_->NowTicks(),
- NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_FROM_PLATFORM);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_HTTP_FROM_PLATFORM);
downstream_throughput_kbps_observations_.AddObservation(
throughput_observation);
NotifyObserversOfThroughput(throughput_observation);
@@ -729,8 +717,8 @@ void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) {
peak_network_quality_.downstream_throughput_kbps());
}
- RttObservation http_rtt_observation(
- observed_http_rtt, now, NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST);
+ RttObservation http_rtt_observation(observed_http_rtt, now,
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP);
rtt_observations_.AddObservation(http_rtt_observation);
NotifyObserversOfRTT(http_rtt_observation);
}
@@ -1128,9 +1116,7 @@ void NetworkQualityEstimator::RecordMetricsOnConnectionTypeChanged() const {
static const int kPercentiles[] = {0, 10, 90, 100};
std::vector<NetworkQualityObservationSource> disallowed_observation_sources;
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_TCP);
- disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT);
bengr 2016/11/04 16:38:13 I don't understand why this is necessary. Won't so
tbansal1 2016/11/04 20:11:20 My plan is to cache the transport RTT and HTTP RTT
for (size_t i = 0; i < arraysize(kPercentiles); ++i) {
rtt = GetRTTEstimateInternal(disallowed_observation_sources,
base::TimeTicks(), kPercentiles[i]);
@@ -1152,14 +1138,14 @@ void NetworkQualityEstimator::RecordMetricsOnConnectionTypeChanged() const {
static const int kPercentiles[] = {0, 10, 90, 100};
std::vector<NetworkQualityObservationSource> disallowed_observation_sources;
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP);
// Disallow external estimate provider since it provides RTT at HTTP layer.
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_EXTERNAL_ESTIMATE);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_EXTERNAL_ESTIMATE);
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_CACHED_ESTIMATE);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE);
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_FROM_PLATFORM);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_HTTP_FROM_PLATFORM);
for (size_t i = 0; i < arraysize(kPercentiles); ++i) {
rtt = GetRTTEstimateInternal(disallowed_observation_sources,
base::TimeTicks(), kPercentiles[i]);
@@ -1467,9 +1453,7 @@ bool NetworkQualityEstimator::GetRecentHttpRTT(
DCHECK(thread_checker_.CalledOnValidThread());
std::vector<NetworkQualityObservationSource> disallowed_observation_sources;
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_TCP);
- disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT);
*rtt = GetRTTEstimateInternal(disallowed_observation_sources, start_time, 50);
return (*rtt != nqe::internal::InvalidRTT());
}
@@ -1480,14 +1464,14 @@ bool NetworkQualityEstimator::GetRecentTransportRTT(
DCHECK(thread_checker_.CalledOnValidThread());
std::vector<NetworkQualityObservationSource> disallowed_observation_sources;
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP);
// Disallow external estimate provider since it provides RTT at HTTP layer.
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_EXTERNAL_ESTIMATE);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_EXTERNAL_ESTIMATE);
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_CACHED_ESTIMATE);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE);
disallowed_observation_sources.push_back(
- NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_FROM_PLATFORM);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_DEFAULT_HTTP_FROM_PLATFORM);
*rtt = GetRTTEstimateInternal(disallowed_observation_sources, start_time, 50);
return (*rtt != nqe::internal::InvalidRTT());
@@ -1613,7 +1597,7 @@ bool NetworkQualityEstimator::ReadCachedNetworkQualityEstimate() {
nqe::internal::kInvalidThroughput) {
ThroughputObservation througphput_observation(
cached_network_quality.network_quality().downstream_throughput_kbps(),
- now, NETWORK_QUALITY_OBSERVATION_SOURCE_CACHED_ESTIMATE);
+ now, NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE);
downstream_throughput_kbps_observations_.AddObservation(
througphput_observation);
NotifyObserversOfThroughput(througphput_observation);
@@ -1623,7 +1607,7 @@ bool NetworkQualityEstimator::ReadCachedNetworkQualityEstimate() {
nqe::internal::InvalidRTT()) {
RttObservation rtt_observation(
cached_network_quality.network_quality().http_rtt(), now,
- NETWORK_QUALITY_OBSERVATION_SOURCE_CACHED_ESTIMATE);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE);
rtt_observations_.AddObservation(rtt_observation);
NotifyObserversOfRTT(rtt_observation);
}
@@ -1646,9 +1630,9 @@ void NetworkQualityEstimator::OnUpdatedEstimateAvailable(
RecordExternalEstimateProviderMetrics(
EXTERNAL_ESTIMATE_PROVIDER_STATUS_RTT_AVAILABLE);
UMA_HISTOGRAM_TIMES("NQE.ExternalEstimateProvider.RTT", rtt);
- rtt_observations_.AddObservation(
- RttObservation(rtt, tick_clock_->NowTicks(),
- NETWORK_QUALITY_OBSERVATION_SOURCE_EXTERNAL_ESTIMATE));
+ rtt_observations_.AddObservation(RttObservation(
+ rtt, tick_clock_->NowTicks(),
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_EXTERNAL_ESTIMATE));
external_estimate_provider_quality_.set_http_rtt(rtt);
}
@@ -1660,7 +1644,7 @@ void NetworkQualityEstimator::OnUpdatedEstimateAvailable(
downstream_throughput_kbps_observations_.AddObservation(
ThroughputObservation(
downstream_throughput_kbps, tick_clock_->NowTicks(),
- NETWORK_QUALITY_OBSERVATION_SOURCE_EXTERNAL_ESTIMATE));
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_EXTERNAL_ESTIMATE));
external_estimate_provider_quality_.set_downstream_throughput_kbps(
downstream_throughput_kbps);
}
@@ -1683,7 +1667,7 @@ void NetworkQualityEstimator::OnUpdatedRTTAvailable(
DCHECK_NE(nqe::internal::InvalidRTT(), rtt);
RttObservation observation(rtt, tick_clock_->NowTicks(),
- ProtocolSourceToObservationSource(protocol));
+ NETWORK_QUALITY_OBSERVATION_SOURCE_TRANSPORT);
NotifyObserversOfRTT(observation);
rtt_observations_.AddObservation(observation);
}
@@ -1734,7 +1718,7 @@ void NetworkQualityEstimator::OnNewThroughputObservationAvailable(
}
ThroughputObservation throughput_observation(
downstream_kbps, tick_clock_->NowTicks(),
- NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST);
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP);
downstream_throughput_kbps_observations_.AddObservation(
throughput_observation);
NotifyObserversOfThroughput(throughput_observation);
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator_unittest.cc » ('j') | net/nqe/network_quality_observation_source.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698