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

Unified Diff: net/nqe/network_quality_estimator.cc

Issue 2698913006: NQE: Record the main frame metrics at transaction start (Closed)
Patch Set: Potential fix 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 daa50cd7f4f09663b57660e92f621dc1980382c9..f17cb3ac1794df0a6c2d291d31cd1e639513ca58 100644
--- a/net/nqe/network_quality_estimator.cc
+++ b/net/nqe/network_quality_estimator.cc
@@ -402,25 +402,11 @@ 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();
@@ -428,7 +414,6 @@ void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) {
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
@@ -444,6 +429,21 @@ void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) {
measuring_delay);
}
}
+ 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)
+ MaybeQueryExternalEstimateProvider();
LoadTimingInfo load_timing_info;
request.GetLoadTimingInfo(&load_timing_info);
@@ -468,9 +468,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