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

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

Issue 1879743002: Expose cellular signal strength on Android to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Paul's comments Created 4 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
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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 469
470 // Notify observers of a change in effective connection type. 470 // Notify observers of a change in effective connection type.
471 void NotifyObserversOfEffectiveConnectionTypeChanged(); 471 void NotifyObserversOfEffectiveConnectionTypeChanged();
472 472
473 // Records NQE accuracy metrics. |measuring_duration| should belong to the 473 // Records NQE accuracy metrics. |measuring_duration| should belong to the
474 // vector returned by AccuracyRecordingIntervals(). 474 // vector returned by AccuracyRecordingIntervals().
475 // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a 475 // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a
476 // main frame request is observed. 476 // main frame request is observed.
477 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; 477 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const;
478 478
479 // Obtains the current cellular signal strength value and updates
480 // |min_signal_strength_since_connection_change_| and
481 // |max_signal_strength_since_connection_change_|.
482 void UpdateSignalStrength();
483
479 // Returns the effective type of the current connection based on only the 484 // Returns the effective type of the current connection based on only the
480 // samples observed after |start_time|. Uses HTTP RTT and downstream 485 // samples observed after |start_time|. Uses HTTP RTT and downstream
481 // throughput to compute the effective connection type, and requires both of 486 // throughput to compute the effective connection type, and requires both of
482 // them to have a valid value. 487 // them to have a valid value.
483 EffectiveConnectionType 488 EffectiveConnectionType
484 GetRecentEffectiveConnectionTypeHttpRTTAndDownstreamThroughput( 489 GetRecentEffectiveConnectionTypeHttpRTTAndDownstreamThroughput(
485 const base::TimeTicks& start_time) const; 490 const base::TimeTicks& start_time) const;
486 491
487 // Values of external estimate provider status. This enum must remain 492 // Values of external estimate provider status. This enum must remain
488 // synchronized with the enum of the same name in 493 // synchronized with the enum of the same name in
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 // |downstream_throughput_kbps_observations_|, which are later used for 602 // |downstream_throughput_kbps_observations_|, which are later used for
598 // estimating the throughput. 603 // estimating the throughput.
599 std::unique_ptr<nqe::internal::ThroughputAnalyzer> throughput_analyzer_; 604 std::unique_ptr<nqe::internal::ThroughputAnalyzer> throughput_analyzer_;
600 605
601 // Current effective connection type. It is updated on connection change 606 // Current effective connection type. It is updated on connection change
602 // events. It is also updated every time there is network traffic (provided 607 // events. It is also updated every time there is network traffic (provided
603 // the last computation was more than 608 // the last computation was more than
604 // |effective_connection_type_recomputation_interval_| ago). 609 // |effective_connection_type_recomputation_interval_| ago).
605 EffectiveConnectionType effective_connection_type_; 610 EffectiveConnectionType effective_connection_type_;
606 611
612 // Minimum and Maximum signal strength (in dbM) observed since last connection
613 // change. Updated on connection change and main frame requests.
614 int32_t min_signal_strength_since_connection_change_;
615 int32_t max_signal_strength_since_connection_change_;
616
607 base::ThreadChecker thread_checker_; 617 base::ThreadChecker thread_checker_;
608 618
609 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 619 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
610 620
611 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 621 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
612 }; 622 };
613 623
614 } // namespace net 624 } // namespace net
615 625
616 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 626 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698