Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Unified Diff: chrome/browser/local_discovery/privet_device_lister_impl.cc

Issue 23851008: Added cache flush on network change to ServiceDiscoveryHostClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/local_discovery/privet_device_lister_impl.cc
diff --git a/chrome/browser/local_discovery/privet_device_lister_impl.cc b/chrome/browser/local_discovery/privet_device_lister_impl.cc
index 1d4e4d706f4b856ae6f895bf00c02a26532c5b9a..cf153a41bfba1151785936979cb4ed5df93f9cce 100644
--- a/chrome/browser/local_discovery/privet_device_lister_impl.cc
+++ b/chrome/browser/local_discovery/privet_device_lister_impl.cc
@@ -37,12 +37,7 @@ PrivetDeviceListerImpl::~PrivetDeviceListerImpl() {
}
void PrivetDeviceListerImpl::Start() {
- service_watcher_ =
- service_discovery_client_->CreateServiceWatcher(
- service_type_,
- base::Bind(&PrivetDeviceListerImpl::OnServiceUpdated,
- base::Unretained(this)));
- service_watcher_->Start();
+ CreateServiceWatcher();
}
void PrivetDeviceListerImpl::DiscoverNewDevices(bool force_update) {
@@ -52,6 +47,14 @@ void PrivetDeviceListerImpl::DiscoverNewDevices(bool force_update) {
void PrivetDeviceListerImpl::OnServiceUpdated(
ServiceWatcher::UpdateType update,
const std::string& service_name) {
+ if (update == ServiceWatcher::UPDATE_INVALIDATED) {
+ resolvers_.clear();
+ CreateServiceWatcher();
+
+ delegate_->DeviceCacheFlushed();
+ return;
+ }
+
if (update != ServiceWatcher::UPDATE_REMOVED) {
bool added = (update == ServiceWatcher::UPDATE_ADDED);
std::pair<ServiceResolverMap::iterator, bool> insert_result =
@@ -143,4 +146,14 @@ PrivetDeviceListerImpl::ConnectionStateFromString(const std::string& str) {
return DeviceDescription::UNKNOWN;
}
+void PrivetDeviceListerImpl::CreateServiceWatcher() {
+ service_watcher_ =
+ service_discovery_client_->CreateServiceWatcher(
+ service_type_,
+ base::Bind(&PrivetDeviceListerImpl::OnServiceUpdated,
+ base::Unretained(this)));
+ service_watcher_->Start();
+
+}
+
} // namespace local_discovery

Powered by Google App Engine
This is Rietveld 408576698