| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 NotifyObserversOfEffectiveConnectionTypeChanged() { | 1251 NotifyObserversOfEffectiveConnectionTypeChanged() { |
| 1240 DCHECK(thread_checker_.CalledOnValidThread()); | 1252 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1241 | 1253 |
| 1242 // TODO(tbansal): Add hysteresis in the notification. | 1254 // TODO(tbansal): Add hysteresis in the notification. |
| 1243 FOR_EACH_OBSERVER( | 1255 FOR_EACH_OBSERVER( |
| 1244 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, | 1256 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, |
| 1245 OnEffectiveConnectionTypeChanged(effective_connection_type_)); | 1257 OnEffectiveConnectionTypeChanged(effective_connection_type_)); |
| 1246 } | 1258 } |
| 1247 | 1259 |
| 1248 } // namespace net | 1260 } // namespace net |
| OLD | NEW |