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

Unified Diff: chromecast/net/connectivity_checker.cc

Issue 1142513004: Chromecast: MessageLoopProxy cleanup --> SingleThreadTaskRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromecast/net/connectivity_checker.h ('k') | chromecast/renderer/cast_content_renderer_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/net/connectivity_checker.cc
diff --git a/chromecast/net/connectivity_checker.cc b/chromecast/net/connectivity_checker.cc
index 95c4a57cd01306ff411cf039cbc614f7186f765f..73aeebfe37c50dfa1d68e4cddf9ec4bf700d6af9 100644
--- a/chromecast/net/connectivity_checker.cc
+++ b/chromecast/net/connectivity_checker.cc
@@ -35,15 +35,15 @@ const char kDefaultConnectivityCheckUrl[] =
} // namespace
ConnectivityChecker::ConnectivityChecker(
- const scoped_refptr<base::MessageLoopProxy>& loop_proxy)
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
: connectivity_observer_list_(
new ObserverListThreadSafe<ConnectivityObserver>()),
- loop_proxy_(loop_proxy),
+ task_runner_(task_runner),
connected_(false),
check_errors_(0) {
- DCHECK(loop_proxy_.get());
- loop_proxy->PostTask(FROM_HERE,
- base::Bind(&ConnectivityChecker::Initialize, this));
+ DCHECK(task_runner_.get());
+ task_runner->PostTask(FROM_HERE,
+ base::Bind(&ConnectivityChecker::Initialize, this));
}
void ConnectivityChecker::Initialize() {
@@ -61,16 +61,16 @@ void ConnectivityChecker::Initialize() {
net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
net::NetworkChangeNotifier::AddIPAddressObserver(this);
- loop_proxy_->PostTask(FROM_HERE,
- base::Bind(&ConnectivityChecker::Check, this));
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&ConnectivityChecker::Check, this));
}
ConnectivityChecker::~ConnectivityChecker() {
- DCHECK(loop_proxy_.get());
+ DCHECK(task_runner_.get());
net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
- loop_proxy_->DeleteSoon(FROM_HERE, url_request_context_.release());
- loop_proxy_->DeleteSoon(FROM_HERE, url_request_.release());
+ task_runner_->DeleteSoon(FROM_HERE, url_request_context_.release());
+ task_runner_->DeleteSoon(FROM_HERE, url_request_.release());
}
void ConnectivityChecker::AddConnectivityObserver(
@@ -98,9 +98,9 @@ void ConnectivityChecker::SetConnectivity(bool connected) {
}
void ConnectivityChecker::Check() {
- if (!loop_proxy_->BelongsToCurrentThread()) {
- loop_proxy_->PostTask(FROM_HERE,
- base::Bind(&ConnectivityChecker::Check, this));
+ if (!task_runner_->BelongsToCurrentThread()) {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&ConnectivityChecker::Check, this));
return;
}
DCHECK(url_request_context_.get());
@@ -174,7 +174,7 @@ void ConnectivityChecker::OnUrlRequestError() {
}
url_request_.reset(NULL);
// Check again.
- loop_proxy_->PostDelayedTask(
+ task_runner_->PostDelayedTask(
FROM_HERE, base::Bind(&ConnectivityChecker::Check, this),
base::TimeDelta::FromSeconds(kConnectivityPeriodSeconds));
}
« no previous file with comments | « chromecast/net/connectivity_checker.h ('k') | chromecast/renderer/cast_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698