summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 20:27:02 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 20:27:02 +0000
commit970210cdcd03803acfe9f08bfa20edb5e84f07ce (patch)
treef45d20277969a6b33b27194e7604de9419ff67bb /net
parentfc9023fa5d45af40509a20263142ad7191620e00 (diff)
downloadchromium_src-970210cdcd03803acfe9f08bfa20edb5e84f07ce.zip
chromium_src-970210cdcd03803acfe9f08bfa20edb5e84f07ce.tar.gz
chromium_src-970210cdcd03803acfe9f08bfa20edb5e84f07ce.tar.bz2
Make MappedHostResolver display its internals on the about:net-internals page (so use of the --host-resolver-rules flag doesn't limit features), and run through the Shutdown() method on exit.
This reworks the "IsHostResolverImpl()" hack to be a bit more general. BUG=36053 Review URL: http://codereview.chromium.org/646003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/host_resolver.h9
-rw-r--r--net/base/host_resolver_impl.h2
-rw-r--r--net/base/mapped_host_resolver.cc4
-rw-r--r--net/base/mapped_host_resolver.h1
-rw-r--r--net/url_request/url_request_view_net_internals_job.cc4
5 files changed, 12 insertions, 8 deletions
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h
index da431f3..c4cdef6 100644
--- a/net/base/host_resolver.h
+++ b/net/base/host_resolver.h
@@ -19,6 +19,7 @@ namespace net {
class AddressList;
class HostCache;
+class HostResolverImpl;
class LoadLog;
class NetworkChangeNotifier;
@@ -161,10 +162,10 @@ class HostResolver : public base::RefCountedThreadSafe<HostResolver> {
// AF_INET6 by passing in ADDRESS_FAMILY_IPV6.
virtual void SetDefaultAddressFamily(AddressFamily address_family) {}
- // Returns true if this HostResolver is an instance of HostResolverImpl.
- // Used primarily to expose additional functionality on the
- // about:net-internals page.
- virtual bool IsHostResolverImpl() { return false; }
+ // Returns |this| cast to a HostResolverImpl*, or NULL if the subclass
+ // is not compatible with HostResolverImpl. Used primarily to expose
+ // additional functionality on the about:net-internals page.
+ virtual HostResolverImpl* GetAsHostResolverImpl() { return NULL; }
protected:
friend class base::RefCountedThreadSafe<HostResolver>;
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h
index 6499b3e..3e273cd 100644
--- a/net/base/host_resolver_impl.h
+++ b/net/base/host_resolver_impl.h
@@ -92,7 +92,7 @@ class HostResolverImpl : public HostResolver,
default_address_family_ = address_family;
}
- virtual bool IsHostResolverImpl() { return true; }
+ virtual HostResolverImpl* GetAsHostResolverImpl() { return this; }
// TODO(eroman): hack for http://crbug.com/15513
void Shutdown();
diff --git a/net/base/mapped_host_resolver.cc b/net/base/mapped_host_resolver.cc
index 3624a9b..164d7c6 100644
--- a/net/base/mapped_host_resolver.cc
+++ b/net/base/mapped_host_resolver.cc
@@ -37,6 +37,10 @@ void MappedHostResolver::RemoveObserver(Observer* observer) {
impl_->RemoveObserver(observer);
}
+HostResolverImpl* MappedHostResolver::GetAsHostResolverImpl() {
+ return impl_->GetAsHostResolverImpl();
+}
+
MappedHostResolver::~MappedHostResolver() {
}
diff --git a/net/base/mapped_host_resolver.h b/net/base/mapped_host_resolver.h
index af78a9c..a637a40 100644
--- a/net/base/mapped_host_resolver.h
+++ b/net/base/mapped_host_resolver.h
@@ -32,6 +32,7 @@ class MappedHostResolver : public HostResolver {
virtual void CancelRequest(RequestHandle req);
virtual void AddObserver(Observer* observer);
virtual void RemoveObserver(Observer* observer);
+ virtual HostResolverImpl* GetAsHostResolverImpl();
// Adds a rule to this mapper. The format of the rule can be one of:
//
diff --git a/net/url_request/url_request_view_net_internals_job.cc b/net/url_request/url_request_view_net_internals_job.cc
index 15986f6..38349a4 100644
--- a/net/url_request/url_request_view_net_internals_job.cc
+++ b/net/url_request/url_request_view_net_internals_job.cc
@@ -51,9 +51,7 @@ void DrawCommandButton(const std::string& title,
//------------------------------------------------------------------------------
net::HostResolverImpl* GetHostResolverImpl(URLRequestContext* context) {
- if (context->host_resolver()->IsHostResolverImpl())
- return static_cast<net::HostResolverImpl*> (context->host_resolver());
- return NULL;
+ return context->host_resolver()->GetAsHostResolverImpl();
}
net::HostCache* GetHostCache(URLRequestContext* context) {