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

Side by Side Diff: content/browser/net/network_quality_observer_impl.cc

Issue 2927453002: Make NQE a derived class of NetworkQualityProvider (Closed)
Patch Set: some more IWYU fixes 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "content/browser/net/network_quality_observer_impl.h" 5 #include "content/browser/net/network_quality_observer_impl.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
13 #include "content/public/browser/notification_service.h" 13 #include "content/public/browser/notification_service.h"
14 #include "content/public/browser/notification_types.h" 14 #include "content/public/browser/notification_types.h"
15 #include "content/public/browser/render_process_host.h" 15 #include "content/public/browser/render_process_host.h"
16 #include "net/nqe/network_quality_estimator.h"
16 17
17 namespace { 18 namespace {
18 19
19 // Returns true if the |current_value| is meaningfully different from the 20 // Returns true if the |current_value| is meaningfully different from the
20 // |past_value|. 21 // |past_value|.
21 bool MetricChangedMeaningfully(int32_t past_value, int32_t current_value) { 22 bool MetricChangedMeaningfully(int32_t past_value, int32_t current_value) {
22 if ((past_value == net::nqe::internal::INVALID_RTT_THROUGHPUT) != 23 if ((past_value == net::nqe::internal::INVALID_RTT_THROUGHPUT) !=
23 (current_value == net::nqe::internal::INVALID_RTT_THROUGHPUT)) { 24 (current_value == net::nqe::internal::INVALID_RTT_THROUGHPUT)) {
24 return true; 25 return true;
25 } 26 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 last_notified_network_quality_ = net::nqe::internal::NetworkQuality( 207 last_notified_network_quality_ = net::nqe::internal::NetworkQuality(
207 http_rtt, transport_rtt, downstream_throughput_kbps); 208 http_rtt, transport_rtt, downstream_throughput_kbps);
208 209
209 BrowserThread::PostTask( 210 BrowserThread::PostTask(
210 BrowserThread::UI, FROM_HERE, 211 BrowserThread::UI, FROM_HERE,
211 base::BindOnce(&UiThreadObserver::OnRTTOrThroughputEstimatesComputed, 212 base::BindOnce(&UiThreadObserver::OnRTTOrThroughputEstimatesComputed,
212 base::Unretained(ui_thread_observer_.get()), 213 base::Unretained(ui_thread_observer_.get()),
213 last_notified_network_quality_)); 214 last_notified_network_quality_));
214 } 215 }
215 216
216 std::unique_ptr<net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver> 217 std::unique_ptr<net::RTTAndThroughputEstimatesObserver>
217 CreateNetworkQualityObserver( 218 CreateNetworkQualityObserver(
218 net::NetworkQualityEstimator* network_quality_estimator) { 219 net::NetworkQualityEstimator* network_quality_estimator) {
219 return base::MakeUnique<NetworkQualityObserverImpl>( 220 return base::MakeUnique<NetworkQualityObserverImpl>(
220 network_quality_estimator); 221 network_quality_estimator);
221 } 222 }
222 223
223 } // namespace content 224 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/net/network_quality_observer_impl.h ('k') | content/public/browser/network_quality_observer_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698