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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 throughput_observer_list_.RemoveObserver(throughput_observer); | 545 throughput_observer_list_.RemoveObserver(throughput_observer); |
546 } | 546 } |
547 | 547 |
548 SocketPerformanceWatcherFactory* | 548 SocketPerformanceWatcherFactory* |
549 NetworkQualityEstimator::GetSocketPerformanceWatcherFactory() { | 549 NetworkQualityEstimator::GetSocketPerformanceWatcherFactory() { |
550 DCHECK(thread_checker_.CalledOnValidThread()); | 550 DCHECK(thread_checker_.CalledOnValidThread()); |
551 | 551 |
552 return watcher_factory_.get(); | 552 return watcher_factory_.get(); |
553 } | 553 } |
554 | 554 |
| 555 void NetworkQualityEstimator::SetUseLocalHostRequestsForTesting( |
| 556 bool use_local_host_requests_for_tests) { |
| 557 DCHECK(thread_checker_.CalledOnValidThread()); |
| 558 use_localhost_requests_ = use_local_host_requests_for_tests; |
| 559 throughput_analyzer_->SetUseLocalHostRequestsForTesting( |
| 560 use_localhost_requests_); |
| 561 } |
| 562 |
| 563 void NetworkQualityEstimator::SetUseSmallResponsesForTesting( |
| 564 bool use_small_responses) { |
| 565 DCHECK(thread_checker_.CalledOnValidThread()); |
| 566 use_small_responses_ = use_small_responses; |
| 567 throughput_analyzer_->SetUseSmallResponsesForTesting(use_small_responses_); |
| 568 } |
| 569 |
555 void NetworkQualityEstimator::RecordHttpRTTUMA( | 570 void NetworkQualityEstimator::RecordHttpRTTUMA( |
556 int32_t estimated_value_msec, | 571 int32_t estimated_value_msec, |
557 int32_t actual_value_msec) const { | 572 int32_t actual_value_msec) const { |
558 DCHECK(thread_checker_.CalledOnValidThread()); | 573 DCHECK(thread_checker_.CalledOnValidThread()); |
559 | 574 |
560 // Record the difference between the actual and the estimated value. | 575 // Record the difference between the actual and the estimated value. |
561 if (estimated_value_msec >= actual_value_msec) { | 576 if (estimated_value_msec >= actual_value_msec) { |
562 base::HistogramBase* difference_rtt = | 577 base::HistogramBase* difference_rtt = |
563 GetHistogram("DifferenceRTTEstimatedAndActual.", | 578 GetHistogram("DifferenceRTTEstimatedAndActual.", |
564 current_network_id_.type, 10 * 1000); // 10 seconds | 579 current_network_id_.type, 10 * 1000); // 10 seconds |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 NotifyObserversOfEffectiveConnectionTypeChanged() { | 1205 NotifyObserversOfEffectiveConnectionTypeChanged() { |
1191 DCHECK(thread_checker_.CalledOnValidThread()); | 1206 DCHECK(thread_checker_.CalledOnValidThread()); |
1192 | 1207 |
1193 // TODO(tbansal): Add hysteresis in the notification. | 1208 // TODO(tbansal): Add hysteresis in the notification. |
1194 FOR_EACH_OBSERVER( | 1209 FOR_EACH_OBSERVER( |
1195 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, | 1210 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, |
1196 OnEffectiveConnectionTypeChanged(effective_connection_type_)); | 1211 OnEffectiveConnectionTypeChanged(effective_connection_type_)); |
1197 } | 1212 } |
1198 | 1213 |
1199 } // namespace net | 1214 } // namespace net |
OLD | NEW |