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

Unified Diff: chrome/browser/metrics/network_quality_estimator_provider_impl.cc

Issue 2605553002: Add EffectiveConnectionType enum to the system profile proto (Closed)
Patch Set: Rebased Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/metrics/network_quality_estimator_provider_impl.h ('k') | components/metrics/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/network_quality_estimator_provider_impl.cc
diff --git a/chrome/browser/metrics/network_quality_estimator_provider_impl.cc b/chrome/browser/metrics/network_quality_estimator_provider_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..144fa60ea2d55f9ed0f2dfaeef3305f6664ee047
--- /dev/null
+++ b/chrome/browser/metrics/network_quality_estimator_provider_impl.cc
@@ -0,0 +1,42 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/metrics/network_quality_estimator_provider_impl.h"
+
+#include "chrome/browser/io_thread.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace net {
+class NetworkQualityEstimator;
+}
+
+namespace metrics {
+
+NetworkQualityEstimatorProviderImpl::NetworkQualityEstimatorProviderImpl(
+ IOThread* io_thread)
+ : io_thread_(io_thread) {
+ DCHECK(io_thread_);
+}
+
+NetworkQualityEstimatorProviderImpl::~NetworkQualityEstimatorProviderImpl() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+}
+
+scoped_refptr<base::SequencedTaskRunner>
+NetworkQualityEstimatorProviderImpl::GetTaskRunner() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ // |this| is constructed on UI thread, but must be used on the IO thread.
+ thread_checker_.DetachFromThread();
+ return content::BrowserThread::GetTaskRunnerForThread(
+ content::BrowserThread::IO);
+}
+
+net::NetworkQualityEstimator*
+NetworkQualityEstimatorProviderImpl::GetNetworkQualityEstimator() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ return io_thread_->globals()->network_quality_estimator.get();
+}
+
+} // namespace metrics
« no previous file with comments | « chrome/browser/metrics/network_quality_estimator_provider_impl.h ('k') | components/metrics/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698