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

Unified Diff: net/dns/async_host_resolver.h

Issue 8762001: Isolates generic DnsClient from AsyncHostResolver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retrying to fix status of dns_session.h Created 9 years 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
« no previous file with comments | « net/base/dns_util.cc ('k') | net/dns/async_host_resolver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/async_host_resolver.h
diff --git a/net/dns/async_host_resolver.h b/net/dns/async_host_resolver.h
index c501d654d4f9803bc96ceae0eefc067d2ecaa683..e8aeb8b90583685dd1a86bb9fb87c4d58d2f63ec 100644
--- a/net/dns/async_host_resolver.h
+++ b/net/dns/async_host_resolver.h
@@ -8,6 +8,8 @@
#include <list>
#include <map>
+#include <string>
+#include <utility>
#include "base/threading/non_thread_safe.h"
#include "net/base/address_family.h"
@@ -15,24 +17,18 @@
#include "net/base/host_resolver.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_log.h"
-#include "net/base/rand_callback.h"
-#include "net/dns/dns_transaction.h"
+#include "net/dns/dns_client.h"
namespace net {
-class ClientSocketFactory;
-
class NET_EXPORT AsyncHostResolver
: public HostResolver,
- public DnsTransaction::Delegate,
NON_EXPORTED_BASE(public base::NonThreadSafe) {
public:
- AsyncHostResolver(const IPEndPoint& dns_server,
- size_t max_transactions,
- size_t max_pending_requests_,
- const RandIntCallback& rand_int,
+ AsyncHostResolver(size_t max_dns_requests,
+ size_t max_pending_requests,
HostCache* cache,
- ClientSocketFactory* factory,
+ DnsClient* client,
NetLog* net_log);
virtual ~AsyncHostResolver();
@@ -50,11 +46,9 @@ class NET_EXPORT AsyncHostResolver
virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE;
virtual HostCache* GetHostCache() OVERRIDE;
- // DnsTransaction::Delegate interface
- virtual void OnTransactionComplete(
- int result,
- const DnsTransaction* transaction,
- const IPAddressList& ip_addresses) OVERRIDE;
+ void OnDnsRequestComplete(DnsClient::Request* request,
+ int result,
+ const DnsResponse* transaction);
private:
FRIEND_TEST_ALL_PREFIXES(AsyncHostResolverTest, QueuedLookup);
@@ -68,9 +62,9 @@ class NET_EXPORT AsyncHostResolver
class Request;
- typedef DnsTransaction::Key Key;
+ typedef std::pair<std::string, uint16> Key;
typedef std::list<Request*> RequestList;
- typedef std::list<const DnsTransaction*> TransactionList;
+ typedef std::list<const DnsClient::Request*> DnsRequestList;
typedef std::map<Key, RequestList> KeyRequestListMap;
// Create a new request for the incoming Resolve() call.
@@ -92,9 +86,9 @@ class NET_EXPORT AsyncHostResolver
// attach |request| to the respective list.
bool AttachToRequestList(Request* request);
- // Will start a new transaction for |request|, will insert a new key in
+ // Will start a new DNS request for |request|, will insert a new key in
// |requestlist_map_| and append |request| to the respective list.
- int StartNewTransactionFor(Request* request);
+ int StartNewDnsRequestFor(Request* request);
// Will enqueue |request| in |pending_requests_|.
int Enqueue(Request* request);
@@ -114,11 +108,11 @@ class NET_EXPORT AsyncHostResolver
// there are pending requests.
void ProcessPending();
- // Maximum number of concurrent transactions.
- size_t max_transactions_;
+ // Maximum number of concurrent DNS requests.
+ size_t max_dns_requests_;
- // List of current transactions.
- TransactionList transactions_;
+ // List of current DNS requests.
+ DnsRequestList dns_requests_;
// A map from Key to a list of requests waiting for the Key to resolve.
KeyRequestListMap requestlist_map_;
@@ -129,18 +123,10 @@ class NET_EXPORT AsyncHostResolver
// Queues based on priority for putting pending requests.
RequestList pending_requests_[NUM_PRIORITIES];
- // DNS server to which queries will be setn.
- IPEndPoint dns_server_;
-
- // Callback to be passed to DnsTransaction for generating DNS query ids.
- RandIntCallback rand_int_cb_;
-
// Cache of host resolution results.
scoped_ptr<HostCache> cache_;
- // Also passed to DnsTransaction; it's a dependency injection to aid
- // testing, outside of unit tests, its value is always NULL.
- ClientSocketFactory* factory_;
+ DnsClient* client_;
NetLog* net_log_;
« no previous file with comments | « net/base/dns_util.cc ('k') | net/dns/async_host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698