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

Unified Diff: components/cronet/android/cronet_url_request_context_adapter.cc

Issue 2417643007: Expose RTT and throughput estimates from Cronet (Closed)
Patch Set: Removed annotation Created 4 years, 2 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
Index: components/cronet/android/cronet_url_request_context_adapter.cc
diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc
index ffe6089a2ec9ba859339a059dc1872bd46ca25d7..7c1385058a30caab90dd0a35fff31b5cab3639f8 100644
--- a/components/cronet/android/cronet_url_request_context_adapter.cc
+++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -427,6 +427,7 @@ CronetURLRequestContextAdapter::~CronetURLRequestContextAdapter() {
network_quality_estimator_->RemoveRTTObserver(this);
network_quality_estimator_->RemoveThroughputObserver(this);
network_quality_estimator_->RemoveEffectiveConnectionTypeObserver(this);
+ network_quality_estimator_->RemoveRTTAndThroughputEstimatesObserver(this);
}
// Stop NetLog observer if there is one.
@@ -626,6 +627,7 @@ void CronetURLRequestContextAdapter::InitializeOnNetworkThread(
context_builder.set_socket_performance_watcher_factory(
network_quality_estimator_->GetSocketPerformanceWatcherFactory());
network_quality_estimator_->AddEffectiveConnectionTypeObserver(this);
+ network_quality_estimator_->AddRTTAndThroughputEstimatesObserver(this);
}
context_ = context_builder.Build();
@@ -871,6 +873,18 @@ void CronetURLRequestContextAdapter::OnEffectiveConnectionTypeChanged(
effective_connection_type);
}
+void CronetURLRequestContextAdapter::OnRTTOrThroughputEstimatesComputed(
+ base::TimeDelta http_rtt,
+ base::TimeDelta transport_rtt,
+ int32_t downstream_throughput_kbps) {
+ DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
+
+ Java_CronetUrlRequestContext_onRTTOrThroughputEstimatesComputed(
+ base::android::AttachCurrentThread(), jcronet_url_request_context_.obj(),
+ http_rtt.InMilliseconds(), transport_rtt.InMilliseconds(),
+ downstream_throughput_kbps);
+}
+
void CronetURLRequestContextAdapter::OnRTTObservation(
int32_t rtt_ms,
const base::TimeTicks& timestamp,

Powered by Google App Engine
This is Rietveld 408576698