Chromium Code Reviews| 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..0bd4f80526b3066a62849794aa8928e3a84c432b 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,23 @@ void ExternalEstimateProviderAndroid:: |
| void ExternalEstimateProviderAndroid::NotifyUpdatedEstimateAvailable() const { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| - if (delegate_) |
| - delegate_->OnUpdatedEstimateAvailable(); |
| + |
| + base::TimeDelta rtt; |
| + if (!GetRTT(&rtt)) |
|
bengr
2016/05/27 19:58:42
Shouldn't GetRTT not modify &rtt if it returns fal
tbansal1
2016/05/27 23:39:14
Done.
|
| + rtt = base::TimeDelta(); |
| + |
| + int32_t downstream_throughput_kbps; |
| + if (!GetDownstreamThroughputKbps(&downstream_throughput_kbps)) |
| + downstream_throughput_kbps = -1; |
| + |
| + int32_t upstream_throughput_kbps; |
| + if (!GetUpstreamThroughputKbps(&upstream_throughput_kbps)) |
| + upstream_throughput_kbps = -1; |
| + |
| + if (delegate_) { |
| + delegate_->OnUpdatedEstimateAvailable(rtt, downstream_throughput_kbps, |
| + upstream_throughput_kbps); |
| + } |
| } |
| bool RegisterExternalEstimateProviderAndroid(JNIEnv* env) { |