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

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

Issue 2763853002: Use Android callback API to obtain cellular signal strength (Closed)
Patch Set: comments Created 3 years, 5 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_params.cc ('k') | net/nqe/observation_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_NETWORK_QUALITY_OBSERVATION_H_ 5 #ifndef NET_NQE_NETWORK_QUALITY_OBSERVATION_H_
6 #define NET_NQE_NETWORK_QUALITY_OBSERVATION_H_ 6 #define NET_NQE_NETWORK_QUALITY_OBSERVATION_H_
7 7
8 #include <stdint.h>
9
8 #include <vector> 10 #include <vector>
9 11
10 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/optional.h"
12 #include "base/time/time.h" 15 #include "base/time/time.h"
13 #include "net/base/net_export.h" 16 #include "net/base/net_export.h"
14 #include "net/nqe/network_quality_observation_source.h" 17 #include "net/nqe/network_quality_observation_source.h"
15 18
16 namespace net { 19 namespace net {
17 20
18 namespace nqe { 21 namespace nqe {
19 22
20 namespace internal { 23 namespace internal {
21 24
22 // Records observations of network quality metrics (such as round trip time 25 // Records observations of network quality metrics (such as round trip time
23 // or throughput), along with the time the observation was made. Observations 26 // or throughput), along with the time the observation was made. Observations
24 // can be made at several places in the network stack, thus the observation 27 // can be made at several places in the network stack, thus the observation
25 // source is provided as well. ValueType must be numerical so that statistics 28 // source is provided as well. ValueType must be numerical so that statistics
26 // such as median, average can be computed. 29 // such as median, average can be computed.
27 template <typename ValueType> 30 template <typename ValueType>
28 struct NET_EXPORT_PRIVATE Observation { 31 struct NET_EXPORT_PRIVATE Observation {
29 Observation(const ValueType& value, 32 Observation(const ValueType& value,
30 base::TimeTicks timestamp, 33 base::TimeTicks timestamp,
31 int32_t signal_strength_dbm, 34 const base::Optional<int32_t>& signal_strength,
32 NetworkQualityObservationSource source) 35 NetworkQualityObservationSource source)
33 : value(value), 36 : value(value),
34 timestamp(timestamp), 37 timestamp(timestamp),
35 signal_strength_dbm(signal_strength_dbm), 38 signal_strength(signal_strength),
36 source(source) { 39 source(source) {
37 DCHECK(!timestamp.is_null()); 40 DCHECK(!timestamp.is_null());
38 } 41 }
39 ~Observation() {} 42 ~Observation() {}
40 43
41 // Value of the observation. 44 // Value of the observation.
42 const ValueType value; 45 const ValueType value;
43 46
44 // Time when the observation was taken. 47 // Time when the observation was taken.
45 const base::TimeTicks timestamp; 48 const base::TimeTicks timestamp;
46 49
47 // Signal strength (in dBm) when the observation was taken. Set to INT32_MIN 50 // Signal strength when the observation was taken.
48 // if the signal strength is unavailable. 51 const base::Optional<int32_t> signal_strength;
49 const int32_t signal_strength_dbm;
50 52
51 // The source of the observation. 53 // The source of the observation.
52 const NetworkQualityObservationSource source; 54 const NetworkQualityObservationSource source;
53 }; 55 };
54 56
55 } // namespace internal 57 } // namespace internal
56 58
57 } // namespace nqe 59 } // namespace nqe
58 60
59 } // namespace net 61 } // namespace net
60 62
61 #endif // NET_NQE_NETWORK_QUALITY_OBSERVATION_H_ 63 #endif // NET_NQE_NETWORK_QUALITY_OBSERVATION_H_
OLDNEW
« no previous file with comments | « net/nqe/network_quality_estimator_params.cc ('k') | net/nqe/observation_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698