summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 19:16:33 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 19:16:33 +0000
commita78f42738deb2e86f162657fdab4f459df06850f (patch)
treeb29f3af90bc122da7b1edd7be5246f84a11ba2f2
parent75c1a96f8b62f01f6e6071827606546a87ac5163 (diff)
downloadchromium_src-a78f42738deb2e86f162657fdab4f459df06850f.zip
chromium_src-a78f42738deb2e86f162657fdab4f459df06850f.tar.gz
chromium_src-a78f42738deb2e86f162657fdab4f459df06850f.tar.bz2
Refactor: Remove HostResolver::GetAsHostResolverImpl()
The only remaining place this was used was to start the IPv6 probe. That's moved to a function on the interface which is a no-op for most resolvers. Review URL: http://codereview.chromium.org/8364009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106753 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/io_thread.cc7
-rw-r--r--net/base/host_resolver.cc3
-rw-r--r--net/base/host_resolver.h10
-rw-r--r--net/base/host_resolver_impl.cc14
-rw-r--r--net/base/host_resolver_impl.h9
-rw-r--r--net/base/mapped_host_resolver.cc4
-rw-r--r--net/base/mapped_host_resolver.h2
7 files changed, 14 insertions, 35 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 4c7a6a2..343750d 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -189,12 +189,7 @@ net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) {
if (command_line.HasSwitch(switches::kDisableIPv6)) {
global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4);
} else {
- net::HostResolverImpl* host_resolver_impl =
- global_host_resolver->GetAsHostResolverImpl();
- if (host_resolver_impl != NULL) {
- // Use probe to decide if support is warranted.
- host_resolver_impl->ProbeIPv6Support();
- }
+ global_host_resolver->ProbeIPv6Support();
}
}
diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc
index f5d7f53..ab789aa 100644
--- a/net/base/host_resolver.cc
+++ b/net/base/host_resolver.cc
@@ -22,8 +22,7 @@ AddressFamily HostResolver::GetDefaultAddressFamily() const {
return ADDRESS_FAMILY_UNSPECIFIED;
}
-HostResolverImpl* HostResolver::GetAsHostResolverImpl() {
- return NULL;
+void HostResolver::ProbeIPv6Support() {
}
HostCache* HostResolver::GetHostCache() {
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h
index 11823f4..0abc318 100644
--- a/net/base/host_resolver.h
+++ b/net/base/host_resolver.h
@@ -189,13 +189,9 @@ class NET_EXPORT HostResolver {
virtual void SetDefaultAddressFamily(AddressFamily address_family) {}
virtual AddressFamily GetDefaultAddressFamily() const;
- // Returns |this| cast to a HostResolverImpl*, or NULL if the subclass
- // is not compatible with HostResolverImpl. Used primarily to expose
- // ProbeIPv6Support.
- // TODO(mmenke): Get rid of this function, so there's no externally visible
- // difference between using a HostResolverImpl and an
- // AsyncHostResolver.
- virtual HostResolverImpl* GetAsHostResolverImpl();
+ // Continuously observe whether IPv6 is supported, and set the allowable
+ // address family to IPv4 iff IPv6 is not supported.
+ virtual void ProbeIPv6Support();
// Returns the HostResolverCache |this| uses, or NULL if there isn't one.
// Used primarily to clear the cache and for getting debug information.
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index 43aaacc..c4002e6 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -1117,13 +1117,6 @@ HostResolverImpl::~HostResolverImpl() {
delete job_pools_[i];
}
-void HostResolverImpl::ProbeIPv6Support() {
- DCHECK(CalledOnValidThread());
- DCHECK(!ipv6_probe_monitoring_);
- ipv6_probe_monitoring_ = true;
- OnIPAddressChanged(); // Give initial setup call.
-}
-
void HostResolverImpl::SetPoolConstraints(JobPoolIndex pool_index,
size_t max_outstanding_jobs,
size_t max_pending_requests) {
@@ -1296,8 +1289,11 @@ AddressFamily HostResolverImpl::GetDefaultAddressFamily() const {
return default_address_family_;
}
-HostResolverImpl* HostResolverImpl::GetAsHostResolverImpl() {
- return this;
+void HostResolverImpl::ProbeIPv6Support() {
+ DCHECK(CalledOnValidThread());
+ DCHECK(!ipv6_probe_monitoring_);
+ ipv6_probe_monitoring_ = true;
+ OnIPAddressChanged(); // Give initial setup call.
}
HostCache* HostResolverImpl::GetHostCache() {
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h
index 27f9d05..dd8cb4d 100644
--- a/net/base/host_resolver_impl.h
+++ b/net/base/host_resolver_impl.h
@@ -111,10 +111,6 @@ class NET_EXPORT HostResolverImpl
// be called.
virtual ~HostResolverImpl();
- // Continuously observe whether IPv6 is supported, and set the allowable
- // address family to IPv4 iff IPv6 is not supported.
- void ProbeIPv6Support();
-
// Applies a set of constraints for requests that belong to the specified
// pool. NOTE: Don't call this after requests have been already been started.
//
@@ -142,12 +138,9 @@ class NET_EXPORT HostResolverImpl
virtual void CancelRequest(RequestHandle req) OVERRIDE;
virtual void AddObserver(HostResolver::Observer* observer) OVERRIDE;
virtual void RemoveObserver(HostResolver::Observer* observer) OVERRIDE;
-
- // Set address family, and disable IPv6 probe support.
virtual void SetDefaultAddressFamily(AddressFamily address_family) OVERRIDE;
virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE;
-
- virtual HostResolverImpl* GetAsHostResolverImpl() OVERRIDE;
+ virtual void ProbeIPv6Support() OVERRIDE;
virtual HostCache* GetHostCache() OVERRIDE;
private:
diff --git a/net/base/mapped_host_resolver.cc b/net/base/mapped_host_resolver.cc
index 6e0d2f8..5b8542f 100644
--- a/net/base/mapped_host_resolver.cc
+++ b/net/base/mapped_host_resolver.cc
@@ -53,8 +53,8 @@ void MappedHostResolver::RemoveObserver(Observer* observer) {
impl_->RemoveObserver(observer);
}
-HostResolverImpl* MappedHostResolver::GetAsHostResolverImpl() {
- return impl_->GetAsHostResolverImpl();
+void MappedHostResolver::ProbeIPv6Support() {
+ impl_->ProbeIPv6Support();
}
HostCache* MappedHostResolver::GetHostCache() {
diff --git a/net/base/mapped_host_resolver.h b/net/base/mapped_host_resolver.h
index 08755a8..78736c3 100644
--- a/net/base/mapped_host_resolver.h
+++ b/net/base/mapped_host_resolver.h
@@ -55,7 +55,7 @@ class NET_EXPORT MappedHostResolver : public HostResolver {
virtual void CancelRequest(RequestHandle req) OVERRIDE;
virtual void AddObserver(Observer* observer) OVERRIDE;
virtual void RemoveObserver(Observer* observer) OVERRIDE;
- virtual HostResolverImpl* GetAsHostResolverImpl() OVERRIDE;
+ virtual void ProbeIPv6Support() OVERRIDE;
virtual HostCache* GetHostCache() OVERRIDE;
private: