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

Unified Diff: net/base/address_list.h

Issue 118100: Avoid doing concurrent DNS resolves of the same hostname (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Get compiling on mac Created 11 years, 6 months 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 | « chrome/browser/net/dns_master_unittest.cc ('k') | net/base/address_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/address_list.h
===================================================================
--- net/base/address_list.h (revision 18213)
+++ net/base/address_list.h (working copy)
@@ -20,16 +20,39 @@
// object.
void Adopt(struct addrinfo* head);
+ // Copies the given addrinfo rather than adopting it.
+ void Copy(const struct addrinfo* head);
wtc 2009/06/12 18:40:04 Eric, In the most common case, we connect to only
eroman 2009/06/12 20:15:22 That seems really weird to me. - We would be doin
+
+ // 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_;
};
« no previous file with comments | « chrome/browser/net/dns_master_unittest.cc ('k') | net/base/address_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698