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

Side by Side 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 unified diff | Download patch
OLDNEW
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_NETWORK_QUALITY_ESTIMATOR_H_ 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 20 matching lines...) Expand all
31 #include "net/nqe/network_quality.h" 31 #include "net/nqe/network_quality.h"
32 #include "net/nqe/network_quality_estimator_params.h" 32 #include "net/nqe/network_quality_estimator_params.h"
33 #include "net/nqe/network_quality_observation.h" 33 #include "net/nqe/network_quality_observation.h"
34 #include "net/nqe/network_quality_observation_source.h" 34 #include "net/nqe/network_quality_observation_source.h"
35 #include "net/nqe/network_quality_provider.h" 35 #include "net/nqe/network_quality_provider.h"
36 #include "net/nqe/network_quality_store.h" 36 #include "net/nqe/network_quality_store.h"
37 #include "net/nqe/observation_buffer.h" 37 #include "net/nqe/observation_buffer.h"
38 #include "net/nqe/rtt_throughput_estimates_observer.h" 38 #include "net/nqe/rtt_throughput_estimates_observer.h"
39 #include "net/socket/socket_performance_watcher_factory.h" 39 #include "net/socket/socket_performance_watcher_factory.h"
40 40
41 #if defined(OS_ANDROID)
42 #include "net/android/cellular_signal_strength.h"
43 #endif // OS_ANDROID
44
41 namespace base { 45 namespace base {
42 class TickClock; 46 class TickClock;
43 } // namespace base 47 } // namespace base
44 48
45 namespace net { 49 namespace net {
46 50
47 class NetLog; 51 class NetLog;
48 52
49 namespace nqe { 53 namespace nqe {
50 namespace internal { 54 namespace internal {
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 644
641 // Current estimate of the network quality. 645 // Current estimate of the network quality.
642 nqe::internal::NetworkQuality network_quality_; 646 nqe::internal::NetworkQuality network_quality_;
643 647
644 // Current effective connection type. It is updated on connection change 648 // Current effective connection type. It is updated on connection change
645 // events. It is also updated every time there is network traffic (provided 649 // events. It is also updated every time there is network traffic (provided
646 // the last computation was more than 650 // the last computation was more than
647 // |effective_connection_type_recomputation_interval_| ago). 651 // |effective_connection_type_recomputation_interval_| ago).
648 EffectiveConnectionType effective_connection_type_; 652 EffectiveConnectionType effective_connection_type_;
649 653
650 // Last known value of the wireless signal strength. Set to INT32_MIN if 654 // Last known value of the wireless signal strength level. If the signal
651 // unavailable. |signal_strength_dbm_| is reset to INT32_MIN on connection 655 // strength level is available, the value is set to between 0 and 4, both
652 // change events. 656 // inclusive. If the value is unavailable, |signal_strength_| has null value.
653 int32_t signal_strength_dbm_; 657 base::Optional<int32_t> signal_strength_;
654 658
655 // Minimum and maximum signal strength (in dBm) observed since last connection 659 // Minimum and maximum signal strength level observed since last connection
656 // change. Updated on connection change and main frame requests. 660 // change. Updated on connection change and main frame requests.
657 int32_t min_signal_strength_since_connection_change_; 661 base::Optional<int32_t> min_signal_strength_since_connection_change_;
658 int32_t max_signal_strength_since_connection_change_; 662 base::Optional<int32_t> max_signal_strength_since_connection_change_;
659 663
660 // Stores the qualities of different networks. 664 // Stores the qualities of different networks.
661 std::unique_ptr<nqe::internal::NetworkQualityStore> network_quality_store_; 665 std::unique_ptr<nqe::internal::NetworkQualityStore> network_quality_store_;
662 666
663 base::ThreadChecker thread_checker_; 667 base::ThreadChecker thread_checker_;
664 668
665 // Manages the writing of events to the net log. 669 // Manages the writing of events to the net log.
666 nqe::internal::EventCreator event_creator_; 670 nqe::internal::EventCreator event_creator_;
667 671
668 // Vector that contains observation sources that should not be used when 672 // Vector that contains observation sources that should not be used when
669 // computing the estimate at HTTP layer. 673 // computing the estimate at HTTP layer.
670 const std::vector<NetworkQualityObservationSource> 674 const std::vector<NetworkQualityObservationSource>
671 disallowed_observation_sources_for_http_; 675 disallowed_observation_sources_for_http_;
672 676
673 // Vector that contains observation sources that should not be used when 677 // Vector that contains observation sources that should not be used when
674 // computing the estimate at transport layer. 678 // computing the estimate at transport layer.
675 const std::vector<NetworkQualityObservationSource> 679 const std::vector<NetworkQualityObservationSource>
676 disallowed_observation_sources_for_transport_; 680 disallowed_observation_sources_for_transport_;
677 681
682 #if defined(OS_ANDROID)
683 // Initialized only if the experiment to use the cellular signal strength
684 // is enabled.
685 std::unique_ptr<android::CellularSignalStrength> cellular_signal_strength_;
686 #endif // OS_ANDROID
687
678 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 688 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
679 689
680 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 690 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
681 }; 691 };
682 692
683 } // namespace net 693 } // namespace net
684 694
685 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 695 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698