diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/base/host_resolver.cc | 4 | ||||
-rw-r--r-- | net/base/host_resolver.h | 10 | ||||
-rw-r--r-- | net/base/host_resolver_impl.cc | 3 | ||||
-rw-r--r-- | net/base/host_resolver_impl.h | 4 | ||||
-rw-r--r-- | net/base/mapped_host_resolver.cc | 6 | ||||
-rw-r--r-- | net/base/mapped_host_resolver.h | 1 | ||||
-rw-r--r-- | net/dns/async_host_resolver.cc | 4 | ||||
-rw-r--r-- | net/dns/async_host_resolver.h | 2 | ||||
-rw-r--r-- | net/dns/dns_transaction.cc | 8 | ||||
-rw-r--r-- | net/dns/dns_transaction.h | 6 |
10 files changed, 34 insertions, 14 deletions
diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc index 01dfd41..f5d7f53 100644 --- a/net/base/host_resolver.cc +++ b/net/base/host_resolver.cc @@ -26,6 +26,10 @@ HostResolverImpl* HostResolver::GetAsHostResolverImpl() { return NULL; } +HostCache* HostResolver::GetHostCache() { + return NULL; +} + HostResolver::HostResolver() { } diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h index ea0f891..11823f4 100644 --- a/net/base/host_resolver.h +++ b/net/base/host_resolver.h @@ -21,6 +21,7 @@ namespace net { class AddressList; class BoundNetLog; +class HostCache; class HostResolverImpl; class HostResolverProc; class NetLog; @@ -190,9 +191,16 @@ class NET_EXPORT HostResolver { // 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. + // 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(); + // Returns the HostResolverCache |this| uses, or NULL if there isn't one. + // Used primarily to clear the cache and for getting debug information. + virtual HostCache* GetHostCache(); + protected: HostResolver(); diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index 6cfd788..bc212cf 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -1304,6 +1304,9 @@ HostResolverImpl* HostResolverImpl::GetAsHostResolverImpl() { return this; } +HostCache* HostResolverImpl::GetHostCache() { + return cache_.get(); +} bool HostResolverImpl::ResolveAsIP(const Key& key, const RequestInfo& info, diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h index 36f6fc54..7f8c0b5 100644 --- a/net/base/host_resolver_impl.h +++ b/net/base/host_resolver_impl.h @@ -115,9 +115,6 @@ class NET_EXPORT HostResolverImpl // address family to IPv4 iff IPv6 is not supported. void ProbeIPv6Support(); - // Returns the cache this resolver uses, or NULL if caching is disabled. - HostCache* cache() { return cache_.get(); } - // 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. // @@ -151,6 +148,7 @@ class NET_EXPORT HostResolverImpl virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE; virtual HostResolverImpl* GetAsHostResolverImpl() OVERRIDE; + virtual HostCache* GetHostCache() OVERRIDE; private: // Allow tests to access our innards for testing purposes. diff --git a/net/base/mapped_host_resolver.cc b/net/base/mapped_host_resolver.cc index 7364f9e..6e0d2f8 100644 --- a/net/base/mapped_host_resolver.cc +++ b/net/base/mapped_host_resolver.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -57,4 +57,8 @@ HostResolverImpl* MappedHostResolver::GetAsHostResolverImpl() { return impl_->GetAsHostResolverImpl(); } +HostCache* MappedHostResolver::GetHostCache() { + return impl_->GetHostCache(); +} + } // namespace net diff --git a/net/base/mapped_host_resolver.h b/net/base/mapped_host_resolver.h index 26459e9..08755a8 100644 --- a/net/base/mapped_host_resolver.h +++ b/net/base/mapped_host_resolver.h @@ -56,6 +56,7 @@ class NET_EXPORT MappedHostResolver : public HostResolver { virtual void AddObserver(Observer* observer) OVERRIDE; virtual void RemoveObserver(Observer* observer) OVERRIDE; virtual HostResolverImpl* GetAsHostResolverImpl() OVERRIDE; + virtual HostCache* GetHostCache() OVERRIDE; private: scoped_ptr<HostResolver> impl_; diff --git a/net/dns/async_host_resolver.cc b/net/dns/async_host_resolver.cc index ed0d70f..70c9277 100644 --- a/net/dns/async_host_resolver.cc +++ b/net/dns/async_host_resolver.cc @@ -351,8 +351,8 @@ AddressFamily AsyncHostResolver::GetDefaultAddressFamily() const { return ADDRESS_FAMILY_IPV4; } -HostResolverImpl* AsyncHostResolver::GetAsHostResolverImpl() { - return NULL; +HostCache* AsyncHostResolver::GetHostCache() { + return cache_.get(); } void AsyncHostResolver::OnTransactionComplete( diff --git a/net/dns/async_host_resolver.h b/net/dns/async_host_resolver.h index 9906720..f7e5c53 100644 --- a/net/dns/async_host_resolver.h +++ b/net/dns/async_host_resolver.h @@ -52,7 +52,7 @@ class NET_EXPORT AsyncHostResolver virtual void RemoveObserver(HostResolver::Observer* observer) OVERRIDE; virtual void SetDefaultAddressFamily(AddressFamily address_family) OVERRIDE; virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE; - virtual HostResolverImpl* GetAsHostResolverImpl() OVERRIDE; + virtual HostCache* GetHostCache() OVERRIDE; // DnsTransaction::Delegate interface virtual void OnTransactionComplete( diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc index 30fd7bf..a7fa922 100644 --- a/net/dns/dns_transaction.cc +++ b/net/dns/dns_transaction.cc @@ -84,7 +84,8 @@ class DnsTransactionStartParameters : public NetLog::EventParameters { dict->SetString("dns_server", dns_server_.ToString()); dict->SetString("hostname", hostname); dict->SetInteger("query_type", key_.second); - dict->Set("source_dependency", source_.ToValue()); + if (source_.is_valid()) + dict->Set("source_dependency", source_.ToValue()); return dict; } @@ -107,7 +108,8 @@ class DnsTransactionFinishParameters : public NetLog::EventParameters { list->Append(Value::CreateStringValue(IPAddressToString(*it))); DictionaryValue* dict = new DictionaryValue(); - dict->SetInteger("net_error", net_error_); + if (net_error_) + dict->SetInteger("net_error", net_error_); dict->Set("address_list", list); return dict; } @@ -247,7 +249,7 @@ int DnsTransaction::DoConnect() { socket_.reset(socket_factory_->CreateDatagramClientSocket( DatagramSocket::RANDOM_BIND, base::Bind(&base::RandInt), - NULL, + net_log_.net_log(), net_log_.source())); net_log_.AddEvent( diff --git a/net/dns/dns_transaction.h b/net/dns/dns_transaction.h index 27da32a..c126193 100644 --- a/net/dns/dns_transaction.h +++ b/net/dns/dns_transaction.h @@ -29,15 +29,15 @@ class DnsQuery; class DnsResponse; // Performs (with fixed retries) a single asynchronous DNS transaction, -// which consists of sending out a DNS query, waiting for response, and +// which consists of sending out a DNS query, waiting for a response, and // parsing and returning the IP addresses that it matches. class NET_EXPORT_PRIVATE DnsTransaction : NON_EXPORTED_BASE(public base::NonThreadSafe) { public: typedef std::pair<std::string, uint16> Key; - // Interface that should implemented by DnsTransaction consumer and - // passed to |Start| method to be notified when the transaction has + // Interface that should be implemented by DnsTransaction consumers and + // passed to the |Start| method to be notified when the transaction has // completed. class NET_EXPORT_PRIVATE Delegate { public: |