| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "net/nqe/network_quality_estimator.h" | 5 #include "net/nqe/network_quality_estimator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 transport_rtt_percentile->Add(transport_rtt.InMilliseconds()); | 769 transport_rtt_percentile->Add(transport_rtt.InMilliseconds()); |
| 770 } | 770 } |
| 771 | 771 |
| 772 int32_t kbps; | 772 int32_t kbps; |
| 773 if (GetDownlinkThroughputKbpsEstimate(&kbps)) { | 773 if (GetDownlinkThroughputKbpsEstimate(&kbps)) { |
| 774 // Add the 50th percentile value. | 774 // Add the 50th percentile value. |
| 775 base::HistogramBase* throughput_percentile = GetHistogram( | 775 base::HistogramBase* throughput_percentile = GetHistogram( |
| 776 "MainFrame.Kbps.Percentile50.", current_network_id_.type, 1000 * 1000); | 776 "MainFrame.Kbps.Percentile50.", current_network_id_.type, 1000 * 1000); |
| 777 throughput_percentile->Add(kbps); | 777 throughput_percentile->Add(kbps); |
| 778 } | 778 } |
| 779 |
| 780 const EffectiveConnectionType effective_connection_type = |
| 781 GetEffectiveConnectionType(); |
| 782 base::HistogramBase* effective_connection_type_histogram = |
| 783 base::Histogram::FactoryGet( |
| 784 std::string("NQE.MainFrame.EffectiveConnectionType.") + |
| 785 GetNameForConnectionType(current_network_id_.type), |
| 786 0, EFFECTIVE_CONNECTION_TYPE_LAST, |
| 787 EFFECTIVE_CONNECTION_TYPE_LAST /* Number of buckets */, |
| 788 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 789 |
| 790 effective_connection_type_histogram->Add(effective_connection_type); |
| 779 } | 791 } |
| 780 | 792 |
| 781 NetworkQualityEstimator::EffectiveConnectionType | 793 NetworkQualityEstimator::EffectiveConnectionType |
| 782 NetworkQualityEstimator::GetEffectiveConnectionType() const { | 794 NetworkQualityEstimator::GetEffectiveConnectionType() const { |
| 783 DCHECK(thread_checker_.CalledOnValidThread()); | 795 DCHECK(thread_checker_.CalledOnValidThread()); |
| 784 return GetRecentEffectiveConnectionType(base::TimeTicks()); | 796 return GetRecentEffectiveConnectionType(base::TimeTicks()); |
| 785 } | 797 } |
| 786 | 798 |
| 787 NetworkQualityEstimator::EffectiveConnectionType | 799 NetworkQualityEstimator::EffectiveConnectionType |
| 788 NetworkQualityEstimator::GetRecentEffectiveConnectionType( | 800 NetworkQualityEstimator::GetRecentEffectiveConnectionType( |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 NotifyObserversOfEffectiveConnectionTypeChanged() { | 1274 NotifyObserversOfEffectiveConnectionTypeChanged() { |
| 1263 DCHECK(thread_checker_.CalledOnValidThread()); | 1275 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1264 | 1276 |
| 1265 // TODO(tbansal): Add hysteresis in the notification. | 1277 // TODO(tbansal): Add hysteresis in the notification. |
| 1266 FOR_EACH_OBSERVER( | 1278 FOR_EACH_OBSERVER( |
| 1267 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, | 1279 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, |
| 1268 OnEffectiveConnectionTypeChanged(effective_connection_type_)); | 1280 OnEffectiveConnectionTypeChanged(effective_connection_type_)); |
| 1269 } | 1281 } |
| 1270 | 1282 |
| 1271 } // namespace net | 1283 } // namespace net |
| OLD | NEW |