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

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

Issue 2064763003: Add function that converts string connection type to ECT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 // Returns a string equivalent to |type|.
260 static const char* GetNameForEffectiveConnectionType(
261 EffectiveConnectionType type);
262
263 // Returns a EffectiveConnectionType equivalent to |connection_type_name|.
bengr 2016/06/20 14:44:16 a -> an
tbansal1 2016/06/20 20:16:35 Done.
264 static EffectiveConnectionType GetEffectiveConnectionTypeForName(
265 const std::string& connection_type_name);
266
259 protected: 267 protected:
260 // NetworkID is used to uniquely identify a network. 268 // NetworkID is used to uniquely identify a network.
261 // For the purpose of network quality estimation and caching, a network is 269 // For the purpose of network quality estimation and caching, a network is
262 // uniquely identified by a combination of |type| and 270 // uniquely identified by a combination of |type| and
263 // |id|. This approach is unable to distinguish networks with 271 // |id|. This approach is unable to distinguish networks with
264 // same name (e.g., different Wi-Fi networks with same SSID). 272 // same name (e.g., different Wi-Fi networks with same SSID).
265 // This is a protected member to expose it to tests. 273 // This is a protected member to expose it to tests.
266 struct NET_EXPORT_PRIVATE NetworkID { 274 struct NET_EXPORT_PRIVATE NetworkID {
267 NetworkID(NetworkChangeNotifier::ConnectionType type, const std::string& id) 275 NetworkID(NetworkChangeNotifier::ConnectionType type, const std::string& id)
268 : type(type), id(id) {} 276 : type(type), id(id) {}
(...skipping 30 matching lines...) Expand all
299 307
300 // NetworkChangeNotifier::ConnectionTypeObserver implementation: 308 // NetworkChangeNotifier::ConnectionTypeObserver implementation:
301 void OnConnectionTypeChanged( 309 void OnConnectionTypeChanged(
302 NetworkChangeNotifier::ConnectionType type) override; 310 NetworkChangeNotifier::ConnectionType type) override;
303 311
304 // ExternalEstimateProvider::UpdatedEstimateObserver implementation. 312 // ExternalEstimateProvider::UpdatedEstimateObserver implementation.
305 void OnUpdatedEstimateAvailable(const base::TimeDelta& rtt, 313 void OnUpdatedEstimateAvailable(const base::TimeDelta& rtt,
306 int32_t downstream_throughput_kbps, 314 int32_t downstream_throughput_kbps,
307 int32_t upstream_throughput_kbps) override; 315 int32_t upstream_throughput_kbps) override;
308 316
309 // Return a string equivalent to |type|.
310 const char* GetNameForEffectiveConnectionType(
311 EffectiveConnectionType type) const;
312
313 // Returns the list of intervals at which the accuracy of network quality 317 // Returns the list of intervals at which the accuracy of network quality
314 // prediction should be recorded. Virtualized for testing. 318 // prediction should be recorded. Virtualized for testing.
315 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals() 319 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals()
316 const; 320 const;
317 321
318 // Overrides the tick clock used by |this| for testing. 322 // Overrides the tick clock used by |this| for testing.
319 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); 323 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
320 324
321 private: 325 private:
322 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); 326 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 base::ThreadChecker thread_checker_; 597 base::ThreadChecker thread_checker_;
594 598
595 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 599 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
596 600
597 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 601 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
598 }; 602 };
599 603
600 } // namespace net 604 } // namespace net
601 605
602 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 606 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator.cc » ('j') | net/nqe/network_quality_estimator_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698