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

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

Issue 2491703003: NQE: Notify observer as soon as it is added (Closed)
Patch Set: Addressed bengr comments Created 4 years, 1 month 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // Virtualized for testing. 207 // Virtualized for testing.
208 virtual EffectiveConnectionType GetEffectiveConnectionType() const; 208 virtual EffectiveConnectionType GetEffectiveConnectionType() const;
209 209
210 // Returns the effective type of the current connection based on only the 210 // Returns the effective type of the current connection based on only the
211 // samples observed after |start_time|. This should only be used for 211 // samples observed after |start_time|. This should only be used for
212 // recording the metrics. Virtualized for testing. 212 // recording the metrics. Virtualized for testing.
213 virtual EffectiveConnectionType GetRecentEffectiveConnectionType( 213 virtual EffectiveConnectionType GetRecentEffectiveConnectionType(
214 const base::TimeTicks& start_time) const; 214 const base::TimeTicks& start_time) const;
215 215
216 // Adds |observer| to the list of effective connection type observers. Must be 216 // Adds |observer| to the list of effective connection type observers. Must be
217 // called on the IO thread. 217 // called on the IO thread. |observer| would be notified of the current
218 // effective connection type in the next message pump.
218 void AddEffectiveConnectionTypeObserver( 219 void AddEffectiveConnectionTypeObserver(
219 EffectiveConnectionTypeObserver* observer); 220 EffectiveConnectionTypeObserver* observer);
220 221
221 // Removes |observer| from the list of effective connection type observers. 222 // Removes |observer| from the list of effective connection type observers.
222 // Must be called on the IO thread. 223 // Must be called on the IO thread.
223 void RemoveEffectiveConnectionTypeObserver( 224 void RemoveEffectiveConnectionTypeObserver(
224 EffectiveConnectionTypeObserver* observer); 225 EffectiveConnectionTypeObserver* observer);
225 226
226 // Adds |observer| to the list of RTT and throughput estimate observers. Must 227 // Adds |observer| to the list of RTT and throughput estimate observers. Must
227 // be called on the IO thread. 228 // be called on the IO thread. |observer| would be notified of the current RTT
229 // and throughput estimates in the next message pump.
228 void AddRTTAndThroughputEstimatesObserver( 230 void AddRTTAndThroughputEstimatesObserver(
229 RTTAndThroughputEstimatesObserver* observer); 231 RTTAndThroughputEstimatesObserver* observer);
230 232
231 // Removes |observer| from the list of RTT and throughput estimate observers. 233 // Removes |observer| from the list of RTT and throughput estimate observers.
232 // Must be called on the IO thread. 234 // Must be called on the IO thread.
233 void RemoveRTTAndThroughputEstimatesObserver( 235 void RemoveRTTAndThroughputEstimatesObserver(
234 RTTAndThroughputEstimatesObserver* observer); 236 RTTAndThroughputEstimatesObserver* observer);
235 237
236 // Notifies NetworkQualityEstimator that the response header of |request| has 238 // Notifies NetworkQualityEstimator that the response header of |request| has
237 // been received. 239 // been received.
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // Recomputes effective connection type, if it was computed more than the 487 // Recomputes effective connection type, if it was computed more than the
486 // specified duration ago, or if there has been a connection change recently. 488 // specified duration ago, or if there has been a connection change recently.
487 void MaybeComputeEffectiveConnectionType(); 489 void MaybeComputeEffectiveConnectionType();
488 490
489 // Notifies observers of a change in effective connection type. 491 // Notifies observers of a change in effective connection type.
490 void NotifyObserversOfEffectiveConnectionTypeChanged(); 492 void NotifyObserversOfEffectiveConnectionTypeChanged();
491 493
492 // Notifies the observers of RTT or throughput estimates computation. 494 // Notifies the observers of RTT or throughput estimates computation.
493 void NotifyObserversOfRTTOrThroughputComputed() const; 495 void NotifyObserversOfRTTOrThroughputComputed() const;
494 496
497 // Notifies |observer| of the current effective connection type if |observer|
498 // is still registered as an observer.
499 void NotifyEffectiveConnectionTypeObserverIfPresent(
500 EffectiveConnectionTypeObserver* observer) const;
501
502 // Notifies |observer| of the current RTT and throughput if |observer| is
503 // still registered as an observer.
504 void NotifyRTTAndThroughputEstimatesObserverIfPresent(
505 RTTAndThroughputEstimatesObserver* observer) const;
506
495 // Records NQE accuracy metrics. |measuring_duration| should belong to the 507 // Records NQE accuracy metrics. |measuring_duration| should belong to the
496 // vector returned by AccuracyRecordingIntervals(). 508 // vector returned by AccuracyRecordingIntervals().
497 // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a 509 // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a
498 // main frame request is observed. 510 // main frame request is observed.
499 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; 511 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const;
500 512
501 // Obtains the current cellular signal strength value and updates 513 // Obtains the current cellular signal strength value and updates
502 // |min_signal_strength_since_connection_change_| and 514 // |min_signal_strength_since_connection_change_| and
503 // |max_signal_strength_since_connection_change_|. 515 // |max_signal_strength_since_connection_change_|.
504 void UpdateSignalStrength(); 516 void UpdateSignalStrength();
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 base::ThreadChecker thread_checker_; 707 base::ThreadChecker thread_checker_;
696 708
697 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 709 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
698 710
699 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 711 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
700 }; 712 };
701 713
702 } // namespace net 714 } // namespace net
703 715
704 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 716 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/nqe/ui_network_quality_estimator_service_browsertest.cc ('k') | net/nqe/network_quality_estimator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698