| 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 10 matching lines...) Expand all Loading... |
| 21 #include "base/threading/thread_checker.h" | 21 #include "base/threading/thread_checker.h" |
| 22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 23 #include "net/base/net_export.h" | 23 #include "net/base/net_export.h" |
| 24 #include "net/base/network_change_notifier.h" | 24 #include "net/base/network_change_notifier.h" |
| 25 #include "net/nqe/cached_network_quality.h" | 25 #include "net/nqe/cached_network_quality.h" |
| 26 #include "net/nqe/effective_connection_type.h" | 26 #include "net/nqe/effective_connection_type.h" |
| 27 #include "net/nqe/event_creator.h" | 27 #include "net/nqe/event_creator.h" |
| 28 #include "net/nqe/external_estimate_provider.h" | 28 #include "net/nqe/external_estimate_provider.h" |
| 29 #include "net/nqe/network_id.h" | 29 #include "net/nqe/network_id.h" |
| 30 #include "net/nqe/network_quality.h" | 30 #include "net/nqe/network_quality.h" |
| 31 #include "net/nqe/network_quality_estimator_params.h" |
| 31 #include "net/nqe/network_quality_observation.h" | 32 #include "net/nqe/network_quality_observation.h" |
| 32 #include "net/nqe/network_quality_observation_source.h" | 33 #include "net/nqe/network_quality_observation_source.h" |
| 33 #include "net/nqe/network_quality_store.h" | 34 #include "net/nqe/network_quality_store.h" |
| 34 #include "net/nqe/observation_buffer.h" | 35 #include "net/nqe/observation_buffer.h" |
| 35 #include "net/socket/socket_performance_watcher_factory.h" | 36 #include "net/socket/socket_performance_watcher_factory.h" |
| 36 | 37 |
| 37 namespace base { | 38 namespace base { |
| 38 class TickClock; | 39 class TickClock; |
| 39 } // namespace base | 40 } // namespace base |
| 40 | 41 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 530 |
| 530 // Records a downstream throughput observation to the observation buffer if | 531 // Records a downstream throughput observation to the observation buffer if |
| 531 // a valid observation is available. |downstream_kbps| is the downstream | 532 // a valid observation is available. |downstream_kbps| is the downstream |
| 532 // throughput in kilobits per second. | 533 // throughput in kilobits per second. |
| 533 void OnNewThroughputObservationAvailable(int32_t downstream_kbps); | 534 void OnNewThroughputObservationAvailable(int32_t downstream_kbps); |
| 534 | 535 |
| 535 // Obtains the model parameters for different effective connection types from | 536 // Obtains the model parameters for different effective connection types from |
| 536 // the field trial parameters. For each effective connection type, a model | 537 // the field trial parameters. For each effective connection type, a model |
| 537 // (currently composed of a RTT threshold and a downlink throughput threshold) | 538 // (currently composed of a RTT threshold and a downlink throughput threshold) |
| 538 // is provided by the field trial. | 539 // is provided by the field trial. |
| 539 void ObtainOperatingParams( | 540 void ObtainOperatingParams(); |
| 540 const std::map<std::string, std::string>& variation_params); | |
| 541 | 541 |
| 542 // Adds the default median RTT and downstream throughput estimate for the | 542 // Adds the default median RTT and downstream throughput estimate for the |
| 543 // current connection type to the observation buffer. | 543 // current connection type to the observation buffer. |
| 544 void AddDefaultEstimates(); | 544 void AddDefaultEstimates(); |
| 545 | 545 |
| 546 // Returns the current network ID checking by calling the platform APIs. | 546 // Returns the current network ID checking by calling the platform APIs. |
| 547 // Virtualized for testing. | 547 // Virtualized for testing. |
| 548 virtual nqe::internal::NetworkID GetCurrentNetworkID() const; | 548 virtual nqe::internal::NetworkID GetCurrentNetworkID() const; |
| 549 | 549 |
| 550 // Notifies RTT observers of |observation|. May also trigger recomputation | 550 // Notifies RTT observers of |observation|. May also trigger recomputation |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 | 643 |
| 644 // May update the network quality of the current network if |network_id| | 644 // May update the network quality of the current network if |network_id| |
| 645 // matches the ID of the current network. |cached_network_quality| is the | 645 // matches the ID of the current network. |cached_network_quality| is the |
| 646 // cached network quality of the network with id |network_id|. | 646 // cached network quality of the network with id |network_id|. |
| 647 void MaybeUpdateNetworkQualityFromCache( | 647 void MaybeUpdateNetworkQualityFromCache( |
| 648 const nqe::internal::NetworkID& network_id, | 648 const nqe::internal::NetworkID& network_id, |
| 649 const nqe::internal::CachedNetworkQuality& cached_network_quality); | 649 const nqe::internal::CachedNetworkQuality& cached_network_quality); |
| 650 | 650 |
| 651 const char* GetNameForStatistic(int i) const; | 651 const char* GetNameForStatistic(int i) const; |
| 652 | 652 |
| 653 // Params to configure the network quality estimator. |
| 654 const nqe::internal::NetworkQualityEstimatorParams params_; |
| 655 |
| 653 // Determines if the requests to local host can be used in estimating the | 656 // Determines if the requests to local host can be used in estimating the |
| 654 // network quality. Set to true only for tests. | 657 // network quality. Set to true only for tests. |
| 655 bool use_localhost_requests_; | 658 bool use_localhost_requests_; |
| 656 | 659 |
| 657 // Determines if the responses smaller than |kMinTransferSizeInBytes| | 660 // Determines if the responses smaller than |kMinTransferSizeInBytes| |
| 658 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the | 661 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the |
| 659 // network quality. Set to true only for tests. | 662 // network quality. Set to true only for tests. |
| 660 bool use_small_responses_; | 663 bool use_small_responses_; |
| 661 | 664 |
| 662 // When set to true, the device offline check is disabled when computing the | 665 // When set to true, the device offline check is disabled when computing the |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 disallowed_observation_sources_for_transport_; | 834 disallowed_observation_sources_for_transport_; |
| 832 | 835 |
| 833 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 836 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
| 834 | 837 |
| 835 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 838 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
| 836 }; | 839 }; |
| 837 | 840 |
| 838 } // namespace net | 841 } // namespace net |
| 839 | 842 |
| 840 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 843 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| OLD | NEW |