| 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 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 // and |downstream_throughput_kbps| are set to the expected HTTP RTT, | 373 // and |downstream_throughput_kbps| are set to the expected HTTP RTT, |
| 374 // transport RTT and downstream throughput (in kilobits per second) based on | 374 // transport RTT and downstream throughput (in kilobits per second) based on |
| 375 // observations taken since |start_time|. Virtualized for testing. | 375 // observations taken since |start_time|. Virtualized for testing. |
| 376 virtual EffectiveConnectionType | 376 virtual EffectiveConnectionType |
| 377 GetRecentEffectiveConnectionTypeAndNetworkQuality( | 377 GetRecentEffectiveConnectionTypeAndNetworkQuality( |
| 378 const base::TimeTicks& start_time, | 378 const base::TimeTicks& start_time, |
| 379 base::TimeDelta* http_rtt, | 379 base::TimeDelta* http_rtt, |
| 380 base::TimeDelta* transport_rtt, | 380 base::TimeDelta* transport_rtt, |
| 381 int32_t* downstream_throughput_kbps) const; | 381 int32_t* downstream_throughput_kbps) const; |
| 382 | 382 |
| 383 // Notifies |this| of a new transport layer RTT. Called by socket watchers. |
| 384 // Protected for testing. |
| 385 void OnUpdatedRTTAvailable(SocketPerformanceWatcherFactory::Protocol protocol, |
| 386 const base::TimeDelta& rtt); |
| 387 |
| 383 private: | 388 private: |
| 384 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 389 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
| 385 AdaptiveRecomputationEffectiveConnectionType); | 390 AdaptiveRecomputationEffectiveConnectionType); |
| 386 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); | 391 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); |
| 387 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); | 392 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); |
| 388 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 393 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
| 389 DefaultObservationsOverridden); | 394 DefaultObservationsOverridden); |
| 390 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 395 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
| 391 ObtainAlgorithmToUseFromParams); | 396 ObtainAlgorithmToUseFromParams); |
| 392 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); | 397 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 void RecordNetworkIDAvailability() const; | 465 void RecordNetworkIDAvailability() const; |
| 461 | 466 |
| 462 // Records UMA on main frame requests. | 467 // Records UMA on main frame requests. |
| 463 void RecordMetricsOnMainFrameRequest() const; | 468 void RecordMetricsOnMainFrameRequest() const; |
| 464 | 469 |
| 465 // Records a downstream throughput observation to the observation buffer if | 470 // Records a downstream throughput observation to the observation buffer if |
| 466 // a valid observation is available. |downstream_kbps| is the downstream | 471 // a valid observation is available. |downstream_kbps| is the downstream |
| 467 // throughput in kilobits per second. | 472 // throughput in kilobits per second. |
| 468 void OnNewThroughputObservationAvailable(int32_t downstream_kbps); | 473 void OnNewThroughputObservationAvailable(int32_t downstream_kbps); |
| 469 | 474 |
| 470 // Notifies |this| of a new transport layer RTT. | |
| 471 void OnUpdatedRTTAvailable(SocketPerformanceWatcherFactory::Protocol protocol, | |
| 472 const base::TimeDelta& rtt); | |
| 473 | |
| 474 // Obtains the model parameters for different effective connection types from | 475 // Obtains the model parameters for different effective connection types from |
| 475 // the field trial parameters. For each effective connection type, a model | 476 // the field trial parameters. For each effective connection type, a model |
| 476 // (currently composed of a RTT threshold and a downlink throughput threshold) | 477 // (currently composed of a RTT threshold and a downlink throughput threshold) |
| 477 // is provided by the field trial. | 478 // is provided by the field trial. |
| 478 void ObtainOperatingParams( | 479 void ObtainOperatingParams( |
| 479 const std::map<std::string, std::string>& variation_params); | 480 const std::map<std::string, std::string>& variation_params); |
| 480 | 481 |
| 481 // Adds the default median RTT and downstream throughput estimate for the | 482 // Adds the default median RTT and downstream throughput estimate for the |
| 482 // current connection type to the observation buffer. | 483 // current connection type to the observation buffer. |
| 483 void AddDefaultEstimates(); | 484 void AddDefaultEstimates(); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 nqe::internal::EventCreator event_creator_; | 773 nqe::internal::EventCreator event_creator_; |
| 773 | 774 |
| 774 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 775 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
| 775 | 776 |
| 776 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 777 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
| 777 }; | 778 }; |
| 778 | 779 |
| 779 } // namespace net | 780 } // namespace net |
| 780 | 781 |
| 781 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 782 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| OLD | NEW |