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

Unified Diff: net/nqe/network_quality_estimator.h

Issue 2763853002: Use Android callback API to obtain cellular signal strength (Closed)
Patch Set: pauljensen comments 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 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 19e460a5a5c35046030b61192e2b318ed358063c..7b2e1fa0d6746c864861efd6a34c66e187933880 100644
--- a/net/nqe/network_quality_estimator.h
+++ b/net/nqe/network_quality_estimator.h
@@ -38,6 +38,10 @@
#include "net/nqe/rtt_throughput_estimates_observer.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
@@ -647,15 +651,15 @@ 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. If the signal
+ // strength level is available, the value is set to between 0 and 4, both
+ // inclusive. If the value is unavailable, |signal_strength_| has null value.
+ 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_;
// Stores the qualities of different networks.
std::unique_ptr<nqe::internal::NetworkQualityStore> network_quality_store_;
@@ -675,6 +679,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