Fixed formating and added io_runner_.

TBR=noamsml

Review URL: https://chromiumcodereview.appspot.com/23707040

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223273 0039d316-1c4b-4281-b951-d872f2087c98
parent e9a82042
...@@ -44,8 +44,7 @@ class ServiceDiscoveryHostClient::ServiceWatcherProxy : public ServiceWatcher { ...@@ -44,8 +44,7 @@ class ServiceDiscoveryHostClient::ServiceWatcherProxy : public ServiceWatcher {
} }
virtual void DiscoverNewServices(bool force_update) OVERRIDE { virtual void DiscoverNewServices(bool force_update) OVERRIDE {
DVLOG(1) << "ServiceWatcher::DiscoverNewServices with id " DVLOG(1) << "ServiceWatcher::DiscoverNewServices with id " << id_;
<< id_;
DCHECK(started_); DCHECK(started_);
host_->Send(new LocalDiscoveryMsg_DiscoverServices(id_, force_update)); host_->Send(new LocalDiscoveryMsg_DiscoverServices(id_, force_update));
} }
...@@ -81,9 +80,7 @@ class ServiceDiscoveryHostClient::ServiceResolverProxy ...@@ -81,9 +80,7 @@ class ServiceDiscoveryHostClient::ServiceResolverProxy
} }
virtual void StartResolving() OVERRIDE { virtual void StartResolving() OVERRIDE {
DVLOG(1) DVLOG(1) << "ServiceResolverProxy::StartResolving with id " << id_;
<< "ServiceResolverProxy::StartResolving with id "
<< id_;
DCHECK(!started_); DCHECK(!started_);
host_->Send(new LocalDiscoveryMsg_ResolveService(id_, service_name_)); host_->Send(new LocalDiscoveryMsg_ResolveService(id_, service_name_));
started_ = true; started_ = true;
...@@ -115,16 +112,14 @@ class ServiceDiscoveryHostClient::LocalDomainResolverProxy ...@@ -115,16 +112,14 @@ class ServiceDiscoveryHostClient::LocalDomainResolverProxy
} }
virtual ~LocalDomainResolverProxy() { virtual ~LocalDomainResolverProxy() {
DVLOG(1) << "~LocalDomainResolverProxy with id " DVLOG(1) << "~LocalDomainResolverProxy with id " << id_;
<< id_;
host_->UnregisterLocalDomainResolverCallback(id_); host_->UnregisterLocalDomainResolverCallback(id_);
if (started_) if (started_)
host_->Send(new LocalDiscoveryMsg_DestroyLocalDomainResolver(id_)); host_->Send(new LocalDiscoveryMsg_DestroyLocalDomainResolver(id_));
} }
virtual void Start() OVERRIDE { virtual void Start() OVERRIDE {
DVLOG(1) << "LocalDomainResolverProxy::Start with id " DVLOG(1) << "LocalDomainResolverProxy::Start with id " << id_;
<< id_;
DCHECK(!started_); DCHECK(!started_);
host_->Send(new LocalDiscoveryMsg_ResolveLocalDomain(id_, domain_, host_->Send(new LocalDiscoveryMsg_ResolveLocalDomain(id_, domain_,
address_family_)); address_family_));
...@@ -141,6 +136,7 @@ class ServiceDiscoveryHostClient::LocalDomainResolverProxy ...@@ -141,6 +136,7 @@ class ServiceDiscoveryHostClient::LocalDomainResolverProxy
ServiceDiscoveryHostClient::ServiceDiscoveryHostClient() : current_id_(0) { ServiceDiscoveryHostClient::ServiceDiscoveryHostClient() : current_id_(0) {
callback_runner_ = base::MessageLoop::current()->message_loop_proxy(); callback_runner_ = base::MessageLoop::current()->message_loop_proxy();
io_runner_ = BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
} }
ServiceDiscoveryHostClient::~ServiceDiscoveryHostClient() { ServiceDiscoveryHostClient::~ServiceDiscoveryHostClient() {
...@@ -221,8 +217,7 @@ void ServiceDiscoveryHostClient::UnregisterLocalDomainResolverCallback( ...@@ -221,8 +217,7 @@ void ServiceDiscoveryHostClient::UnregisterLocalDomainResolverCallback(
void ServiceDiscoveryHostClient::Start() { void ServiceDiscoveryHostClient::Start() {
DCHECK(CalledOnValidThread()); DCHECK(CalledOnValidThread());
net::NetworkChangeNotifier::AddIPAddressObserver(this); net::NetworkChangeNotifier::AddIPAddressObserver(this);
BrowserThread::PostTask( io_runner_->PostTask(
BrowserThread::IO,
FROM_HERE, FROM_HERE,
base::Bind(&ServiceDiscoveryHostClient::StartOnIOThread, this)); base::Bind(&ServiceDiscoveryHostClient::StartOnIOThread, this));
} }
...@@ -230,8 +225,7 @@ void ServiceDiscoveryHostClient::Start() { ...@@ -230,8 +225,7 @@ void ServiceDiscoveryHostClient::Start() {
void ServiceDiscoveryHostClient::Shutdown() { void ServiceDiscoveryHostClient::Shutdown() {
net::NetworkChangeNotifier::RemoveIPAddressObserver(this); net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
DCHECK(CalledOnValidThread()); DCHECK(CalledOnValidThread());
BrowserThread::PostTask( io_runner_->PostTask(
BrowserThread::IO,
FROM_HERE, FROM_HERE,
base::Bind(&ServiceDiscoveryHostClient::ShutdownOnIOThread, this)); base::Bind(&ServiceDiscoveryHostClient::ShutdownOnIOThread, this));
} }
...@@ -279,8 +273,7 @@ void ServiceDiscoveryHostClient::RestartOnIOThread() { ...@@ -279,8 +273,7 @@ void ServiceDiscoveryHostClient::RestartOnIOThread() {
void ServiceDiscoveryHostClient::Send(IPC::Message* msg) { void ServiceDiscoveryHostClient::Send(IPC::Message* msg) {
DCHECK(CalledOnValidThread()); DCHECK(CalledOnValidThread());
BrowserThread::PostTask( io_runner_->PostTask(
BrowserThread::IO,
FROM_HERE, FROM_HERE,
base::Bind(&ServiceDiscoveryHostClient::SendOnIOThread, this, msg)); base::Bind(&ServiceDiscoveryHostClient::SendOnIOThread, this, msg));
} }
...@@ -292,8 +285,7 @@ void ServiceDiscoveryHostClient::SendOnIOThread(IPC::Message* msg) { ...@@ -292,8 +285,7 @@ void ServiceDiscoveryHostClient::SendOnIOThread(IPC::Message* msg) {
} }
void ServiceDiscoveryHostClient::OnIPAddressChanged() { void ServiceDiscoveryHostClient::OnIPAddressChanged() {
BrowserThread::PostTask( io_runner_->PostTask(
BrowserThread::IO,
FROM_HERE, FROM_HERE,
base::Bind(&ServiceDiscoveryHostClient::RestartOnIOThread, this)); base::Bind(&ServiceDiscoveryHostClient::RestartOnIOThread, this));
......
...@@ -126,6 +126,7 @@ class ServiceDiscoveryHostClient ...@@ -126,6 +126,7 @@ class ServiceDiscoveryHostClient
ResolverCallbacks service_resolver_callbacks_; ResolverCallbacks service_resolver_callbacks_;
DomainResolverCallbacks domain_resolver_callbacks_; DomainResolverCallbacks domain_resolver_callbacks_;
scoped_refptr<base::TaskRunner> callback_runner_; scoped_refptr<base::TaskRunner> callback_runner_;
scoped_refptr<base::TaskRunner> io_runner_;
DISALLOW_COPY_AND_ASSIGN(ServiceDiscoveryHostClient); DISALLOW_COPY_AND_ASSIGN(ServiceDiscoveryHostClient);
}; };
......
...@@ -396,8 +396,7 @@ void ServiceDiscoveryMessageHandler::OnServiceUpdated( ...@@ -396,8 +396,7 @@ void ServiceDiscoveryMessageHandler::OnServiceUpdated(
uint64 id, uint64 id,
ServiceWatcher::UpdateType update, ServiceWatcher::UpdateType update,
const std::string& name) { const std::string& name) {
VLOG(1) << "OnServiceUpdated with id " << id VLOG(1) << "OnServiceUpdated with id " << id << WatcherUpdateToString(update);
<< WatcherUpdateToString(update);
DCHECK(service_discovery_client_); DCHECK(service_discovery_client_);
utility_task_runner_->PostTask(FROM_HERE, utility_task_runner_->PostTask(FROM_HERE,
base::Bind(&SendServiceUpdated, id, update, name)); base::Bind(&SendServiceUpdated, id, update, name));
......
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