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

Unified Diff: chrome/browser/net/nqe/ui_network_quality_estimator_service.cc

Issue 2172393002: Cleaning up some code in UINQEService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/nqe/ui_network_quality_estimator_service.cc
diff --git a/chrome/browser/net/nqe/ui_network_quality_estimator_service.cc b/chrome/browser/net/nqe/ui_network_quality_estimator_service.cc
index 208f29f67cd85290020618002c42f1b49cf264e2..3378ce3eedb5f6d7b071072f2a4760bdce1c8259 100644
--- a/chrome/browser/net/nqe/ui_network_quality_estimator_service.cc
+++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service.cc
@@ -57,26 +57,29 @@ class UINetworkQualityEstimatorService::IONetworkQualityObserver
service_, type));
}
private:
base::WeakPtr<UINetworkQualityEstimatorService> service_;
net::NetworkQualityEstimator* network_quality_estimator_;
DISALLOW_COPY_AND_ASSIGN(IONetworkQualityObserver);
};
-UINetworkQualityEstimatorService::UINetworkQualityEstimatorService(
- Profile* profile)
+UINetworkQualityEstimatorService::UINetworkQualityEstimatorService()
: type_(net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_UNKNOWN),
io_observer_(nullptr),
weak_factory_(this) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ // If this is running in a context without an IOThread, don't try to create
+ // the IO object.
+ if (!g_browser_process->io_thread())
+ return;
io_observer_ = new IONetworkQualityObserver(weak_factory_.GetWeakPtr());
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&IONetworkQualityObserver::InitializeOnIOThread,
base::Unretained(io_observer_),
g_browser_process->io_thread()));
}
UINetworkQualityEstimatorService::~UINetworkQualityEstimatorService() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

Powered by Google App Engine
This is Rietveld 408576698