Chromium Code Reviews| Index: chrome/browser/extensions/api/mdns/dns_sd_registry.cc |
| diff --git a/chrome/browser/extensions/api/mdns/dns_sd_registry.cc b/chrome/browser/extensions/api/mdns/dns_sd_registry.cc |
| index 78a68954a22f523615d43ccb7c17cf39ca30d5f0..2801cabd5dbc62a164e93a1bfca3ad7fed015c93 100644 |
| --- a/chrome/browser/extensions/api/mdns/dns_sd_registry.cc |
| +++ b/chrome/browser/extensions/api/mdns/dns_sd_registry.cc |
| @@ -53,6 +53,9 @@ bool DnsSdRegistry::ServiceTypeData::UpdateService( |
| IsSameServiceName(service)); |
| // Set to true when a service is updated in or added to the registry. |
| bool updated_or_added = added; |
| + VLOG(1) << "UpdateService: " << service.service_name |
| + << ", added: " << added |
| + << ", known: " << (it != service_list_.end()); |
| if (it != service_list_.end()) { |
| // If added == true, but we still found the service in our cache, then just |
| // update the existing entry, but this should not happen! |
| @@ -64,6 +67,9 @@ bool DnsSdRegistry::ServiceTypeData::UpdateService( |
| } else if (added) { |
| service_list_.push_back(service); |
| } |
| + |
| + VLOG(1) << "Updated or added service: " << service.service_name << "? : " |
|
Vitaly Buka (NO REVIEWS)
2014/01/15 23:08:51
function never returns between logs, wot can combi
imcheng
2014/01/15 23:30:18
Done.
|
| + << updated_or_added; |
| return updated_or_added; |
| }; |
| @@ -120,6 +126,8 @@ DnsSdDeviceLister* DnsSdRegistry::CreateDnsSdDeviceLister( |
| } |
| void DnsSdRegistry::RegisterDnsSdListener(std::string service_type) { |
| + VLOG(1) << "RegisterDnsSdListener: " << service_type |
| + << ", registered: " << IsRegistered(service_type); |
|
Vitaly Buka (NO REVIEWS)
2014/01/15 23:08:51
missalinged
|
| if (service_type.empty()) |
| return; |
| @@ -139,6 +147,7 @@ void DnsSdRegistry::RegisterDnsSdListener(std::string service_type) { |
| } |
| void DnsSdRegistry::UnregisterDnsSdListener(std::string service_type) { |
| + VLOG(1) << "UnregisterDnsSdListener: " << service_type; |
| DnsSdRegistry::DnsSdServiceTypeDataMap::iterator it = |
| service_data_map_.find(service_type); |
| if (it == service_data_map_.end()) |
| @@ -151,11 +160,18 @@ void DnsSdRegistry::UnregisterDnsSdListener(std::string service_type) { |
| void DnsSdRegistry::ServiceChanged(const std::string& service_type, |
| bool added, |
| const DnsSdService& service) { |
| - if (!IsRegistered(service_type)) |
| + VLOG(1) << "ServiceChanged: service_type: " << service_type |
| + << ", known: " << IsRegistered(service_type) |
| + << ", service: " << service.service_name |
| + << ", added: " << added; |
|
Vitaly Buka (NO REVIEWS)
2014/01/15 23:08:51
missaligned
imcheng
2014/01/15 23:30:18
Done.
|
| + if (!IsRegistered(service_type)) { |
| return; |
| + } |
| VLOG(1) << "Service changed: " << service.service_name; |
|
Vitaly Buka (NO REVIEWS)
2014/01/15 23:08:51
dont need line 171
imcheng
2014/01/15 23:30:18
Done.
|
| if (service_data_map_[service_type]->UpdateService(added, service)) { |
| + VLOG(1) << "Updated service and dispatching event for service type: " |
| + << service_type; |
|
Vitaly Buka (NO REVIEWS)
2014/01/15 23:08:51
missaligned
imcheng
2014/01/15 23:30:18
Done.
|
| DispatchApiEvent(service_type); |
| } else { |
| VLOG(1) << "Failed to find existing service to update: " |
| @@ -165,11 +181,16 @@ void DnsSdRegistry::ServiceChanged(const std::string& service_type, |
| void DnsSdRegistry::ServiceRemoved(const std::string& service_type, |
| const std::string& service_name) { |
| - if (!IsRegistered(service_type)) |
| + VLOG(1) << "ServiceRemoved: service_type: " << service_type |
| + << "known: " << IsRegistered(service_type) |
|
Vitaly Buka (NO REVIEWS)
2014/01/15 23:08:51
", known:...
imcheng
2014/01/15 23:30:18
Done.
|
| + << ", service: " << service_name; |
| + if (!IsRegistered(service_type)) { |
| return; |
| + } |
| - VLOG(1) << "Removing service: " << service_name; |
| if (service_data_map_[service_type]->RemoveService(service_name)) { |
|
Vitaly Buka (NO REVIEWS)
2014/01/15 23:08:51
bool is_removed = service_data_map_[service_type]-
imcheng
2014/01/15 23:30:18
Done.
|
| + VLOG(1) << "Removed service and dispatching event for service type: " |
| + << service_type; |
|
Vitaly Buka (NO REVIEWS)
2014/01/15 23:08:51
missaligned
imcheng
2014/01/15 23:30:18
Done.
|
| DispatchApiEvent(service_type); |
| } else { |
| VLOG(1) << "Failed to remove service: " << service_name; |
| @@ -177,16 +198,25 @@ void DnsSdRegistry::ServiceRemoved(const std::string& service_type, |
| } |
| void DnsSdRegistry::ServicesFlushed(const std::string& service_type) { |
| - if (!IsRegistered(service_type)) |
| + VLOG(1) << "ServicesFlushed: service_type: " << service_type |
| + << ", known: " << IsRegistered(service_type); |
|
Vitaly Buka (NO REVIEWS)
2014/01/15 23:08:51
missaligned
imcheng
2014/01/15 23:30:18
Done.
|
| + if (!IsRegistered(service_type)) { |
| return; |
| + } |
| - if (service_data_map_[service_type]->ClearServices()) |
| + if (service_data_map_[service_type]->ClearServices()) { |
| + VLOG(1) << "Cleared services and dispatching event for service type: " |
|
Vitaly Buka (NO REVIEWS)
2014/01/15 23:08:51
same
imcheng
2014/01/15 23:30:18
Done.
|
| + << service_type; |
| DispatchApiEvent(service_type); |
| + } else { |
| + VLOG(1) << "Failed to clear services for service type: " << service_type; |
| + } |
| } |
| void DnsSdRegistry::DispatchApiEvent(const std::string& service_type) { |
| // TODO(justinlin): Make this MaybeDispatchApiEvent instead and dispatch if a |
| // dirty bit is set. |
| + VLOG(1) << "DispatchApiEvent: service_type: " << service_type; |
| FOR_EACH_OBSERVER(DnsSdObserver, observers_, OnDnsSdEvent( |
| service_type, service_data_map_[service_type]->GetServiceList())); |
| } |