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

Unified Diff: net/nqe/network_quality_estimator.h

Issue 2763853002: Use Android callback API to obtain cellular signal strength (Closed)
Patch Set: ryansturm comments Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/nqe/network_quality_estimator.h
diff --git a/net/nqe/network_quality_estimator.h b/net/nqe/network_quality_estimator.h
index 5c2718a12b6df2eb8ba4763a739942f511798982..a6ec07afacbbff52786aefa842a3d54198ca515c 100644
--- a/net/nqe/network_quality_estimator.h
+++ b/net/nqe/network_quality_estimator.h
@@ -34,6 +34,10 @@
#include "net/nqe/observation_buffer.h"
#include "net/socket/socket_performance_watcher_factory.h"
+#if defined(OS_ANDROID)
+#include "net/android/cellular_signal_strength.h"
+#endif // OS_ANDROID
+
namespace base {
class TickClock;
} // namespace base
@@ -669,10 +673,10 @@ class NET_EXPORT NetworkQualityEstimator
// The factor by which the weight of an observation reduces every second.
const double weight_multiplier_per_second_;
- // The factor by which the weight of an observation reduces for every dBm
- // difference between the current signal strength (in dBm), and the signal
- // strength at the time when the observation was taken.
- const double weight_multiplier_per_dbm_;
+ // The factor by which the weight of an observation reduces for every signal
+ // strength level difference between the current signal strength, and the
+ // signal strength at the time when the observation was taken.
+ const double weight_multiplier_per_signal_strength_level_;
// Algorithm to use for computing effective connection type. The value is
// obtained from field trial parameters. If the value from field trial
@@ -786,15 +790,16 @@ class NET_EXPORT NetworkQualityEstimator
// |effective_connection_type_recomputation_interval_| ago).
EffectiveConnectionType effective_connection_type_;
- // Last known value of the wireless signal strength. Set to INT32_MIN if
- // unavailable. |signal_strength_dbm_| is reset to INT32_MIN on connection
- // change events.
- int32_t signal_strength_dbm_;
+ // Last known value of the wireless signal strength level. Set to INT32_MIN if
+ // unavailable. |signal_strength_| is reset to INT32_MIN on connection
+ // change events. If the signal strength level is available, the value is set
+ // to between 0 and 4, both inclusive.
+ base::Optional<int32_t> signal_strength_;
- // Minimum and maximum signal strength (in dBm) observed since last connection
+ // Minimum and maximum signal strength level observed since last connection
// change. Updated on connection change and main frame requests.
- int32_t min_signal_strength_since_connection_change_;
- int32_t max_signal_strength_since_connection_change_;
+ base::Optional<int32_t> min_signal_strength_since_connection_change_;
+ base::Optional<int32_t> max_signal_strength_since_connection_change_;
// It is costlier to add values to a sparse histogram. So, the correlation UMA
// is recorded with |correlation_uma_logging_probability_| since recording it
@@ -830,6 +835,12 @@ class NET_EXPORT NetworkQualityEstimator
const std::vector<NetworkQualityObservationSource>
disallowed_observation_sources_for_transport_;
+#if defined(OS_ANDROID)
+ // Initialized only if the experiment to use the cellular signal strength
+ // is enabled.
+ std::unique_ptr<android::CellularSignalStrength> cellular_signal_strength_;
+#endif // OS_ANDROID
+
base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);

Powered by Google App Engine
This is Rietveld 408576698