Commit 99290e75 authored by anujk.sharma's avatar anujk.sharma Committed by Commit bot

favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/extensions

BUG=466848

Review URL: https://codereview.chromium.org/1061503008

Cr-Commit-Position: refs/heads/master@{#327444}
parent 83968f9e
......@@ -22,7 +22,7 @@ const char kPrivetDeviceTypeDnsString[] = "\x07_privet";
void GetNetworkListOnFileThread(
const base::Callback<void(const net::NetworkInterfaceList&)> callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
net::NetworkInterfaceList networks;
if (!GetNetworkList(&networks, net::INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES))
return;
......@@ -76,26 +76,26 @@ void PrivetTrafficDetector::Start() {
}
PrivetTrafficDetector::~PrivetTrafficDetector() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
}
void PrivetTrafficDetector::StartOnIOThread() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
ScheduleRestart();
}
void PrivetTrafficDetector::OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
restart_attempts_ = kMaxRestartAttempts;
if (type != net::NetworkChangeNotifier::CONNECTION_NONE)
ScheduleRestart();
}
void PrivetTrafficDetector::ScheduleRestart() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
socket_.reset();
weak_ptr_factory_.InvalidateWeakPtrs();
content::BrowserThread::PostDelayedTask(
......@@ -108,7 +108,7 @@ void PrivetTrafficDetector::ScheduleRestart() {
}
void PrivetTrafficDetector::Restart(const net::NetworkInterfaceList& networks) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
networks_ = networks;
if (Bind() < net::OK || DoLoop(0) < net::OK) {
if ((restart_attempts_--) > 0)
......@@ -125,7 +125,7 @@ int PrivetTrafficDetector::Bind() {
UMA_HISTOGRAM_LONG_TIMES("LocalDiscovery.DetectorRestartTime", time_delta);
}
start_time_ = base::Time::Now();
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
socket_.reset(new net::UDPServerSocket(NULL, net::NetLog::Source()));
net::IPEndPoint multicast_addr = net::GetMDnsIPEndPoint(address_family_);
net::IPAddressNumber address_any(multicast_addr.address().size());
......@@ -170,7 +170,7 @@ bool PrivetTrafficDetector::IsPrivetPacket(int rv) const {
}
int PrivetTrafficDetector::DoLoop(int rv) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
do {
if (IsPrivetPacket(rv)) {
socket_.reset();
......
......@@ -39,7 +39,7 @@ class FileHandlers {
FileHandlers() {}
~FileHandlers() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
}
void Init(base::RefCountedMemory* data);
......@@ -74,7 +74,7 @@ class FileHandlers {
};
void FileHandlers::Init(base::RefCountedMemory* data) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
if (!temp_dir_.CreateUniqueTempDir()) {
return;
......@@ -156,7 +156,7 @@ PwgUtilityProcessHostClient::~PwgUtilityProcessHostClient() {
void PwgUtilityProcessHostClient::Convert(
base::RefCountedMemory* data,
const PWGRasterConverter::ResultCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
callback_ = callback;
CHECK(!files_);
files_.reset(new FileHandlers());
......@@ -186,7 +186,7 @@ bool PwgUtilityProcessHostClient::OnMessageReceived(
}
void PwgUtilityProcessHostClient::OnProcessStarted() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (!utility_process_host_) {
RunCallbackOnUIThread(false);
return;
......@@ -202,17 +202,17 @@ void PwgUtilityProcessHostClient::OnProcessStarted() {
}
void PwgUtilityProcessHostClient::OnSucceeded() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
RunCallback(true);
}
void PwgUtilityProcessHostClient::OnFailed() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
RunCallback(false);
}
void PwgUtilityProcessHostClient::OnFilesReadyOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!files_->IsValid()) {
RunCallbackOnUIThread(false);
return;
......@@ -223,7 +223,7 @@ void PwgUtilityProcessHostClient::OnFilesReadyOnUIThread() {
}
void PwgUtilityProcessHostClient::StartProcessOnIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
utility_process_host_ =
content::UtilityProcessHost::Create(
this,
......@@ -241,7 +241,7 @@ void PwgUtilityProcessHostClient::RunCallback(bool success) {
}
void PwgUtilityProcessHostClient::RunCallbackOnUIThread(bool success) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!callback_.is_null()) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(callback_, success,
......
......@@ -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_);
}
......
......@@ -21,7 +21,7 @@ const int kReportSuccessAfterSeconds = 10;
scoped_ptr<ServiceWatcher> ServiceDiscoveryClientUtility::CreateServiceWatcher(
const std::string& service_type,
const ServiceWatcher::UpdatedCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return host_client_->CreateServiceWatcher(service_type, callback);
}
......@@ -29,7 +29,7 @@ scoped_ptr<ServiceResolver>
ServiceDiscoveryClientUtility::CreateServiceResolver(
const std::string& service_name,
const ServiceResolver::ResolveCompleteCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return host_client_->CreateServiceResolver(service_name, callback);
}
......@@ -38,7 +38,7 @@ ServiceDiscoveryClientUtility::CreateLocalDomainResolver(
const std::string& domain,
net::AddressFamily address_family,
const LocalDomainResolver::IPAddressCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return host_client_->CreateLocalDomainResolver(domain, address_family,
callback);
}
......@@ -46,27 +46,27 @@ ServiceDiscoveryClientUtility::CreateLocalDomainResolver(
ServiceDiscoveryClientUtility::ServiceDiscoveryClientUtility()
: restart_attempts_(kMaxRestartAttempts),
weak_ptr_factory_(this) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
StartNewClient();
}
ServiceDiscoveryClientUtility::~ServiceDiscoveryClientUtility() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
host_client_->Shutdown();
}
void ServiceDiscoveryClientUtility::OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Only network changes resets kMaxRestartAttempts.
restart_attempts_ = kMaxRestartAttempts;
ScheduleStartNewClient();
}
void ServiceDiscoveryClientUtility::ScheduleStartNewClient() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
host_client_->Shutdown();
weak_ptr_factory_.InvalidateWeakPtrs();
base::MessageLoop::current()->PostDelayedTask(
......@@ -77,7 +77,7 @@ void ServiceDiscoveryClientUtility::ScheduleStartNewClient() {
}
void ServiceDiscoveryClientUtility::StartNewClient() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
scoped_refptr<ServiceDiscoveryHostClient> old_client = host_client_;
if ((restart_attempts_--) > 0) {
host_client_ = new ServiceDiscoveryHostClient();
......
......@@ -186,7 +186,7 @@ ServiceDiscoveryHostClient::~ServiceDiscoveryHostClient() {
scoped_ptr<ServiceWatcher> ServiceDiscoveryHostClient::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));
}
......@@ -194,7 +194,7 @@ scoped_ptr<ServiceWatcher> ServiceDiscoveryHostClient::CreateServiceWatcher(
scoped_ptr<ServiceResolver> ServiceDiscoveryHostClient::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));
}
......@@ -204,14 +204,14 @@ ServiceDiscoveryHostClient::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));
}
uint64 ServiceDiscoveryHostClient::RegisterWatcherCallback(
const ServiceWatcher::UpdatedCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!ContainsKey(service_watcher_callbacks_, current_id_ + 1));
service_watcher_callbacks_[++current_id_] = callback;
return current_id_;
......@@ -219,7 +219,7 @@ uint64 ServiceDiscoveryHostClient::RegisterWatcherCallback(
uint64 ServiceDiscoveryHostClient::RegisterResolverCallback(
const ServiceResolver::ResolveCompleteCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!ContainsKey(service_resolver_callbacks_, current_id_ + 1));
service_resolver_callbacks_[++current_id_] = callback;
return current_id_;
......@@ -227,31 +227,31 @@ uint64 ServiceDiscoveryHostClient::RegisterResolverCallback(
uint64 ServiceDiscoveryHostClient::RegisterLocalDomainResolverCallback(
const LocalDomainResolver::IPAddressCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!ContainsKey(domain_resolver_callbacks_, current_id_ + 1));
domain_resolver_callbacks_[++current_id_] = callback;
return current_id_;
}
void ServiceDiscoveryHostClient::UnregisterWatcherCallback(uint64 id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
service_watcher_callbacks_.erase(id);
}
void ServiceDiscoveryHostClient::UnregisterResolverCallback(uint64 id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
service_resolver_callbacks_.erase(id);
}
void ServiceDiscoveryHostClient::UnregisterLocalDomainResolverCallback(
uint64 id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
domain_resolver_callbacks_.erase(id);
}
void ServiceDiscoveryHostClient::Start(
const base::Closure& error_callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!utility_host_);
DCHECK(error_callback_.is_null());
error_callback_ = error_callback;
......@@ -261,7 +261,7 @@ void ServiceDiscoveryHostClient::Start(
}
void ServiceDiscoveryHostClient::Shutdown() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
io_runner_->PostTask(
FROM_HERE,
base::Bind(&ServiceDiscoveryHostClient::ShutdownOnIOThread, this));
......@@ -270,7 +270,7 @@ void ServiceDiscoveryHostClient::Shutdown() {
#if defined(OS_POSIX)
void ServiceDiscoveryHostClient::StartOnIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(!utility_host_);
BrowserThread::PostTaskAndReplyWithResult(
BrowserThread::FILE,
......@@ -280,7 +280,7 @@ void ServiceDiscoveryHostClient::StartOnIOThread() {
}
void ServiceDiscoveryHostClient::OnSocketsReady(const SocketInfoList& sockets) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(!utility_host_);
utility_host_ = UtilityProcessHost::Create(
this, base::MessageLoopProxy::current().get())->AsWeakPtr();
......@@ -302,7 +302,7 @@ void ServiceDiscoveryHostClient::OnSocketsReady(const SocketInfoList& sockets) {
#else // OS_POSIX
void ServiceDiscoveryHostClient::StartOnIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(!utility_host_);
utility_host_ = UtilityProcessHost::Create(
this, base::MessageLoopProxy::current().get())->AsWeakPtr();
......@@ -317,7 +317,7 @@ void ServiceDiscoveryHostClient::StartOnIOThread() {
#endif // OS_POSIX
void ServiceDiscoveryHostClient::ShutdownOnIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (utility_host_) {
utility_host_->Send(new LocalDiscoveryMsg_ShutdownLocalDiscovery);
utility_host_->EndBatchMode();
......@@ -327,14 +327,14 @@ void ServiceDiscoveryHostClient::ShutdownOnIOThread() {
}
void ServiceDiscoveryHostClient::Send(IPC::Message* msg) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
io_runner_->PostTask(
FROM_HERE,
base::Bind(&ServiceDiscoveryHostClient::SendOnIOThread, this, msg));
}
void ServiceDiscoveryHostClient::SendOnIOThread(IPC::Message* msg) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (utility_host_) {
utility_host_->Send(msg);
} else {
......@@ -343,7 +343,7 @@ void ServiceDiscoveryHostClient::SendOnIOThread(IPC::Message* msg) {
}
void ServiceDiscoveryHostClient::OnProcessCrashed(int exit_code) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(!utility_host_);
OnError();
}
......@@ -379,7 +379,7 @@ void ServiceDiscoveryHostClient::InvalidateWatchers() {
}
void ServiceDiscoveryHostClient::OnError() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (!error_callback_.is_null())
callback_runner_->PostTask(FROM_HERE, error_callback_);
}
......@@ -388,7 +388,7 @@ void ServiceDiscoveryHostClient::OnWatcherCallback(
uint64 id,
ServiceWatcher::UpdateType update,
const std::string& service_name) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback_runner_->PostTask(
FROM_HERE,
base::Bind(&ServiceDiscoveryHostClient::RunWatcherCallback, this, id,
......@@ -399,7 +399,7 @@ void ServiceDiscoveryHostClient::OnResolverCallback(
uint64 id,
ServiceResolver::RequestStatus status,
const ServiceDescription& description) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback_runner_->PostTask(
FROM_HERE,
base::Bind(&ServiceDiscoveryHostClient::RunResolverCallback, this, id,
......@@ -411,7 +411,7 @@ void ServiceDiscoveryHostClient::OnLocalDomainResolverCallback(
bool success,
const net::IPAddressNumber& ip_address_ipv4,
const net::IPAddressNumber& ip_address_ipv6) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback_runner_->PostTask(
FROM_HERE,
base::Bind(&ServiceDiscoveryHostClient::RunLocalDomainResolverCallback,
......@@ -422,7 +422,7 @@ void ServiceDiscoveryHostClient::RunWatcherCallback(
uint64 id,
ServiceWatcher::UpdateType update,
const std::string& service_name) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
WatcherCallbacks::iterator it = service_watcher_callbacks_.find(id);
if (it != service_watcher_callbacks_.end() && !it->second.is_null())
it->second.Run(update, service_name);
......@@ -432,7 +432,7 @@ void ServiceDiscoveryHostClient::RunResolverCallback(
uint64 id,
ServiceResolver::RequestStatus status,
const ServiceDescription& description) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
ResolverCallbacks::iterator it = service_resolver_callbacks_.find(id);
if (it != service_resolver_callbacks_.end() && !it->second.is_null())
it->second.Run(status, description);
......@@ -443,7 +443,7 @@ void ServiceDiscoveryHostClient::RunLocalDomainResolverCallback(
bool success,
const net::IPAddressNumber& ip_address_ipv4,
const net::IPAddressNumber& ip_address_ipv6) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DomainResolverCallbacks::iterator it = domain_resolver_callbacks_.find(id);
if (it != domain_resolver_callbacks_.end() && !it->second.is_null())
it->second.Run(success, ip_address_ipv4, ip_address_ipv6);
......
......@@ -75,7 +75,7 @@ ServiceDiscoverySharedClient::~ServiceDiscoverySharedClient() {
scoped_refptr<ServiceDiscoverySharedClient>
ServiceDiscoverySharedClient::GetInstance() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (g_service_discovery_client)
return g_service_discovery_client;
......@@ -104,7 +104,7 @@ void ServiceDiscoverySharedClient::GetInstanceWithoutAlert(
return callback.Run(result);
#else // OS_WIN
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// TODO(vitalybuka): Switch to |ServiceDiscoveryClientMdns| after we find what
// to do with firewall for user-level installs. crbug.com/366408
scoped_refptr<ServiceDiscoverySharedClient> result =
......@@ -132,7 +132,7 @@ void ServiceDiscoverySharedClient::GetInstanceWithoutAlert(
scoped_refptr<ServiceDiscoverySharedClient>
ServiceDiscoverySharedClient::GetInstance() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
NOTIMPLEMENTED();
return NULL;
}
......
......@@ -143,7 +143,7 @@ WifiManagerNonChromeos::WifiServiceWrapper::~WifiServiceWrapper() {
}
void WifiManagerNonChromeos::WifiServiceWrapper::Start() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
wifi_service_.reset(WiFiService::Create());
wifi_service_->Initialize(base::MessageLoopProxy::current());
......@@ -158,7 +158,7 @@ void WifiManagerNonChromeos::WifiServiceWrapper::Start() {
void WifiManagerNonChromeos::WifiServiceWrapper::GetSSIDList(
const WifiManager::SSIDListCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
scoped_ptr<NetworkPropertiesList> ssid_list(new NetworkPropertiesList);
GetSSIDListInternal(ssid_list.get());
......@@ -175,7 +175,7 @@ void WifiManagerNonChromeos::WifiServiceWrapper::ConfigureAndConnectPskNetwork(
const std::string& ssid,
const std::string& password,
const WifiManager::SuccessCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
scoped_ptr<base::DictionaryValue> properties = MakeProperties(ssid, password);
std::string network_guid;
......@@ -201,7 +201,7 @@ void WifiManagerNonChromeos::WifiServiceWrapper::ConfigureAndConnectPskNetwork(
void WifiManagerNonChromeos::WifiServiceWrapper::OnNetworkListChangedEvent(
const std::vector<std::string>& network_guids) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
scoped_ptr<NetworkPropertiesList> ssid_list(new NetworkPropertiesList);
GetSSIDListInternal(ssid_list.get());
callback_runner_->PostTask(
......@@ -213,7 +213,7 @@ void WifiManagerNonChromeos::WifiServiceWrapper::OnNetworkListChangedEvent(
void WifiManagerNonChromeos::WifiServiceWrapper::OnNetworksChangedEvent(
const std::vector<std::string>& network_guids) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
if (connecting_network_guid_.empty() ||
!IsConnected(connecting_network_guid_)) {
return;
......@@ -234,14 +234,14 @@ WifiManagerNonChromeos::WifiServiceWrapper::AsWeakPtr() {
}
void WifiManagerNonChromeos::WifiServiceWrapper::RequestScan() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
wifi_service_->RequestNetworkScan();
}
void WifiManagerNonChromeos::WifiServiceWrapper::ConnectToNetworkByID(
const std::string& network_guid,
const WifiManager::SuccessCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
std::string connected_network_id = GetConnectedGUID();
std::string error_string;
......@@ -295,7 +295,7 @@ void WifiManagerNonChromeos::WifiServiceWrapper::OnConnectToNetworkTimeout() {
void WifiManagerNonChromeos::WifiServiceWrapper::RequestNetworkCredentials(
const std::string& ssid,
const WifiManager::CredentialsCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
bool success = true;
std::string guid;
......@@ -471,7 +471,7 @@ WifiManagerNonChromeos::~WifiManagerNonChromeos() {
}
void WifiManagerNonChromeos::Start() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::FILE);
......@@ -486,7 +486,7 @@ void WifiManagerNonChromeos::Start() {
}
void WifiManagerNonChromeos::GetSSIDList(const SSIDListCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
task_runner_->PostTask(FROM_HERE,
base::Bind(&WifiServiceWrapper::GetSSIDList,
wifi_wrapper_->AsWeakPtr(),
......@@ -494,7 +494,7 @@ void WifiManagerNonChromeos::GetSSIDList(const SSIDListCallback& callback) {
}
void WifiManagerNonChromeos::RequestScan() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
task_runner_->PostTask(
FROM_HERE,
base::Bind(&WifiServiceWrapper::RequestScan, wifi_wrapper_->AsWeakPtr()));
......@@ -502,14 +502,14 @@ void WifiManagerNonChromeos::RequestScan() {
void WifiManagerNonChromeos::OnNetworkListChanged(
scoped_ptr<NetworkPropertiesList> ssid_list) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
FOR_EACH_OBSERVER(NetworkListObserver,
network_list_observers_,
OnNetworkListChanged(*ssid_list));
}
void WifiManagerNonChromeos::PostClosure(const base::Closure& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
callback.Run();
}
......@@ -523,7 +523,7 @@ void WifiManagerNonChromeos::ConfigureAndConnectNetwork(
const std::string& ssid,
const WifiCredentials& credentials,
const SuccessCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
task_runner_->PostTask(
FROM_HERE,
base::Bind(&WifiServiceWrapper::ConfigureAndConnectPskNetwork,
......@@ -536,7 +536,7 @@ void WifiManagerNonChromeos::ConfigureAndConnectNetwork(
void WifiManagerNonChromeos::ConnectToNetworkByID(
const std::string& internal_id,
const SuccessCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
task_runner_->PostTask(FROM_HERE,
base::Bind(&WifiServiceWrapper::ConnectToNetworkByID,
wifi_wrapper_->AsWeakPtr(),
......@@ -547,7 +547,7 @@ void WifiManagerNonChromeos::ConnectToNetworkByID(
void WifiManagerNonChromeos::RequestNetworkCredentials(
const std::string& ssid,
const CredentialsCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
task_runner_->PostTask(
FROM_HERE,
base::Bind(&WifiServiceWrapper::RequestNetworkCredentials,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment