Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1122)

Side by Side Diff: net/nqe/network_quality_estimator.h

Issue 2045703003: Enable NQE when Cronet Engine is built (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mef comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // Adds |throughput_observer| to the list of throughput observers. Must be 249 // Adds |throughput_observer| to the list of throughput observers. Must be
250 // called on the IO thread. 250 // called on the IO thread.
251 void AddThroughputObserver(ThroughputObserver* throughput_observer); 251 void AddThroughputObserver(ThroughputObserver* throughput_observer);
252 252
253 // Removes |throughput_observer| from the list of throughput observers if it 253 // Removes |throughput_observer| from the list of throughput observers if it
254 // is on the list of observers. Must be called on the IO thread. 254 // is on the list of observers. Must be called on the IO thread.
255 void RemoveThroughputObserver(ThroughputObserver* throughput_observer); 255 void RemoveThroughputObserver(ThroughputObserver* throughput_observer);
256 256
257 SocketPerformanceWatcherFactory* GetSocketPerformanceWatcherFactory(); 257 SocketPerformanceWatcherFactory* GetSocketPerformanceWatcherFactory();
258 258
259 // |use_local_host_requests_for_tests| should only be true when testing
260 // against local HTTP server and allows the requests to local host to be
261 // used for network quality estimation.
262 void SetUseLocalHostRequestsForTesting(
263 bool use_local_host_requests_for_tests);
264
265 // |use_smaller_responses_for_tests| should only be true when testing.
266 // Allows the responses smaller than |kMinTransferSizeInBits| to be used for
267 // network quality estimation.
268 void SetUseSmallResponsesForTesting(bool use_small_responses);
269
259 protected: 270 protected:
260 // NetworkID is used to uniquely identify a network. 271 // NetworkID is used to uniquely identify a network.
261 // For the purpose of network quality estimation and caching, a network is 272 // For the purpose of network quality estimation and caching, a network is
262 // uniquely identified by a combination of |type| and 273 // uniquely identified by a combination of |type| and
263 // |id|. This approach is unable to distinguish networks with 274 // |id|. This approach is unable to distinguish networks with
264 // same name (e.g., different Wi-Fi networks with same SSID). 275 // same name (e.g., different Wi-Fi networks with same SSID).
265 // This is a protected member to expose it to tests. 276 // This is a protected member to expose it to tests.
266 struct NET_EXPORT_PRIVATE NetworkID { 277 struct NET_EXPORT_PRIVATE NetworkID {
267 NetworkID(NetworkChangeNotifier::ConnectionType type, const std::string& id) 278 NetworkID(NetworkChangeNotifier::ConnectionType type, const std::string& id)
268 : type(type), id(id) {} 279 : type(type), id(id) {}
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 EXTERNAL_ESTIMATE_PROVIDER_STATUS_DOWNLINK_BANDWIDTH_AVAILABLE, 494 EXTERNAL_ESTIMATE_PROVIDER_STATUS_DOWNLINK_BANDWIDTH_AVAILABLE,
484 EXTERNAL_ESTIMATE_PROVIDER_STATUS_BOUNDARY 495 EXTERNAL_ESTIMATE_PROVIDER_STATUS_BOUNDARY
485 }; 496 };
486 497
487 // Records the metrics related to external estimate provider. 498 // Records the metrics related to external estimate provider.
488 void RecordExternalEstimateProviderMetrics( 499 void RecordExternalEstimateProviderMetrics(
489 NQEExternalEstimateProviderStatus status) const; 500 NQEExternalEstimateProviderStatus status) const;
490 501
491 // Determines if the requests to local host can be used in estimating the 502 // Determines if the requests to local host can be used in estimating the
492 // network quality. Set to true only for tests. 503 // network quality. Set to true only for tests.
493 const bool use_localhost_requests_; 504 bool use_localhost_requests_;
494 505
495 // Determines if the responses smaller than |kMinTransferSizeInBytes| 506 // Determines if the responses smaller than |kMinTransferSizeInBytes|
496 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the 507 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the
497 // network quality. Set to true only for tests. 508 // network quality. Set to true only for tests.
498 const bool use_small_responses_; 509 bool use_small_responses_;
499 510
500 // The factor by which the weight of an observation reduces every second. 511 // The factor by which the weight of an observation reduces every second.
501 const double weight_multiplier_per_second_; 512 const double weight_multiplier_per_second_;
502 513
503 // Algorithm to use for computing effective connection type. The value is 514 // Algorithm to use for computing effective connection type. The value is
504 // obtained from field trial parameters. If the value from field trial 515 // obtained from field trial parameters. If the value from field trial
505 // parameters is unavailable, it is set to 516 // parameters is unavailable, it is set to
506 // kDefaultEffectiveConnectionTypeAlgorithm. 517 // kDefaultEffectiveConnectionTypeAlgorithm.
507 const EffectiveConnectionTypeAlgorithm effective_connection_type_algorithm_; 518 const EffectiveConnectionTypeAlgorithm effective_connection_type_algorithm_;
508 519
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 base::ThreadChecker thread_checker_; 604 base::ThreadChecker thread_checker_;
594 605
595 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 606 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
596 607
597 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 608 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
598 }; 609 };
599 610
600 } // namespace net 611 } // namespace net
601 612
602 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 613 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698