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

Unified Diff: net/nqe/network_quality_estimator.cc

Issue 2593243003: Add network quality change events to net log (Closed)
Patch Set: rebased Created 3 years, 11 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
« no previous file with comments | « net/nqe/network_quality_estimator.h ('k') | net/nqe/network_quality_estimator_test_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/network_quality_estimator.cc
diff --git a/net/nqe/network_quality_estimator.cc b/net/nqe/network_quality_estimator.cc
index daceb853d09f31e5d54337fba7475001eb46b0a5..4950bef439455a9290f23e0bc4498969909ec820 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"
@@ -208,29 +209,37 @@ 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::NETWORK_QUALITY_ESTIMATOR)) {}
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},
@@ -281,6 +290,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() ==
@@ -736,6 +746,14 @@ void NetworkQualityEstimator::DisableOfflineCheckForTesting(
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);
@@ -1569,6 +1587,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_);
« no previous file with comments | « net/nqe/network_quality_estimator.h ('k') | net/nqe/network_quality_estimator_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698