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

Unified Diff: chrome/browser/local_discovery/service_discovery_host_client.h

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/service_discovery_host_client.h
diff --git a/chrome/browser/local_discovery/service_discovery_host_client.h b/chrome/browser/local_discovery/service_discovery_host_client.h
index 31f2a091a9f311c9ac504b596bdb05d989d439e8..4d9aaa13b61d40f9b4fad91f44c3222d729a56d8 100644
--- a/chrome/browser/local_discovery/service_discovery_host_client.h
+++ b/chrome/browser/local_discovery/service_discovery_host_client.h
@@ -12,6 +12,7 @@
#include "base/threading/non_thread_safe.h"
#include "chrome/common/local_discovery/service_discovery_client.h"
#include "content/public/browser/utility_process_host_client.h"
+#include "net/base/network_change_notifier.h"
namespace base {
class TaskRunner;
@@ -25,9 +26,11 @@ namespace local_discovery {
// Implementation of ServiceDiscoveryClient that delegates all functionality to
// utility process.
-class ServiceDiscoveryHostClient : public base::NonThreadSafe,
- public ServiceDiscoveryClient,
- public content::UtilityProcessHostClient {
+class ServiceDiscoveryHostClient
+ : public base::NonThreadSafe,
+ public ServiceDiscoveryClient,
+ public content::UtilityProcessHostClient,
+ public net::NetworkChangeNotifier::IPAddressObserver {
public:
ServiceDiscoveryHostClient();
@@ -52,6 +55,9 @@ class ServiceDiscoveryHostClient : public base::NonThreadSafe,
// UtilityProcessHostClient implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ // net::NetworkChangeNotifier::IPAddressObserver implementation.
+ virtual void OnIPAddressChanged() OVERRIDE;
+
protected:
virtual ~ServiceDiscoveryHostClient();
@@ -60,28 +66,32 @@ class ServiceDiscoveryHostClient : public base::NonThreadSafe,
class ServiceResolverProxy;
class LocalDomainResolverProxy;
- typedef std::map<uint64, ServiceWatcher::UpdatedCallback> WatcherCallbacks;
- typedef std::map<uint64, ServiceResolver::ResolveCompleteCallback>
- ResolverCallbacks;
- typedef std::map<uint64, LocalDomainResolver::IPAddressCallback>
- DomainResolverCallbacks;
+ typedef std::map<uint64, ServiceWatcherProxy*> WatcherProxies;
+ typedef std::map<uint64, ServiceResolverProxy*>
Vitaly Buka (NO REVIEWS) 2013/09/06 04:59:27 fits one line
+ ResolverProxies;
+ typedef std::map<uint64, LocalDomainResolverProxy*>
Vitaly Buka (NO REVIEWS) 2013/09/06 04:59:27 maybe fits one line
+ DomainResolverProxies;
void StartOnIOThread();
void ShutdownOnIOThread();
+ void RestartOnIOThread();
+
+ void StartUtilityProcess();
+ void ShutdownUtilityProcess();
void Send(IPC::Message* msg);
void SendOnIOThread(IPC::Message* msg);
- uint64 RegisterWatcherCallback(
- const ServiceWatcher::UpdatedCallback& callback);
- uint64 RegisterResolverCallback(
- const ServiceResolver::ResolveCompleteCallback& callback);
- uint64 RegisterLocalDomainResolverCallback(
- const LocalDomainResolver::IPAddressCallback& callback);
+ uint64 RegisterWatcherProxy(
+ ServiceWatcherProxy* proxy);
+ uint64 RegisterResolverProxy(
Vitaly Buka (NO REVIEWS) 2013/09/06 04:59:27 same
+ ServiceResolverProxy* proxy);
+ uint64 RegisterLocalDomainResolverProxy(
+ LocalDomainResolverProxy* proxy);
- void UnregisterWatcherCallback(uint64 id);
- void UnregisterResolverCallback(uint64 id);
- void UnregisterLocalDomainResolverCallback(uint64 id);
+ void UnregisterWatcherProxy(uint64 id);
+ void UnregisterResolverProxy(uint64 id);
+ void UnregisterLocalDomainResolverProxy(uint64 id);
// IPC Message handlers.
void OnWatcherCallback(uint64 id,
@@ -110,14 +120,13 @@ class ServiceDiscoveryHostClient : public base::NonThreadSafe,
const net::IPAddressNumber& address_ipv4,
const net::IPAddressNumber& address_ipv6);
-
base::WeakPtr<content::UtilityProcessHost> utility_host_;
// Incrementing counter to assign ID to watchers and resolvers.
uint64 current_id_;
- WatcherCallbacks service_watcher_callbacks_;
- ResolverCallbacks service_resolver_callbacks_;
- DomainResolverCallbacks domain_resolver_callbacks_;
+ WatcherProxies service_watcher_proxies_;
+ ResolverProxies service_resolver_proxies_;
+ DomainResolverProxies domain_resolver_proxies_;
scoped_refptr<base::TaskRunner> callback_runner_;
DISALLOW_COPY_AND_ASSIGN(ServiceDiscoveryHostClient);

Powered by Google App Engine
This is Rietveld 408576698