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

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: Created 9 years, 1 month 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: net/dns/async_host_resolver.h
diff --git a/net/dns/async_host_resolver.h b/net/dns/async_host_resolver.h
index c501d654d4f9803bc96ceae0eefc067d2ecaa683..f40f1cabef0e02c4deb194898f9b2b5c1e9a4b99 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,
+ AsyncHostResolver(size_t max_transactions,
size_t max_pending_requests_,
mmenke 2011/12/02 00:53:55 Know this was already here, but while you're modif
szym 2011/12/05 23:06:28 Done.
- const RandIntCallback& rand_int,
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;
+ virtual void OnRequestComplete(DnsClient::Request* request,
+ int result,
+ const DnsResponse* transaction);
mmenke 2011/12/02 00:53:55 OVERRIDE
szym 2011/12/05 23:06:28 DnsTransaction no longer defines a Delegate interf
mmenke 2011/12/06 18:08:39 Ah, right. Don't think it needs to be virtual, ei
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*> TransactionList;
typedef std::map<Key, RequestList> KeyRequestListMap;
// Create a new request for the incoming Resolve() call.
@@ -118,7 +112,7 @@ class NET_EXPORT AsyncHostResolver
size_t max_transactions_;
// List of current transactions.
- TransactionList transactions_;
+ TransactionList dns_requests_;
mmenke 2011/12/02 00:53:55 I think overload requests to both mean requests to
// 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_;

Powered by Google App Engine
This is Rietveld 408576698