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

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

Issue 2487883002: NQE: Use cached estimates (Closed)
Patch Set: bengr comments Created 4 years 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 const base::TimeTicks& start_time, 482 const base::TimeTicks& start_time,
483 int percentile) const; 483 int percentile) const;
484 int32_t GetDownlinkThroughputKbpsEstimateInternal( 484 int32_t GetDownlinkThroughputKbpsEstimateInternal(
485 const base::TimeTicks& start_time, 485 const base::TimeTicks& start_time,
486 int percentile) const; 486 int percentile) const;
487 487
488 // Returns the current network ID checking by calling the platform APIs. 488 // Returns the current network ID checking by calling the platform APIs.
489 // Virtualized for testing. 489 // Virtualized for testing.
490 virtual nqe::internal::NetworkID GetCurrentNetworkID() const; 490 virtual nqe::internal::NetworkID GetCurrentNetworkID() const;
491 491
492 // Notifies RTT observers of |observation|. May also trigger recomputation
493 // of effective connection type.
492 void NotifyObserversOfRTT(const RttObservation& observation); 494 void NotifyObserversOfRTT(const RttObservation& observation);
493 495
496 // Notifies throughput observers of |observation|. May also trigger
497 // recomputation of effective connection type.
494 void NotifyObserversOfThroughput(const ThroughputObservation& observation); 498 void NotifyObserversOfThroughput(const ThroughputObservation& observation);
495 499
496 // Returns true only if the |request| can be used for RTT estimation. 500 // Returns true only if the |request| can be used for RTT estimation.
497 bool RequestProvidesRTTObservation(const URLRequest& request) const; 501 bool RequestProvidesRTTObservation(const URLRequest& request) const;
498 502
499 // Recomputes effective connection type, if it was computed more than the 503 // Recomputes effective connection type, if it was computed more than the
500 // specified duration ago, or if there has been a connection change recently. 504 // specified duration ago, or if there has been a connection change recently.
501 void MaybeComputeEffectiveConnectionType(); 505 void MaybeComputeEffectiveConnectionType();
502 506
503 // Notifies observers of a change in effective connection type. 507 // Notifies observers of a change in effective connection type.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 void RecordCorrelationMetric(const URLRequest& request, int net_error) const; 576 void RecordCorrelationMetric(const URLRequest& request, int net_error) const;
573 577
574 // Returns true if transport RTT should be used for computing the effective 578 // Returns true if transport RTT should be used for computing the effective
575 // connection type. 579 // connection type.
576 bool UseTransportRTT() const; 580 bool UseTransportRTT() const;
577 581
578 // Forces computation of effective connection type, and notifies observers 582 // Forces computation of effective connection type, and notifies observers
579 // if there is a change in its value. 583 // if there is a change in its value.
580 void ComputeEffectiveConnectionType(); 584 void ComputeEffectiveConnectionType();
581 585
586 // May update the network quality of the current network if |network_id|
587 // matches the ID of the current network. |cached_network_quality| is the
588 // cached network quality of the network with id |network_id|.
589 void MaybeUpdateNetworkQualityFromCache(
590 const nqe::internal::NetworkID& network_id,
591 const nqe::internal::CachedNetworkQuality cached_network_quality);
592
582 // Determines if the requests to local host can be used in estimating the 593 // Determines if the requests to local host can be used in estimating the
583 // network quality. Set to true only for tests. 594 // network quality. Set to true only for tests.
584 bool use_localhost_requests_; 595 bool use_localhost_requests_;
585 596
586 // Determines if the responses smaller than |kMinTransferSizeInBytes| 597 // Determines if the responses smaller than |kMinTransferSizeInBytes|
587 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the 598 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the
588 // network quality. Set to true only for tests. 599 // network quality. Set to true only for tests.
589 bool use_small_responses_; 600 bool use_small_responses_;
590 601
591 // If true, default values provided by the platform are used for estimation. 602 // If true, default values provided by the platform are used for estimation.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 base::ThreadChecker thread_checker_; 737 base::ThreadChecker thread_checker_;
727 738
728 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 739 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
729 740
730 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 741 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
731 }; 742 };
732 743
733 } // namespace net 744 } // namespace net
734 745
735 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 746 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698