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

Side by Side Diff: components/cronet/android/cronet_url_request_context_adapter.cc

Issue 2433923005: Revert of Expose RTT and throughput estimates from Cronet (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/cronet/android/cronet_url_request_context_adapter.h" 5 #include "components/cronet/android/cronet_url_request_context_adapter.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); 420 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
421 421
422 if (http_server_properties_manager_) 422 if (http_server_properties_manager_)
423 http_server_properties_manager_->ShutdownOnPrefThread(); 423 http_server_properties_manager_->ShutdownOnPrefThread();
424 if (pref_service_) 424 if (pref_service_)
425 pref_service_->CommitPendingWrite(); 425 pref_service_->CommitPendingWrite();
426 if (network_quality_estimator_) { 426 if (network_quality_estimator_) {
427 network_quality_estimator_->RemoveRTTObserver(this); 427 network_quality_estimator_->RemoveRTTObserver(this);
428 network_quality_estimator_->RemoveThroughputObserver(this); 428 network_quality_estimator_->RemoveThroughputObserver(this);
429 network_quality_estimator_->RemoveEffectiveConnectionTypeObserver(this); 429 network_quality_estimator_->RemoveEffectiveConnectionTypeObserver(this);
430 network_quality_estimator_->RemoveRTTAndThroughputEstimatesObserver(this);
431 } 430 }
432 431
433 // Stop NetLog observer if there is one. 432 // Stop NetLog observer if there is one.
434 StopNetLogHelper(); 433 StopNetLogHelper();
435 } 434 }
436 435
437 void CronetURLRequestContextAdapter::InitRequestContextOnMainThread( 436 void CronetURLRequestContextAdapter::InitRequestContextOnMainThread(
438 JNIEnv* env, 437 JNIEnv* env,
439 const JavaParamRef<jobject>& jcaller) { 438 const JavaParamRef<jobject>& jcaller) {
440 base::android::ScopedJavaGlobalRef<jobject> jcaller_ref; 439 base::android::ScopedJavaGlobalRef<jobject> jcaller_ref;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 variation_params["effective_connection_type_algorithm"] = 619 variation_params["effective_connection_type_algorithm"] =
621 "TransportRTTOrDownstreamThroughput"; 620 "TransportRTTOrDownstreamThroughput";
622 network_quality_estimator_.reset(new net::NetworkQualityEstimator( 621 network_quality_estimator_.reset(new net::NetworkQualityEstimator(
623 std::unique_ptr<net::ExternalEstimateProvider>(), variation_params, 622 std::unique_ptr<net::ExternalEstimateProvider>(), variation_params,
624 false, false)); 623 false, false));
625 // Set the socket performance watcher factory so that network quality 624 // Set the socket performance watcher factory so that network quality
626 // estimator is notified of socket performance metrics from TCP and QUIC. 625 // estimator is notified of socket performance metrics from TCP and QUIC.
627 context_builder.set_socket_performance_watcher_factory( 626 context_builder.set_socket_performance_watcher_factory(
628 network_quality_estimator_->GetSocketPerformanceWatcherFactory()); 627 network_quality_estimator_->GetSocketPerformanceWatcherFactory());
629 network_quality_estimator_->AddEffectiveConnectionTypeObserver(this); 628 network_quality_estimator_->AddEffectiveConnectionTypeObserver(this);
630 network_quality_estimator_->AddRTTAndThroughputEstimatesObserver(this);
631 } 629 }
632 630
633 context_ = context_builder.Build(); 631 context_ = context_builder.Build();
634 if (network_quality_estimator_) 632 if (network_quality_estimator_)
635 context_->set_network_quality_estimator(network_quality_estimator_.get()); 633 context_->set_network_quality_estimator(network_quality_estimator_.get());
636 634
637 if (config->load_disable_cache) 635 if (config->load_disable_cache)
638 default_load_flags_ |= net::LOAD_DISABLE_CACHE; 636 default_load_flags_ |= net::LOAD_DISABLE_CACHE;
639 637
640 if (config->enable_sdch) { 638 if (config->enable_sdch) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 } 864 }
867 865
868 void CronetURLRequestContextAdapter::OnEffectiveConnectionTypeChanged( 866 void CronetURLRequestContextAdapter::OnEffectiveConnectionTypeChanged(
869 net::EffectiveConnectionType effective_connection_type) { 867 net::EffectiveConnectionType effective_connection_type) {
870 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); 868 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
871 Java_CronetUrlRequestContext_onEffectiveConnectionTypeChanged( 869 Java_CronetUrlRequestContext_onEffectiveConnectionTypeChanged(
872 base::android::AttachCurrentThread(), jcronet_url_request_context_.obj(), 870 base::android::AttachCurrentThread(), jcronet_url_request_context_.obj(),
873 effective_connection_type); 871 effective_connection_type);
874 } 872 }
875 873
876 void CronetURLRequestContextAdapter::OnRTTOrThroughputEstimatesComputed(
877 base::TimeDelta http_rtt,
878 base::TimeDelta transport_rtt,
879 int32_t downstream_throughput_kbps) {
880 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
881
882 Java_CronetUrlRequestContext_onRTTOrThroughputEstimatesComputed(
883 base::android::AttachCurrentThread(), jcronet_url_request_context_.obj(),
884 http_rtt.InMilliseconds(), transport_rtt.InMilliseconds(),
885 downstream_throughput_kbps);
886 }
887
888 void CronetURLRequestContextAdapter::OnRTTObservation( 874 void CronetURLRequestContextAdapter::OnRTTObservation(
889 int32_t rtt_ms, 875 int32_t rtt_ms,
890 const base::TimeTicks& timestamp, 876 const base::TimeTicks& timestamp,
891 net::NetworkQualityObservationSource source) { 877 net::NetworkQualityObservationSource source) {
892 Java_CronetUrlRequestContext_onRttObservation( 878 Java_CronetUrlRequestContext_onRttObservation(
893 base::android::AttachCurrentThread(), jcronet_url_request_context_, 879 base::android::AttachCurrentThread(), jcronet_url_request_context_,
894 rtt_ms, (timestamp - base::TimeTicks::UnixEpoch()).InMilliseconds(), 880 rtt_ms, (timestamp - base::TimeTicks::UnixEpoch()).InMilliseconds(),
895 source); 881 source);
896 } 882 }
897 883
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 JNIEnv* env, 1073 JNIEnv* env,
1088 const JavaParamRef<jclass>& jcaller) { 1074 const JavaParamRef<jclass>& jcaller) {
1089 base::StatisticsRecorder::Initialize(); 1075 base::StatisticsRecorder::Initialize();
1090 std::vector<uint8_t> data; 1076 std::vector<uint8_t> data;
1091 if (!HistogramManager::GetInstance()->GetDeltas(&data)) 1077 if (!HistogramManager::GetInstance()->GetDeltas(&data))
1092 return ScopedJavaLocalRef<jbyteArray>(); 1078 return ScopedJavaLocalRef<jbyteArray>();
1093 return base::android::ToJavaByteArray(env, &data[0], data.size()); 1079 return base::android::ToJavaByteArray(env, &data[0], data.size());
1094 } 1080 }
1095 1081
1096 } // namespace cronet 1082 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698