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

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

Issue 1994863002: Revert of Return E_C_T_OFFLINE when the device is offline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | net/nqe/network_quality_estimator_unittest.cc » ('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 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 #include "net/nqe/network_quality_estimator.h" 5 #include "net/nqe/network_quality_estimator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 // unavailable, add the default estimates. 660 // unavailable, add the default estimates.
661 if (!ReadCachedNetworkQualityEstimate()) 661 if (!ReadCachedNetworkQualityEstimate())
662 AddDefaultEstimates(); 662 AddDefaultEstimates();
663 estimated_median_network_quality_ = nqe::internal::NetworkQuality(); 663 estimated_median_network_quality_ = nqe::internal::NetworkQuality();
664 } 664 }
665 665
666 NetworkQualityEstimator::EffectiveConnectionType 666 NetworkQualityEstimator::EffectiveConnectionType
667 NetworkQualityEstimator::GetEffectiveConnectionType() const { 667 NetworkQualityEstimator::GetEffectiveConnectionType() const {
668 DCHECK(thread_checker_.CalledOnValidThread()); 668 DCHECK(thread_checker_.CalledOnValidThread());
669 669
670 // If the device is currently offline, then return
671 // EFFECTIVE_CONNECTION_TYPE_OFFLINE.
672 if (GetCurrentNetworkID().type == NetworkChangeNotifier::CONNECTION_NONE)
673 return EFFECTIVE_CONNECTION_TYPE_OFFLINE;
674
675 base::TimeDelta url_request_rtt = nqe::internal::InvalidRTT(); 670 base::TimeDelta url_request_rtt = nqe::internal::InvalidRTT();
676 if (!GetURLRequestRTTEstimate(&url_request_rtt)) 671 if (!GetURLRequestRTTEstimate(&url_request_rtt))
677 url_request_rtt = nqe::internal::InvalidRTT(); 672 url_request_rtt = nqe::internal::InvalidRTT();
678 673
679 int32_t kbps = nqe::internal::kInvalidThroughput; 674 int32_t kbps = nqe::internal::kInvalidThroughput;
680 if (!GetDownlinkThroughputKbpsEstimate(&kbps)) 675 if (!GetDownlinkThroughputKbpsEstimate(&kbps))
681 kbps = nqe::internal::kInvalidThroughput; 676 kbps = nqe::internal::kInvalidThroughput;
682 677
683 if (url_request_rtt == nqe::internal::InvalidRTT() && 678 if (url_request_rtt == nqe::internal::InvalidRTT() &&
684 kbps == nqe::internal::kInvalidThroughput) { 679 kbps == nqe::internal::kInvalidThroughput) {
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 1023
1029 void NetworkQualityEstimator::NotifyObserversOfThroughput( 1024 void NetworkQualityEstimator::NotifyObserversOfThroughput(
1030 const ThroughputObservation& observation) { 1025 const ThroughputObservation& observation) {
1031 FOR_EACH_OBSERVER( 1026 FOR_EACH_OBSERVER(
1032 ThroughputObserver, throughput_observer_list_, 1027 ThroughputObserver, throughput_observer_list_,
1033 OnThroughputObservation(observation.value, observation.timestamp, 1028 OnThroughputObservation(observation.value, observation.timestamp,
1034 observation.source)); 1029 observation.source));
1035 } 1030 }
1036 1031
1037 } // namespace net 1032 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698