OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_THROUGHPUT_ANALYZER_H_ | 5 #ifndef NET_NQE_THROUGHPUT_ANALYZER_H_ |
6 #define NET_NQE_THROUGHPUT_ANALYZER_H_ | 6 #define NET_NQE_THROUGHPUT_ANALYZER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 typedef base::Callback<void(int32_t)> ThroughputObservationCallback; | 19 typedef base::Callback<void(int32_t)> ThroughputObservationCallback; |
20 } | 20 } |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class SingleThreadTaskRunner; | 23 class SingleThreadTaskRunner; |
24 } | 24 } |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 | 27 |
| 28 class NetworkQualityEstimatorParams; |
28 class URLRequest; | 29 class URLRequest; |
29 | 30 |
30 namespace nqe { | 31 namespace nqe { |
31 | 32 |
32 namespace internal { | 33 namespace internal { |
33 | 34 |
34 class NetworkQualityEstimatorParams; | |
35 | |
36 // Makes throughput observations. Polls NetworkActivityMonitor | 35 // Makes throughput observations. Polls NetworkActivityMonitor |
37 // (TrafficStats on Android) to count number of bits received over throughput | 36 // (TrafficStats on Android) to count number of bits received over throughput |
38 // observation windows in accordance with the following rules: | 37 // observation windows in accordance with the following rules: |
39 // (1) A new window of observation begins any time a URL request header is | 38 // (1) A new window of observation begins any time a URL request header is |
40 // about to be sent, or a request completes or is destroyed. | 39 // about to be sent, or a request completes or is destroyed. |
41 // (2) A request is "active" if its headers are sent, but it hasn't completed, | 40 // (2) A request is "active" if its headers are sent, but it hasn't completed, |
42 // and "local" if destined to local host. If at any time during a | 41 // and "local" if destined to local host. If at any time during a |
43 // throughput observation window there is an active, local request, the | 42 // throughput observation window there is an active, local request, the |
44 // window is discarded. | 43 // window is discarded. |
45 // (3) If less than 32KB is received over the network during a window of | 44 // (3) If less than 32KB is received over the network during a window of |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 DISALLOW_COPY_AND_ASSIGN(ThroughputAnalyzer); | 181 DISALLOW_COPY_AND_ASSIGN(ThroughputAnalyzer); |
183 }; | 182 }; |
184 | 183 |
185 } // namespace internal | 184 } // namespace internal |
186 | 185 |
187 } // namespace nqe | 186 } // namespace nqe |
188 | 187 |
189 } // namespace net | 188 } // namespace net |
190 | 189 |
191 #endif // NET_NQE_THROUGHPUT_ANALYZER_H_ | 190 #endif // NET_NQE_THROUGHPUT_ANALYZER_H_ |
OLD | NEW |