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

Unified Diff: chrome/browser/android/net/external_estimate_provider_android.cc

Issue 2010003002: Reduce the number of calls to external estimate provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 7 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: chrome/browser/android/net/external_estimate_provider_android.cc
diff --git a/chrome/browser/android/net/external_estimate_provider_android.cc b/chrome/browser/android/net/external_estimate_provider_android.cc
index cf5b000a8da25b5c3634c5826ca54d9ee234d608..2555fba813fb5d7658b1bea6f5091ffc7f0f7439 100644
--- a/chrome/browser/android/net/external_estimate_provider_android.cc
+++ b/chrome/browser/android/net/external_estimate_provider_android.cc
@@ -27,12 +27,10 @@ ExternalEstimateProviderAndroid::ExternalEstimateProviderAndroid()
reinterpret_cast<intptr_t>(this)));
DCHECK(!j_external_estimate_provider_.is_null());
no_value_ = Java_ExternalEstimateProviderAndroid_getNoValue(env);
- net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
}
ExternalEstimateProviderAndroid::~ExternalEstimateProviderAndroid() {
DCHECK(thread_checker_.CalledOnValidThread());
- net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
Java_ExternalEstimateProviderAndroid_destroy(
base::android::AttachCurrentThread(),
j_external_estimate_provider_.obj());
@@ -106,11 +104,6 @@ void ExternalEstimateProviderAndroid::Update() const {
env, j_external_estimate_provider_.obj());
}
-void ExternalEstimateProviderAndroid::OnConnectionTypeChanged(
- net::NetworkChangeNotifier::ConnectionType type) {
- Update();
-}
-
void ExternalEstimateProviderAndroid::
NotifyExternalEstimateProviderAndroidUpdate(
JNIEnv* env,
@@ -134,8 +127,20 @@ void ExternalEstimateProviderAndroid::
void ExternalEstimateProviderAndroid::NotifyUpdatedEstimateAvailable() const {
DCHECK(thread_checker_.CalledOnValidThread());
- if (delegate_)
- delegate_->OnUpdatedEstimateAvailable();
+
+ base::TimeDelta rtt;
+ GetRTT(&rtt);
+
+ int32_t downstream_throughput_kbps = -1;
+ GetDownstreamThroughputKbps(&downstream_throughput_kbps);
+
+ int32_t upstream_throughput_kbps = -1;
+ GetUpstreamThroughputKbps(&upstream_throughput_kbps);
+
+ if (delegate_) {
+ delegate_->OnUpdatedEstimateAvailable(rtt, downstream_throughput_kbps,
+ upstream_throughput_kbps);
+ }
}
bool RegisterExternalEstimateProviderAndroid(JNIEnv* env) {

Powered by Google App Engine
This is Rietveld 408576698