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