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_EXTERNAL_ESTIMATE_PROVIDER_H_ | 5 #ifndef NET_NQE_EXTERNAL_ESTIMATE_PROVIDER_H_ |
6 #define NET_NQE_EXTERNAL_ESTIMATE_PROVIDER_H_ | 6 #define NET_NQE_EXTERNAL_ESTIMATE_PROVIDER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 // Base class used by external providers such as operating system APIs to | 16 // Base class used by external providers such as operating system APIs to |
17 // provide network quality estimates to NetworkQualityEstimator. | 17 // provide network quality estimates to NetworkQualityEstimator. |
18 class NET_EXPORT ExternalEstimateProvider { | 18 class NET_EXPORT ExternalEstimateProvider { |
19 public: | 19 public: |
20 class NET_EXPORT UpdatedEstimateDelegate { | 20 class NET_EXPORT UpdatedEstimateDelegate { |
21 public: | 21 public: |
22 // Will be called when an updated estimate is available. | 22 // Will be called with updated RTT, downstream and upstream throughput (both |
23 virtual void OnUpdatedEstimateAvailable() = 0; | 23 // in kilobits per second) when an updated estimate is available. If |rtt| |
| 24 // is unavailable, it is set to base::TimeDelta(). If |
| 25 // |downstream_throughput_kbps| or |upstream_throughput_kbps| are |
| 26 // unavailble, they are set to -1, respectively. |
| 27 virtual void OnUpdatedEstimateAvailable( |
| 28 const base::TimeDelta& rtt, |
| 29 int32_t downstream_throughput_kbps, |
| 30 int32_t upstream_throughput_kbps) = 0; |
24 | 31 |
25 protected: | 32 protected: |
26 UpdatedEstimateDelegate() {} | 33 UpdatedEstimateDelegate() {} |
27 virtual ~UpdatedEstimateDelegate() {} | 34 virtual ~UpdatedEstimateDelegate() {} |
28 | 35 |
29 private: | 36 private: |
30 DISALLOW_COPY_AND_ASSIGN(UpdatedEstimateDelegate); | 37 DISALLOW_COPY_AND_ASSIGN(UpdatedEstimateDelegate); |
31 }; | 38 }; |
32 | 39 |
33 ExternalEstimateProvider() {} | 40 ExternalEstimateProvider() {} |
(...skipping 29 matching lines...) Expand all Loading... |
63 // provider. | 70 // provider. |
64 virtual void Update() const = 0; | 71 virtual void Update() const = 0; |
65 | 72 |
66 private: | 73 private: |
67 DISALLOW_COPY_AND_ASSIGN(ExternalEstimateProvider); | 74 DISALLOW_COPY_AND_ASSIGN(ExternalEstimateProvider); |
68 }; | 75 }; |
69 | 76 |
70 } // namespace net | 77 } // namespace net |
71 | 78 |
72 #endif // NET_NQE_EXTERNAL_ESTIMATE_PROVIDER_H_ | 79 #endif // NET_NQE_EXTERNAL_ESTIMATE_PROVIDER_H_ |
OLD | NEW |