Chromium Code Reviews| 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_BASE_NETWORK_QUALITY_ESTIMATOR_H_ | 5 #ifndef NET_BASE_NETWORK_QUALITY_ESTIMATOR_H_ |
| 6 #define NET_BASE_NETWORK_QUALITY_ESTIMATOR_H_ | 6 #define NET_BASE_NETWORK_QUALITY_ESTIMATOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <tuple> | 14 #include <tuple> |
| 15 | 15 |
| 16 #include "base/compiler_specific.h" | |
| 16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/observer_list.h" | 21 #include "base/observer_list.h" |
| 21 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
| 22 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 23 #include "net/base/external_estimate_provider.h" | 24 #include "net/base/external_estimate_provider.h" |
| 24 #include "net/base/net_export.h" | 25 #include "net/base/net_export.h" |
| 25 #include "net/base/network_change_notifier.h" | 26 #include "net/base/network_change_notifier.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 // by the platform. For example, typical RTT and throughput values are used | 63 // by the platform. For example, typical RTT and throughput values are used |
| 63 // for a given type of network connection. | 64 // for a given type of network connection. |
| 64 DEFAULT_FROM_PLATFORM, | 65 DEFAULT_FROM_PLATFORM, |
| 65 // The observation came from a Chromium-external source. | 66 // The observation came from a Chromium-external source. |
| 66 EXTERNAL_ESTIMATE | 67 EXTERNAL_ESTIMATE |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 // Observes measurements of round trip time. | 70 // Observes measurements of round trip time. |
| 70 class NET_EXPORT_PRIVATE RTTObserver { | 71 class NET_EXPORT_PRIVATE RTTObserver { |
| 71 public: | 72 public: |
| 72 // Will be called when a new RTT observation is available. The round trip | 73 // OnRTTObservation will be called when a new RTT observation is available. |
| 73 // time is specified in milliseconds. The time when the observation was | 74 // The round trip time is specified in milliseconds. The time when the |
| 74 // taken and the source of the observation are provided. | 75 // observation was taken and the source of the observation are provided. |
| 75 virtual void OnRTTObservation(int32_t rtt_ms, | 76 virtual void OnRTTObservation(int32_t rtt_ms, |
| 76 const base::TimeTicks& timestamp, | 77 const base::TimeTicks& timestamp, |
| 77 ObservationSource source) = 0; | 78 ObservationSource source) = 0; |
| 78 | 79 |
| 79 protected: | 80 protected: |
| 80 RTTObserver() {} | 81 RTTObserver() {} |
| 81 virtual ~RTTObserver() {} | 82 virtual ~RTTObserver() {} |
| 82 | 83 |
| 83 private: | 84 private: |
| 84 DISALLOW_COPY_AND_ASSIGN(RTTObserver); | 85 DISALLOW_COPY_AND_ASSIGN(RTTObserver); |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 // Observes measurements of throughput. | 88 // Observes measurements of throughput. |
| 88 class NET_EXPORT_PRIVATE ThroughputObserver { | 89 class NET_EXPORT_PRIVATE ThroughputObserver { |
| 89 public: | 90 public: |
| 90 // Will be called when a new throughput observation is available. | 91 // Will be called when a new throughput observation is available. |
| 91 // Throughput is specified in kilobits per second. | 92 // Throughput is specified in kilobits per second. |
| 92 virtual void OnThroughputObservation(int32_t throughput_kbps, | 93 virtual void OnThroughputObservation(int32_t throughput_kbps, |
| 93 const base::TimeTicks& timestamp, | 94 const base::TimeTicks& timestamp, |
| 94 ObservationSource source) = 0; | 95 ObservationSource source) = 0; |
| 95 | 96 |
| 96 protected: | 97 protected: |
| 97 ThroughputObserver() {} | 98 ThroughputObserver() {} |
| 98 virtual ~ThroughputObserver() {} | 99 virtual ~ThroughputObserver() {} |
| 99 | 100 |
| 100 private: | 101 private: |
| 101 DISALLOW_COPY_AND_ASSIGN(ThroughputObserver); | 102 DISALLOW_COPY_AND_ASSIGN(ThroughputObserver); |
| 102 }; | 103 }; |
| 103 | 104 |
| 105 // Observes measurements of packet counts. | |
| 106 class NET_EXPORT_PRIVATE PacketCountObserver { | |
| 107 public: | |
| 108 // OnIncrementalPacketCountObservation will be called when incremental | |
| 109 // packet counts are available. |packets_missing| is the number of packets | |
| 110 // currently missing, but they may be received later and will be counted | |
|
Ryan Hamilton
2016/03/10 00:29:53
s/currently missing/newly missing/
tbansal1
2016/03/10 03:37:21
Done.
| |
| 111 // as out of order. |packets_received_in_order| is the number of packets | |
| 112 // received in order. |packets_received_out_of_order| is the number of | |
| 113 // packets received out of order. | |
| 114 | |
| 115 // An example: | |
| 116 // Last observation after packet #1. Packets #5 and #6 are received: | |
| 117 // missing = 3, in_order = 2, out_of_order = 0. | |
| 118 | |
| 119 // Last observation after packet #6. Packet #3 received: | |
| 120 // missing = 0, in_order = 0, out_of_order = 1. | |
| 121 virtual void OnIncrementalPacketCountObservation( | |
| 122 size_t packets_missing, | |
| 123 size_t packets_received_in_order, | |
| 124 size_t packets_received_out_of_order, | |
| 125 const base::TimeTicks& timestamp, | |
| 126 ObservationSource source) = 0; | |
| 127 | |
| 128 protected: | |
| 129 PacketCountObserver() {} | |
| 130 virtual ~PacketCountObserver() {} | |
| 131 | |
| 132 private: | |
| 133 DISALLOW_COPY_AND_ASSIGN(PacketCountObserver); | |
| 134 }; | |
| 135 | |
| 104 // Creates a new NetworkQualityEstimator. | 136 // Creates a new NetworkQualityEstimator. |
| 105 // |variation_params| is the map containing all field trial parameters | 137 // |variation_params| is the map containing all field trial parameters |
| 106 // related to NetworkQualityEstimator field trial. | 138 // related to NetworkQualityEstimator field trial. |
| 107 // |external_estimates_provider| may be NULL. | 139 // |external_estimates_provider| may be NULL. |
| 108 NetworkQualityEstimator( | 140 NetworkQualityEstimator( |
| 109 scoped_ptr<ExternalEstimateProvider> external_estimates_provider, | 141 scoped_ptr<ExternalEstimateProvider> external_estimates_provider, |
| 110 const std::map<std::string, std::string>& variation_params); | 142 const std::map<std::string, std::string>& variation_params); |
| 111 | 143 |
| 112 // Construct a NetworkQualityEstimator instance allowing for test | 144 // Construct a NetworkQualityEstimator instance allowing for test |
| 113 // configuration. Registers for network type change notifications so estimates | 145 // configuration. Registers for network type change notifications so estimates |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 124 // estimation. | 156 // estimation. |
| 125 NetworkQualityEstimator( | 157 NetworkQualityEstimator( |
| 126 scoped_ptr<ExternalEstimateProvider> external_estimates_provider, | 158 scoped_ptr<ExternalEstimateProvider> external_estimates_provider, |
| 127 const std::map<std::string, std::string>& variation_params, | 159 const std::map<std::string, std::string>& variation_params, |
| 128 bool allow_local_host_requests_for_tests, | 160 bool allow_local_host_requests_for_tests, |
| 129 bool allow_smaller_responses_for_tests); | 161 bool allow_smaller_responses_for_tests); |
| 130 | 162 |
| 131 ~NetworkQualityEstimator() override; | 163 ~NetworkQualityEstimator() override; |
| 132 | 164 |
| 133 // Returns true if RTT is available and sets |rtt| to estimated RTT. | 165 // Returns true if RTT is available and sets |rtt| to estimated RTT. |
| 134 // Virtualized for testing. |rtt| should not be null. | 166 // Virtualized for testing. |rtt| must not be null. |
| 135 virtual bool GetRTTEstimate(base::TimeDelta* rtt) const; | 167 virtual bool GetRTTEstimate(base::TimeDelta* rtt) const WARN_UNUSED_RESULT; |
| 136 | 168 |
| 137 // Returns true if downlink throughput is available and sets |kbps| to | 169 // Returns true if downlink throughput is available and sets |kbps| to |
| 138 // estimated downlink throughput (in kilobits per second). | 170 // estimated downlink throughput (in kilobits per second). |
| 139 // Virtualized for testing. |kbps| should not be null. | 171 // Virtualized for testing. |kbps| must not be null. |
| 140 virtual bool GetDownlinkThroughputKbpsEstimate(int32_t* kbps) const; | 172 virtual bool GetDownlinkThroughputKbpsEstimate(int32_t* kbps) const |
| 173 WARN_UNUSED_RESULT; | |
| 141 | 174 |
| 142 // Notifies NetworkQualityEstimator that the response header of |request| has | 175 // Notifies NetworkQualityEstimator that the response header of |request| has |
| 143 // been received. | 176 // been received. |
| 144 void NotifyHeadersReceived(const URLRequest& request); | 177 void NotifyHeadersReceived(const URLRequest& request); |
| 145 | 178 |
| 146 // Notifies NetworkQualityEstimator that the response body of |request| has | 179 // Notifies NetworkQualityEstimator that the response body of |request| has |
| 147 // been received. | 180 // been received. |
| 148 void NotifyRequestCompleted(const URLRequest& request); | 181 void NotifyRequestCompleted(const URLRequest& request); |
| 149 | 182 |
| 150 // Returns true if median RTT is available and sets |rtt| to the median of | 183 // Returns true if median RTT is available and sets |rtt| to the median of |
| 151 // RTT observations since |begin_timestamp|. | 184 // RTT observations since |begin_timestamp|. |
| 152 // Virtualized for testing. |rtt| should not be null. | 185 // Virtualized for testing. |rtt| must not be null. |
| 153 virtual bool GetRecentMedianRTT(const base::TimeTicks& begin_timestamp, | 186 virtual bool GetRecentMedianRTT(const base::TimeTicks& begin_timestamp, |
| 154 base::TimeDelta* rtt) const; | 187 base::TimeDelta* rtt) const |
| 188 WARN_UNUSED_RESULT; | |
| 155 | 189 |
| 156 // Returns true if median downstream throughput is available and sets |kbps| | 190 // Returns true if median downstream throughput is available and sets |kbps| |
| 157 // to the median of downstream throughput (in kilobits per second) | 191 // to the median of downstream throughput (in kilobits per second) |
| 158 // observations since |begin_timestamp|. Virtualized for testing. |kbps| | 192 // observations since |begin_timestamp|. Virtualized for testing. |kbps| |
| 159 // should not be null. | 193 // must not be null. |
| 160 virtual bool GetRecentMedianDownlinkThroughputKbps( | 194 virtual bool GetRecentMedianDownlinkThroughputKbps( |
| 161 const base::TimeTicks& begin_timestamp, | 195 const base::TimeTicks& begin_timestamp, |
| 162 int32_t* kbps) const; | 196 int32_t* kbps) const WARN_UNUSED_RESULT; |
| 163 | 197 |
| 164 // SocketPerformanceWatcherFactory implementation: | 198 // SocketPerformanceWatcherFactory implementation: |
| 165 scoped_ptr<SocketPerformanceWatcher> CreateSocketPerformanceWatcher( | 199 scoped_ptr<SocketPerformanceWatcher> CreateSocketPerformanceWatcher( |
| 166 const Protocol protocol) override; | 200 const Protocol protocol) override; |
| 167 void OnUpdatedRTTAvailable(const Protocol protocol, | 201 void OnUpdatedRTTAvailable(const Protocol protocol, |
| 168 const base::TimeDelta& rtt) override; | 202 const base::TimeDelta& rtt) override; |
| 203 void OnIncrementalPacketCountAvailable( | |
| 204 Protocol protocol, | |
| 205 size_t packets_missing, | |
| 206 size_t packets_received_in_order, | |
| 207 size_t packets_received_out_of_order) override; | |
| 169 | 208 |
| 170 // Adds |rtt_observer| to the list of round trip time observers. Must be | 209 // Adds |rtt_observer| to the list of round trip time observers. Must be |
| 171 // called on the IO thread. | 210 // called on the IO thread. |
| 172 void AddRTTObserver(RTTObserver* rtt_observer); | 211 void AddRTTObserver(RTTObserver* rtt_observer); |
| 173 | 212 |
| 174 // Removes |rtt_observer| from the list of round trip time observers if it | 213 // Removes |rtt_observer| from the list of round trip time observers if it |
| 175 // is on the list of observers. Must be called on the IO thread. | 214 // is on the list of observers. Must be called on the IO thread. |
| 176 void RemoveRTTObserver(RTTObserver* rtt_observer); | 215 void RemoveRTTObserver(RTTObserver* rtt_observer); |
| 177 | 216 |
| 178 // Adds |throughput_observer| to the list of throughput observers. Must be | 217 // Adds |throughput_observer| to the list of throughput observers. Must be |
| 179 // called on the IO thread. | 218 // called on the IO thread. |
| 180 void AddThroughputObserver(ThroughputObserver* throughput_observer); | 219 void AddThroughputObserver(ThroughputObserver* throughput_observer); |
| 181 | 220 |
| 182 // Removes |throughput_observer| from the list of throughput observers if it | 221 // Removes |throughput_observer| from the list of throughput observers if it |
| 183 // is on the list of observers. Must be called on the IO thread. | 222 // is on the list of observers. Must be called on the IO thread. |
| 184 void RemoveThroughputObserver(ThroughputObserver* throughput_observer); | 223 void RemoveThroughputObserver(ThroughputObserver* throughput_observer); |
| 185 | 224 |
| 225 // Adds |packet_count_observer| to the list of packet count observers. Must be | |
| 226 // called on the IO thread. | |
| 227 void AddPacketCountObserver(PacketCountObserver* packet_count_observer); | |
| 228 | |
| 229 // Removes |packet_count_observer| from the list of packet count observers if | |
| 230 // it is on the list of observers. Must be called on the IO thread. | |
| 231 void RemovePacketCountObserver(PacketCountObserver* packet_count_observer); | |
| 232 | |
| 186 protected: | 233 protected: |
| 187 // NetworkID is used to uniquely identify a network. | 234 // NetworkID is used to uniquely identify a network. |
| 188 // For the purpose of network quality estimation and caching, a network is | 235 // For the purpose of network quality estimation and caching, a network is |
| 189 // uniquely identified by a combination of |type| and | 236 // uniquely identified by a combination of |type| and |
| 190 // |id|. This approach is unable to distinguish networks with | 237 // |id|. This approach is unable to distinguish networks with |
| 191 // same name (e.g., different Wi-Fi networks with same SSID). | 238 // same name (e.g., different Wi-Fi networks with same SSID). |
| 192 // This is a protected member to expose it to tests. | 239 // This is a protected member to expose it to tests. |
| 193 struct NET_EXPORT_PRIVATE NetworkID { | 240 struct NET_EXPORT_PRIVATE NetworkID { |
| 194 NetworkID(NetworkChangeNotifier::ConnectionType type, const std::string& id) | 241 NetworkID(NetworkChangeNotifier::ConnectionType type, const std::string& id) |
| 195 : type(type), id(id) {} | 242 : type(type), id(id) {} |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 } | 429 } |
| 383 | 430 |
| 384 // Returns the number of observations in this buffer. | 431 // Returns the number of observations in this buffer. |
| 385 size_t Size() const { return observations_.size(); } | 432 size_t Size() const { return observations_.size(); } |
| 386 | 433 |
| 387 // Clears the observations stored in this buffer. | 434 // Clears the observations stored in this buffer. |
| 388 void Clear() { observations_.clear(); } | 435 void Clear() { observations_.clear(); } |
| 389 | 436 |
| 390 // Returns true iff the |percentile| value of the observations in this | 437 // Returns true iff the |percentile| value of the observations in this |
| 391 // buffer is available. Sets |result| to the computed |percentile| | 438 // buffer is available. Sets |result| to the computed |percentile| |
| 392 // value among all observations since |begin_timestamp|. If the value is | 439 // value among all observations since |begin_timestamp| (inclusive). If the |
| 393 // unavailable, false is returned and |result| is not modified. Percentile | 440 // value is unavailable, false is returned and |result| is not modified. |
| 394 // value is unavailable if all the values in observation buffer are older | 441 // Percentile value is unavailable if all the values in observation buffer |
| 395 // than |begin_timestamp|. | 442 // are older than |begin_timestamp|. |result| must not be null. |
| 396 // |result| must not be null. | |
| 397 bool GetPercentile(const base::TimeTicks& begin_timestamp, | 443 bool GetPercentile(const base::TimeTicks& begin_timestamp, |
| 398 ValueType* result, | 444 ValueType* result, |
| 399 int percentile) const; | 445 int percentile) const; |
| 400 | 446 |
| 401 private: | 447 private: |
| 402 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); | 448 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); |
| 403 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 449 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
| 404 ObtainOperatingParams); | 450 ObtainOperatingParams); |
| 405 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); | 451 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); |
| 406 | 452 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 void AddDefaultEstimates(); | 543 void AddDefaultEstimates(); |
| 498 | 544 |
| 499 // Returns an estimate of network quality at the specified |percentile|. | 545 // Returns an estimate of network quality at the specified |percentile|. |
| 500 // Only the observations later than |begin_timestamp| are taken into account. | 546 // Only the observations later than |begin_timestamp| are taken into account. |
| 501 // |percentile| must be between 0 and 100 (both inclusive) with higher | 547 // |percentile| must be between 0 and 100 (both inclusive) with higher |
| 502 // percentiles indicating less performant networks. For example, if | 548 // percentiles indicating less performant networks. For example, if |
| 503 // |percentile| is 90, then the network is expected to be faster than the | 549 // |percentile| is 90, then the network is expected to be faster than the |
| 504 // returned estimate with 0.9 probability. Similarly, network is expected to | 550 // returned estimate with 0.9 probability. Similarly, network is expected to |
| 505 // be slower than the returned estimate with 0.1 probability. | 551 // be slower than the returned estimate with 0.1 probability. |
| 506 base::TimeDelta GetRTTEstimateInternal(const base::TimeTicks& begin_timestamp, | 552 base::TimeDelta GetRTTEstimateInternal(const base::TimeTicks& begin_timestamp, |
| 507 int percentile) const; | 553 int percentile) const |
| 554 WARN_UNUSED_RESULT; | |
| 508 int32_t GetDownlinkThroughputKbpsEstimateInternal( | 555 int32_t GetDownlinkThroughputKbpsEstimateInternal( |
| 509 const base::TimeTicks& begin_timestamp, | 556 const base::TimeTicks& begin_timestamp, |
| 510 int percentile) const; | 557 int percentile) const WARN_UNUSED_RESULT; |
| 511 | 558 |
| 512 // Returns the current network ID checking by calling the platform APIs. | 559 // Returns the current network ID checking by calling the platform APIs. |
| 513 // Virtualized for testing. | 560 // Virtualized for testing. |
| 514 virtual NetworkID GetCurrentNetworkID() const; | 561 virtual NetworkID GetCurrentNetworkID() const; |
| 515 | 562 |
| 516 // Writes the estimated quality of the current network to the cache. | 563 // Writes the estimated quality of the current network to the cache. |
| 517 void CacheNetworkQualityEstimate(); | 564 void CacheNetworkQualityEstimate(); |
| 518 | 565 |
| 519 void NotifyObserversOfRTT(const RttObservation& observation); | 566 void NotifyObserversOfRTT(const RttObservation& observation); |
| 520 | 567 |
| 521 void NotifyObserversOfThroughput(const ThroughputObservation& observation); | 568 void NotifyObserversOfThroughput(const ThroughputObservation& observation); |
| 522 | 569 |
| 570 void NotifyObserversOfIncrementalPacketCount( | |
| 571 size_t packets_missing, | |
| 572 size_t packets_received_in_order, | |
| 573 size_t packets_received_out_of_order, | |
| 574 const base::TimeTicks& timestamp, | |
| 575 ObservationSource source); | |
| 576 | |
| 523 // Records the UMA related to RTT. | 577 // Records the UMA related to RTT. |
| 524 void RecordRTTUMA(int32_t estimated_value_msec, | 578 void RecordRTTUMA(int32_t estimated_value_msec, |
| 525 int32_t actual_value_msec) const; | 579 int32_t actual_value_msec) const; |
| 526 | 580 |
| 527 // Returns true only if |request| can be used for network quality estimation. | 581 // Returns true only if |request| can be used for network quality estimation. |
| 528 // Only the requests that go over network are considered to provide useful | 582 // Only the requests that go over network are considered to provide useful |
| 529 // observations. | 583 // observations. |
| 530 bool RequestProvidesUsefulObservations(const URLRequest& request) const; | 584 bool RequestProvidesUsefulObservations(const URLRequest& request) const; |
| 531 | 585 |
| 532 // Values of external estimate provider status. This enum must remain | 586 // Values of external estimate provider status. This enum must remain |
| 533 // synchronized with the enum of the same name in | 587 // synchronized with the enum of the same name in |
| 534 // metrics/histograms/histograms.xml. | 588 // metrics/histograms/histograms.xml. |
| 535 enum NQEExternalEstimateProviderStatus { | 589 enum NQEExternalEstimateProviderStatus { |
| 536 EXTERNAL_ESTIMATE_PROVIDER_STATUS_NOT_AVAILABLE, | 590 EXTERNAL_ESTIMATE_PROVIDER_STATUS_NOT_AVAILABLE, |
| 537 EXTERNAL_ESTIMATE_PROVIDER_STATUS_AVAILABLE, | 591 EXTERNAL_ESTIMATE_PROVIDER_STATUS_AVAILABLE, |
| 538 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERIED, | 592 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERIED, |
| 539 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERY_SUCCESSFUL, | 593 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERY_SUCCESSFUL, |
| 540 EXTERNAL_ESTIMATE_PROVIDER_STATUS_CALLBACK, | 594 EXTERNAL_ESTIMATE_PROVIDER_STATUS_CALLBACK, |
| 541 EXTERNAL_ESTIMATE_PROVIDER_STATUS_BOUNDARY | 595 EXTERNAL_ESTIMATE_PROVIDER_STATUS_BOUNDARY |
| 542 }; | 596 }; |
| 543 | 597 |
| 544 // Records the metrics related to external estimate provider. | 598 // Records the metrics related to external estimate provider. |
| 545 void RecordExternalEstimateProviderMetrics( | 599 void RecordExternalEstimateProviderMetrics( |
| 546 NQEExternalEstimateProviderStatus status) const; | 600 NQEExternalEstimateProviderStatus status) const; |
| 547 | 601 |
| 602 // Gets the ObservationSource that corresponds to the given |protocol|, | |
| 603 // updates |observation_source| and returns true. If the corresponding | |
| 604 // ObservationSource is unknown, false is returned and |observation_source| is | |
| 605 // not modified. | |
| 606 bool GetObservationSourceForProtocol( | |
| 607 Protocol protocol, | |
| 608 ObservationSource* observation_source) const; | |
| 609 | |
| 548 // Determines if the requests to local host can be used in estimating the | 610 // Determines if the requests to local host can be used in estimating the |
| 549 // network quality. Set to true only for tests. | 611 // network quality. Set to true only for tests. |
| 550 const bool allow_localhost_requests_; | 612 const bool allow_localhost_requests_; |
| 551 | 613 |
| 552 // Determines if the responses smaller than |kMinTransferSizeInBytes| | 614 // Determines if the responses smaller than |kMinTransferSizeInBytes| |
| 553 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the | 615 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the |
| 554 // network quality. Set to true only for tests. | 616 // network quality. Set to true only for tests. |
| 555 const bool allow_small_responses_; | 617 const bool allow_small_responses_; |
| 556 | 618 |
| 557 // Time when last connection change was observed. | 619 // Time when last connection change was observed. |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 584 NetworkQuality | 646 NetworkQuality |
| 585 default_observations_[NetworkChangeNotifier::CONNECTION_LAST + 1]; | 647 default_observations_[NetworkChangeNotifier::CONNECTION_LAST + 1]; |
| 586 | 648 |
| 587 // Estimated network quality. Updated on mainframe requests. | 649 // Estimated network quality. Updated on mainframe requests. |
| 588 NetworkQuality estimated_median_network_quality_; | 650 NetworkQuality estimated_median_network_quality_; |
| 589 | 651 |
| 590 // ExternalEstimateProvider that provides network quality using operating | 652 // ExternalEstimateProvider that provides network quality using operating |
| 591 // system APIs. May be NULL. | 653 // system APIs. May be NULL. |
| 592 const scoped_ptr<ExternalEstimateProvider> external_estimate_provider_; | 654 const scoped_ptr<ExternalEstimateProvider> external_estimate_provider_; |
| 593 | 655 |
| 594 // Observer lists for round trip times and throughput measurements. | 656 // Observer lists for round trip times, throughput and packet count |
| 657 // measurements. | |
| 595 base::ObserverList<RTTObserver> rtt_observer_list_; | 658 base::ObserverList<RTTObserver> rtt_observer_list_; |
| 596 base::ObserverList<ThroughputObserver> throughput_observer_list_; | 659 base::ObserverList<ThroughputObserver> throughput_observer_list_; |
| 660 base::ObserverList<PacketCountObserver> packet_count_observer_list_; | |
| 597 | 661 |
| 598 base::ThreadChecker thread_checker_; | 662 base::ThreadChecker thread_checker_; |
| 599 | 663 |
| 600 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 664 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
| 601 }; | 665 }; |
| 602 | 666 |
| 603 } // namespace net | 667 } // namespace net |
| 604 | 668 |
| 605 #endif // NET_BASE_NETWORK_QUALITY_ESTIMATOR_H_ | 669 #endif // NET_BASE_NETWORK_QUALITY_ESTIMATOR_H_ |
| OLD | NEW |