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

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

Issue 2927453002: Make NQE a derived class of NetworkQualityProvider (Closed)
Patch Set: some more IWYU fixes Created 3 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
« no previous file with comments | « net/nqe/network_quality_estimator_unittest.cc ('k') | net/nqe/network_quality_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_NQE_NETWORK_QUALITY_PROVIDER_H_
6 #define NET_NQE_NETWORK_QUALITY_PROVIDER_H_
7
8 #include <stdint.h>
9
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/macros.h"
13 #include "base/optional.h"
14 #include "base/time/time.h"
15 #include "net/base/net_export.h"
16 #include "net/nqe/effective_connection_type.h"
17
18 namespace net {
19
20 class EffectiveConnectionTypeObserver;
21 class RTTAndThroughputEstimatesObserver;
22
23 // Provides simple interface to obtain the network quality, and to listen to
24 // the changes in the network quality.
25 class NET_EXPORT NetworkQualityProvider {
26 public:
27 virtual ~NetworkQualityProvider() {}
28
29 // Returns the current effective connection type. The effective connection
30 // type is computed by the network quality estimator at regular intervals and
31 // at certain events (e.g., connection change).
32 virtual EffectiveConnectionType GetEffectiveConnectionType() const = 0;
33
34 // Adds |observer| to a list of effective connection type observers.
35 // The observer must register and unregister itself on the same thread.
36 // |observer| would be notified on the thread on which it registered.
37 // |observer| would be notified of the current effective connection
38 // type in the next message pump.
39 virtual void AddEffectiveConnectionTypeObserver(
40 EffectiveConnectionTypeObserver* observer) {}
41
42 // Removes |observer| from a list of effective connection type observers.
43 virtual void RemoveEffectiveConnectionTypeObserver(
44 EffectiveConnectionTypeObserver* observer) {}
45
46 // Returns the current HTTP RTT estimate. If the estimate is unavailable,
47 // the returned optional value is null.
48 virtual base::Optional<base::TimeDelta> GetHttpRTT() const;
49
50 // Returns the current transport RTT estimate. If the estimate is
51 // unavailable, the returned optional value is null.
52 virtual base::Optional<base::TimeDelta> GetTransportRTT() const;
53
54 // Returns the current downstream throughput estimate (in kilobits per
55 // second). If the estimate is unavailable, the returned optional value is
56 // null.
57 virtual base::Optional<int32_t> GetDownstreamThroughputKbps() const;
58
59 // Adds |observer| to the list of RTT and throughput estimate observers.
60 // The observer must register and unregister itself on the same thread.
61 // |observer| would be notified on the thread on which it registered.
62 // |observer| would be notified of the current values in the next message
63 // pump.
64 virtual void AddRTTAndThroughputEstimatesObserver(
65 RTTAndThroughputEstimatesObserver* observer) {}
66
67 // Removes |observer| from the list of RTT and throughput estimate
68 // observers.
69 virtual void RemoveRTTAndThroughputEstimatesObserver(
70 RTTAndThroughputEstimatesObserver* observer) {}
71
72 protected:
73 NetworkQualityProvider() {}
74
75 private:
76 DISALLOW_COPY_AND_ASSIGN(NetworkQualityProvider);
77 };
78
79 } // namespace net
80
81 #endif // NET_NQE_NETWORK_QUALITY_PROVIDER_H_
OLDNEW
« no previous file with comments | « net/nqe/network_quality_estimator_unittest.cc ('k') | net/nqe/network_quality_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698