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

Unified Diff: net/nqe/network_quality_estimator.cc

Issue 2712443002: NQE: Move ECT computation to NotifyHeadersReceived (Closed)
Patch Set: Created 3 years, 10 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/nqe/network_quality_estimator.h ('k') | net/nqe/network_quality_estimator_unittest.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 f252e05135b9649964d3b73dab2021139c17ab5d..807a5423cd58a966b59dce1a23c7ebee0aa8bda8 100644
--- a/net/nqe/network_quality_estimator.cc
+++ b/net/nqe/network_quality_estimator.cc
@@ -393,34 +393,17 @@ void NetworkQualityEstimator::NotifyStartTransaction(
if (!RequestSchemeIsHTTPOrHTTPS(request))
return;
- throughput_analyzer_->NotifyStartTransaction(request);
-}
-
-void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) {
- TRACE_EVENT0(kNetTracingCategory,
- "NetworkQualityEstimator::NotifyHeadersReceived");
- DCHECK(thread_checker_.CalledOnValidThread());
-
- if (!RequestSchemeIsHTTPOrHTTPS(request) ||
- !RequestProvidesRTTObservation(request)) {
- return;
- }
-
- const base::TimeTicks now = tick_clock_->NowTicks();
-
// Update |estimated_quality_at_last_main_frame_| if this is a main frame
// request.
// TODO(tbansal): Refactor this to a separate method.
if (request.load_flags() & LOAD_MAIN_FRAME_DEPRECATED) {
+ base::TimeTicks now = tick_clock_->NowTicks();
last_main_frame_request_ = now;
- ComputeEffectiveConnectionType();
+ MaybeComputeEffectiveConnectionType();
effective_connection_type_at_last_main_frame_ = effective_connection_type_;
estimated_quality_at_last_main_frame_ = network_quality_;
- RecordMetricsOnMainFrameRequest();
- MaybeQueryExternalEstimateProvider();
-
// Post the tasks which will run in the future and record the estimation
// accuracy based on the observations received between now and the time of
// task execution. Posting the task at different intervals makes it
@@ -436,6 +419,24 @@ void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) {
}
UpdateSignalStrength();
}
+ throughput_analyzer_->NotifyStartTransaction(request);
+}
+
+void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) {
+ TRACE_EVENT0(kNetTracingCategory,
+ "NetworkQualityEstimator::NotifyHeadersReceived");
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (!RequestSchemeIsHTTPOrHTTPS(request) ||
+ !RequestProvidesRTTObservation(request)) {
+ return;
+ }
+
+ if (request.load_flags() & LOAD_MAIN_FRAME_DEPRECATED) {
+ ComputeEffectiveConnectionType();
+ RecordMetricsOnMainFrameRequest();
+ MaybeQueryExternalEstimateProvider();
+ }
LoadTimingInfo load_timing_info;
request.GetLoadTimingInfo(&load_timing_info);
@@ -460,9 +461,9 @@ void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) {
peak_network_quality_.downstream_throughput_kbps());
}
- RttObservation http_rtt_observation(observed_http_rtt, now,
- signal_strength_dbm_,
- NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP);
+ RttObservation http_rtt_observation(
+ observed_http_rtt, tick_clock_->NowTicks(), signal_strength_dbm_,
+ NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP);
rtt_observations_.AddObservation(http_rtt_observation);
NotifyObserversOfRTT(http_rtt_observation);
}
« no previous file with comments | « net/nqe/network_quality_estimator.h ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698