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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Notifies NetworkQualityEstimator that the response header of |request| has | 173 // Notifies NetworkQualityEstimator that the response header of |request| has |
174 // been received. | 174 // been received. |
175 void NotifyHeadersReceived(const URLRequest& request); | 175 void NotifyHeadersReceived(const URLRequest& request); |
176 | 176 |
177 // Notifies NetworkQualityEstimator that the headers of |request| are about to | 177 // Notifies NetworkQualityEstimator that the headers of |request| are about to |
178 // be sent. | 178 // be sent. |
179 void NotifyStartTransaction(const URLRequest& request); | 179 void NotifyStartTransaction(const URLRequest& request); |
180 | 180 |
181 // Notifies NetworkQualityEstimator that the response body of |request| has | 181 // Notifies NetworkQualityEstimator that the response body of |request| has |
182 // been received. | 182 // been received. |
183 void NotifyRequestCompleted(const URLRequest& request); | 183 void NotifyRequestCompleted(const URLRequest& request, int net_error); |
184 | 184 |
185 // Notifies NetworkQualityEstimator that |request| will be destroyed. | 185 // Notifies NetworkQualityEstimator that |request| will be destroyed. |
186 void NotifyURLRequestDestroyed(const URLRequest& request); | 186 void NotifyURLRequestDestroyed(const URLRequest& request); |
187 | 187 |
188 // Adds |rtt_observer| to the list of round trip time observers. Must be | 188 // Adds |rtt_observer| to the list of round trip time observers. Must be |
189 // called on the IO thread. | 189 // called on the IO thread. |
190 void AddRTTObserver(RTTObserver* rtt_observer); | 190 void AddRTTObserver(RTTObserver* rtt_observer); |
191 | 191 |
192 // Removes |rtt_observer| from the list of round trip time observers if it | 192 // Removes |rtt_observer| from the list of round trip time observers if it |
193 // is on the list of observers. Must be called on the IO thread. | 193 // is on the list of observers. Must be called on the IO thread. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 // Records the metrics related to external estimate provider. | 472 // Records the metrics related to external estimate provider. |
473 void RecordExternalEstimateProviderMetrics( | 473 void RecordExternalEstimateProviderMetrics( |
474 NQEExternalEstimateProviderStatus status) const; | 474 NQEExternalEstimateProviderStatus status) const; |
475 | 475 |
476 // Returns true if the cached network quality estimate was successfully read. | 476 // Returns true if the cached network quality estimate was successfully read. |
477 bool ReadCachedNetworkQualityEstimate(); | 477 bool ReadCachedNetworkQualityEstimate(); |
478 | 478 |
479 // Records a correlation metric that can be used for computing the correlation | 479 // Records a correlation metric that can be used for computing the correlation |
480 // between HTTP-layer RTT, transport-layer RTT, throughput and the time | 480 // between HTTP-layer RTT, transport-layer RTT, throughput and the time |
481 // taken to complete |request|. | 481 // taken to complete |request|. |
482 void RecordCorrelationMetric(const URLRequest& request) const; | 482 void RecordCorrelationMetric(const URLRequest& request, int net_error) const; |
483 | 483 |
484 // Returns true if transport RTT should be used for computing the effective | 484 // Returns true if transport RTT should be used for computing the effective |
485 // connection type. | 485 // connection type. |
486 bool UseTransportRTT() const; | 486 bool UseTransportRTT() const; |
487 | 487 |
488 // Forces computation of effective connection type, and notifies observers | 488 // Forces computation of effective connection type, and notifies observers |
489 // if there is a change in its value. | 489 // if there is a change in its value. |
490 void ComputeEffectiveConnectionType(); | 490 void ComputeEffectiveConnectionType(); |
491 | 491 |
492 // Determines if the requests to local host can be used in estimating the | 492 // Determines if the requests to local host can be used in estimating the |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 base::ThreadChecker thread_checker_; | 628 base::ThreadChecker thread_checker_; |
629 | 629 |
630 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 630 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
631 | 631 |
632 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 632 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
633 }; | 633 }; |
634 | 634 |
635 } // namespace net | 635 } // namespace net |
636 | 636 |
637 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 637 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |