summaryrefslogtreecommitdiffstats
path: root/net/base/address_list.h
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-12 00:49:38 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-12 00:49:38 +0000
commit8a00f00ab5d68ffcc998fd04d2ca343af7cdf190 (patch)
treefd464ba49db4271c76c1cf8f769a22120ad631af /net/base/address_list.h
parent77ae132c1bfdd986228b6f1c0d8c63baa441afdf (diff)
downloadchromium_src-8a00f00ab5d68ffcc998fd04d2ca343af7cdf190.zip
chromium_src-8a00f00ab5d68ffcc998fd04d2ca343af7cdf190.tar.gz
chromium_src-8a00f00ab5d68ffcc998fd04d2ca343af7cdf190.tar.bz2
* Avoid doing concurrent DNS resolves of the same hostname in HostResolver.
* Add a 1 minute cache for host resolves. * Refactor HostResolver to handle multiple requests. * Make HostResolver a dependency of URLRequestContext. operate the HostResolver in async mode for proxy resolver (bridging to IO thread). TEST=unittests BUG=13163 Review URL: http://codereview.chromium.org/118100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18236 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/address_list.h')
-rw-r--r--net/base/address_list.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/net/base/address_list.h b/net/base/address_list.h
index 5bffd4c..506350b 100644
--- a/net/base/address_list.h
+++ b/net/base/address_list.h
@@ -20,16 +20,39 @@ class AddressList {
// object.
void Adopt(struct addrinfo* head);
+ // Copies the given addrinfo rather than adopting it.
+ void Copy(const struct addrinfo* head);
+
+ // Sets the port of all addresses in the list to |port| (that is the
+ // sin[6]_port field for the sockaddrs).
+ void SetPort(int port);
+
+ // Retrieves the port number of the first sockaddr in the list. (If SetPort()
+ // was previously used on this list, then all the addresses will have this
+ // same port number.)
+ int GetPort() const;
+
+ // Sets the address to match |src|, and have each sockaddr's port be |port|.
+ // If |src| already has the desired port this operation is cheap (just adds
+ // a reference to |src|'s data.) Otherwise we will make a copy.
+ void SetFrom(const AddressList& src, int port);
+
+ // Clears all data from this address list. This leaves the list in the same
+ // empty state as when first constructed.
+ void Reset();
+
// Get access to the head of the addrinfo list.
const struct addrinfo* head() const { return data_->head; }
private:
struct Data : public base::RefCountedThreadSafe<Data> {
- explicit Data(struct addrinfo* ai) : head(ai) {}
+ Data(struct addrinfo* ai, bool is_system_created)
+ : head(ai), is_system_created(is_system_created) {}
~Data();
struct addrinfo* head;
- private:
- Data();
+
+ // Indicates which free function to use for |head|.
+ bool is_system_created;
};
scoped_refptr<Data> data_;
};