| Index: chrome/browser/local_discovery/service_discovery_device_lister.cc
|
| diff --git a/chrome/browser/local_discovery/service_discovery_device_lister.cc b/chrome/browser/local_discovery/service_discovery_device_lister.cc
|
| index 0d906459a1502de01fa43126fdbad320dd4846b0..60fb8a62258b778d8183b4be55602b42653858b8 100644
|
| --- a/chrome/browser/local_discovery/service_discovery_device_lister.cc
|
| +++ b/chrome/browser/local_discovery/service_discovery_device_lister.cc
|
| @@ -32,17 +32,22 @@ ServiceDiscoveryDeviceLister::~ServiceDiscoveryDeviceLister() {
|
| }
|
|
|
| void ServiceDiscoveryDeviceLister::Start() {
|
| + VLOG(1) << "In Start(), service_type: " << service_type_;
|
| CreateServiceWatcher();
|
| }
|
|
|
| void ServiceDiscoveryDeviceLister::DiscoverNewDevices(bool force_update) {
|
| + VLOG(1) << "In DiscoverNewDevices(), service_type: " << service_type_;
|
| service_watcher_->DiscoverNewServices(force_update);
|
| }
|
|
|
| void ServiceDiscoveryDeviceLister::OnServiceUpdated(
|
| ServiceWatcher::UpdateType update,
|
| const std::string& service_name) {
|
| + VLOG(1) << "In OnServiceUpdated(), service_type: " << service_type_
|
| + << "service_name: " << service_name;
|
| if (update == ServiceWatcher::UPDATE_INVALIDATED) {
|
| + VLOG(1) << "Update = invalidate, flushing device cache";
|
| resolvers_.clear();
|
| CreateServiceWatcher();
|
|
|
| @@ -52,12 +57,14 @@ void ServiceDiscoveryDeviceLister::OnServiceUpdated(
|
|
|
| if (update != ServiceWatcher::UPDATE_REMOVED) {
|
| bool added = (update == ServiceWatcher::UPDATE_ADDED);
|
| + VLOG(1) << "Update type: " << update << ", added: " << added;
|
| std::pair<ServiceResolverMap::iterator, bool> insert_result =
|
| resolvers_.insert(make_pair(service_name,
|
| linked_ptr<ServiceResolver>(NULL)));
|
|
|
| // If there is already a resolver working on this service, don't add one.
|
| if (insert_result.second) {
|
| + VLOG(1) << "Adding resolver for service_name: " << service_name;
|
| scoped_ptr<ServiceResolver> resolver =
|
| service_discovery_client_->CreateServiceResolver(
|
| service_name, base::Bind(
|
| @@ -68,8 +75,13 @@ void ServiceDiscoveryDeviceLister::OnServiceUpdated(
|
|
|
| insert_result.first->second.reset(resolver.release());
|
| insert_result.first->second->StartResolving();
|
| + } else {
|
| + VLOG(1) << "Resolver for service_name already exists, ignoring: "
|
| + << service_name;
|
| }
|
| } else {
|
| + // TODO(imcheng): Why doesn't this do a resolvers_.erase(service_name); ?
|
| + VLOG(1) << "Update = remove, service_name: " << service_name;
|
| delegate_->OnDeviceRemoved(service_name);
|
| }
|
| }
|
| @@ -80,7 +92,10 @@ void ServiceDiscoveryDeviceLister::OnResolveComplete(
|
| std::string service_name,
|
| ServiceResolver::RequestStatus status,
|
| const ServiceDescription& service_description) {
|
| + VLOG(1) << "In OnResolveComplete(), service_type: " << service_type_
|
| + << "service_name: " << service_name;
|
| if (status == ServiceResolver::STATUS_SUCCESS) {
|
| + VLOG(1) << "Resolve was successful, calling OnDeviceChanged()";
|
| delegate_->OnDeviceChanged(added, service_description);
|
|
|
| #if defined(OS_MACOSX)
|
| @@ -97,6 +112,7 @@ void ServiceDiscoveryDeviceLister::OnResolveComplete(
|
| #endif
|
| } else {
|
| // TODO(noamsml): Add retry logic.
|
| + VLOG(1) << "Resolve was unsuccessful, status: " << status;
|
| }
|
| resolvers_.erase(service_name);
|
| }
|
|
|