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

Unified Diff: chrome/browser/local_discovery/service_discovery_client_mdns.cc

Issue 1061503008: [chrome/browser/local_discovery] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/local_discovery/service_discovery_client_mdns.cc
diff --git a/chrome/browser/local_discovery/service_discovery_client_mdns.cc b/chrome/browser/local_discovery/service_discovery_client_mdns.cc
index fbd077f91ca88f0dcb33ce184e42a0ff3191f93a..3a18dd85435e262b2e2288d8796b3d0a49f940c2 100644
--- a/chrome/browser/local_discovery/service_discovery_client_mdns.cc
+++ b/chrome/browser/local_discovery/service_discovery_client_mdns.cc
@@ -24,12 +24,12 @@ class ServiceDiscoveryClientMdns::Proxy {
explicit Proxy(ServiceDiscoveryClientMdns* client)
: client_(client),
weak_ptr_factory_(this) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
client_->proxies_.AddObserver(this);
}
virtual ~Proxy() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
client_->proxies_.RemoveObserver(this);
}
@@ -52,7 +52,7 @@ class ServiceDiscoveryClientMdns::Proxy {
// Runs callback using this method to abort callback if instance of |Proxy|
// is deleted.
void RunCallback(const base::Closure& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
callback.Run();
}
@@ -318,7 +318,7 @@ ServiceDiscoveryClientMdns::ServiceDiscoveryClientMdns()
restart_attempts_(0),
need_dalay_mdns_tasks_(true),
weak_ptr_factory_(this) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
StartNewClient();
}
@@ -326,7 +326,7 @@ ServiceDiscoveryClientMdns::ServiceDiscoveryClientMdns()
scoped_ptr<ServiceWatcher> ServiceDiscoveryClientMdns::CreateServiceWatcher(
const std::string& service_type,
const ServiceWatcher::UpdatedCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
return scoped_ptr<ServiceWatcher>(
new ServiceWatcherProxy(this, service_type, callback));
}
@@ -334,7 +334,7 @@ scoped_ptr<ServiceWatcher> ServiceDiscoveryClientMdns::CreateServiceWatcher(
scoped_ptr<ServiceResolver> ServiceDiscoveryClientMdns::CreateServiceResolver(
const std::string& service_name,
const ServiceResolver::ResolveCompleteCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
return scoped_ptr<ServiceResolver>(
new ServiceResolverProxy(this, service_name, callback));
}
@@ -344,27 +344,27 @@ ServiceDiscoveryClientMdns::CreateLocalDomainResolver(
const std::string& domain,
net::AddressFamily address_family,
const LocalDomainResolver::IPAddressCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
return scoped_ptr<LocalDomainResolver>(
new LocalDomainResolverProxy(this, domain, address_family, callback));
}
ServiceDiscoveryClientMdns::~ServiceDiscoveryClientMdns() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
DestroyMdns();
}
void ServiceDiscoveryClientMdns::OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Only network changes resets counter.
restart_attempts_ = 0;
ScheduleStartNewClient();
}
void ServiceDiscoveryClientMdns::ScheduleStartNewClient() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
OnBeforeMdnsDestroy();
if (restart_attempts_ < kMaxRestartAttempts) {
base::MessageLoop::current()->PostDelayedTask(
@@ -379,7 +379,7 @@ void ServiceDiscoveryClientMdns::ScheduleStartNewClient() {
}
void ServiceDiscoveryClientMdns::StartNewClient() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
++restart_attempts_;
DestroyMdns();
mdns_.reset(net::MDnsClient::CreateDefault().release());
@@ -404,7 +404,7 @@ void ServiceDiscoveryClientMdns::OnInterfaceListReady(
}
void ServiceDiscoveryClientMdns::OnMdnsInitialized(bool success) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!success) {
ScheduleStartNewClient();
return;
@@ -417,7 +417,7 @@ void ServiceDiscoveryClientMdns::OnMdnsInitialized(bool success) {
}
void ServiceDiscoveryClientMdns::ReportSuccess() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
UMA_HISTOGRAM_COUNTS_100("LocalDiscovery.ClientRestartAttempts",
restart_attempts_);
}

Powered by Google App Engine
This is Rietveld 408576698