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

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

Issue 2103323007: Exposing NQE on the Browser UI thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke 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
« no previous file with comments | « net/nqe/network_quality_estimator.h ('k') | no next file » | 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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 use_localhost_requests_); 730 use_localhost_requests_);
731 } 731 }
732 732
733 void NetworkQualityEstimator::SetUseSmallResponsesForTesting( 733 void NetworkQualityEstimator::SetUseSmallResponsesForTesting(
734 bool use_small_responses) { 734 bool use_small_responses) {
735 DCHECK(thread_checker_.CalledOnValidThread()); 735 DCHECK(thread_checker_.CalledOnValidThread());
736 use_small_responses_ = use_small_responses; 736 use_small_responses_ = use_small_responses;
737 throughput_analyzer_->SetUseSmallResponsesForTesting(use_small_responses_); 737 throughput_analyzer_->SetUseSmallResponsesForTesting(use_small_responses_);
738 } 738 }
739 739
740 void NetworkQualityEstimator::ReportEffectiveConnectionTypeForTesting(
741 EffectiveConnectionType effective_connection_type) {
742 DCHECK(thread_checker_.CalledOnValidThread());
743 FOR_EACH_OBSERVER(
744 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_,
745 OnEffectiveConnectionTypeChanged(effective_connection_type));
746 }
747
740 bool NetworkQualityEstimator::RequestProvidesRTTObservation( 748 bool NetworkQualityEstimator::RequestProvidesRTTObservation(
741 const URLRequest& request) const { 749 const URLRequest& request) const {
742 DCHECK(thread_checker_.CalledOnValidThread()); 750 DCHECK(thread_checker_.CalledOnValidThread());
743 751
744 return (use_localhost_requests_ || !IsLocalhost(request.url().host())) && 752 return (use_localhost_requests_ || !IsLocalhost(request.url().host())) &&
745 // Verify that response headers are received, so it can be ensured that 753 // Verify that response headers are received, so it can be ensured that
746 // response is not cached. 754 // response is not cached.
747 !request.response_info().response_time.is_null() && 755 !request.response_info().response_time.is_null() &&
748 !request.was_cached() && 756 !request.was_cached() &&
749 request.creation_time() >= last_connection_change_; 757 request.creation_time() >= last_connection_change_;
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 NotifyObserversOfEffectiveConnectionTypeChanged() { 1480 NotifyObserversOfEffectiveConnectionTypeChanged() {
1473 DCHECK(thread_checker_.CalledOnValidThread()); 1481 DCHECK(thread_checker_.CalledOnValidThread());
1474 1482
1475 // TODO(tbansal): Add hysteresis in the notification. 1483 // TODO(tbansal): Add hysteresis in the notification.
1476 FOR_EACH_OBSERVER( 1484 FOR_EACH_OBSERVER(
1477 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_, 1485 EffectiveConnectionTypeObserver, effective_connection_type_observer_list_,
1478 OnEffectiveConnectionTypeChanged(effective_connection_type_)); 1486 OnEffectiveConnectionTypeChanged(effective_connection_type_));
1479 } 1487 }
1480 1488
1481 } // namespace net 1489 } // namespace net
OLDNEW
« no previous file with comments | « net/nqe/network_quality_estimator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698