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

Unified Diff: net/nqe/network_quality_estimator.cc

Issue 2695783003: NQE: Record the main frame metrics at transaction start (Closed)
Patch Set: Fix comments 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..c92ed5286653fac450eb106402b4b326c424c4a5 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();
@@ -444,6 +430,25 @@ 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;
+ }
+
+ // 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) {
+ ComputeEffectiveConnectionType();
+ }
LoadTimingInfo load_timing_info;
request.GetLoadTimingInfo(&load_timing_info);
@@ -468,9 +473,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