Chromium Code Reviews| Index: net/nqe/network_quality_estimator.cc |
| diff --git a/net/nqe/network_quality_estimator.cc b/net/nqe/network_quality_estimator.cc |
| index 6bb69d9ee8ce69244ef2313aa4ac2cff04ad604f..4f7a700c39ff4b778e84649ddf21ad814d4eb465 100644 |
| --- a/net/nqe/network_quality_estimator.cc |
| +++ b/net/nqe/network_quality_estimator.cc |
| @@ -33,6 +33,7 @@ |
| #include "net/http/http_response_headers.h" |
| #include "net/http/http_response_info.h" |
| #include "net/http/http_status_code.h" |
| +#include "net/nqe/event_creator.h" |
| #include "net/nqe/network_quality_estimator_params.h" |
| #include "net/nqe/socket_watcher_factory.h" |
| #include "net/nqe/throughput_analyzer.h" |
| @@ -207,29 +208,35 @@ void RecordEffectiveConnectionTypeAccuracy( |
| NetworkQualityEstimator::NetworkQualityEstimator( |
| std::unique_ptr<ExternalEstimateProvider> external_estimates_provider, |
| - const std::map<std::string, std::string>& variation_params) |
| + const std::map<std::string, std::string>& variation_params, |
| + NetLog* net_log) |
| : NetworkQualityEstimator(std::move(external_estimates_provider), |
| variation_params, |
| false, |
| - false) {} |
| + false, |
| + net_log) {} |
| NetworkQualityEstimator::NetworkQualityEstimator( |
| std::unique_ptr<ExternalEstimateProvider> external_estimates_provider, |
| const std::map<std::string, std::string>& variation_params, |
| bool use_local_host_requests_for_tests, |
| - bool use_smaller_responses_for_tests) |
| - : NetworkQualityEstimator(std::move(external_estimates_provider), |
| - variation_params, |
| - use_local_host_requests_for_tests, |
| - use_smaller_responses_for_tests, |
| - true) {} |
| + bool use_smaller_responses_for_tests, |
| + NetLog* net_log) |
| + : NetworkQualityEstimator( |
| + std::move(external_estimates_provider), |
| + variation_params, |
| + use_local_host_requests_for_tests, |
| + use_smaller_responses_for_tests, |
| + true, |
| + NetLogWithSource::Make(net_log, net::NetLogSourceType::NONE)) {} |
|
mmenke
2017/01/12 21:40:02
Seems like these should be top level events - i.e.
tbansal1
2017/01/12 23:12:31
My only concern with making this a top level event
|
| NetworkQualityEstimator::NetworkQualityEstimator( |
| std::unique_ptr<ExternalEstimateProvider> external_estimates_provider, |
| const std::map<std::string, std::string>& variation_params, |
| bool use_local_host_requests_for_tests, |
| bool use_smaller_responses_for_tests, |
| - bool add_default_platform_observations) |
| + bool add_default_platform_observations, |
| + const NetLogWithSource& net_log) |
| : algorithm_name_to_enum_({{"HttpRTTAndDownstreamThroughput", |
| EffectiveConnectionTypeAlgorithm:: |
| HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT}, |
| @@ -275,6 +282,7 @@ NetworkQualityEstimator::NetworkQualityEstimator( |
| variation_params)), |
| forced_effective_connection_type_( |
| nqe::internal::forced_effective_connection_type(variation_params)), |
| + net_log_(net_log), |
| weak_ptr_factory_(this) { |
| // None of the algorithms can have an empty name. |
| DCHECK(algorithm_name_to_enum_.end() == |
| @@ -722,6 +730,14 @@ void NetworkQualityEstimator::SetUseSmallResponsesForTesting( |
| void NetworkQualityEstimator::ReportEffectiveConnectionTypeForTesting( |
| EffectiveConnectionType effective_connection_type) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| + |
| + nqe::internal::AddEffectiveConnectionTypeChangedEventToNetLog( |
| + net_log_, typical_network_quality_[effective_connection_type].http_rtt(), |
| + typical_network_quality_[effective_connection_type].transport_rtt(), |
| + typical_network_quality_[effective_connection_type] |
| + .downstream_throughput_kbps(), |
| + effective_connection_type); |
| + |
| for (auto& observer : effective_connection_type_observer_list_) |
| observer.OnEffectiveConnectionTypeChanged(effective_connection_type); |
| @@ -1551,6 +1567,11 @@ void NetworkQualityEstimator:: |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| DCHECK_NE(EFFECTIVE_CONNECTION_TYPE_LAST, effective_connection_type_); |
| + nqe::internal::AddEffectiveConnectionTypeChangedEventToNetLog( |
| + net_log_, network_quality_.http_rtt(), network_quality_.transport_rtt(), |
| + network_quality_.downstream_throughput_kbps(), |
| + effective_connection_type_); |
| + |
| // TODO(tbansal): Add hysteresis in the notification. |
| for (auto& observer : effective_connection_type_observer_list_) |
| observer.OnEffectiveConnectionTypeChanged(effective_connection_type_); |