OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_BASE_ADDRESS_LIST_H_ | 5 #ifndef NET_BASE_ADDRESS_LIST_H_ |
6 #define NET_BASE_ADDRESS_LIST_H_ | 6 #define NET_BASE_ADDRESS_LIST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void Reset(); | 60 void Reset(); |
61 | 61 |
62 // Used by unit-tests to manually set the TCP socket address. | 62 // Used by unit-tests to manually set the TCP socket address. |
63 static AddressList CreateIPv6Address(unsigned char data[16]); | 63 static AddressList CreateIPv6Address(unsigned char data[16]); |
64 | 64 |
65 // Get access to the head of the addrinfo list. | 65 // Get access to the head of the addrinfo list. |
66 const struct addrinfo* head() const { return data_->head; } | 66 const struct addrinfo* head() const { return data_->head; } |
67 | 67 |
68 private: | 68 private: |
69 struct Data : public base::RefCountedThreadSafe<Data> { | 69 struct Data : public base::RefCountedThreadSafe<Data> { |
70 Data(struct addrinfo* ai, bool is_system_created) | 70 Data(struct addrinfo* ai, bool is_system_created); |
71 : head(ai), is_system_created(is_system_created) {} | |
72 struct addrinfo* head; | 71 struct addrinfo* head; |
73 | 72 |
74 // Indicates which free function to use for |head|. | 73 // Indicates which free function to use for |head|. |
75 bool is_system_created; | 74 bool is_system_created; |
76 | 75 |
77 private: | 76 private: |
78 friend class base::RefCountedThreadSafe<Data>; | 77 friend class base::RefCountedThreadSafe<Data>; |
79 | 78 |
80 ~Data(); | 79 ~Data(); |
81 }; | 80 }; |
82 | 81 |
83 explicit AddressList(Data* data) : data_(data) {} | 82 explicit AddressList(Data* data) : data_(data) {} |
84 | 83 |
85 scoped_refptr<Data> data_; | 84 scoped_refptr<Data> data_; |
86 }; | 85 }; |
87 | 86 |
88 } // namespace net | 87 } // namespace net |
89 | 88 |
90 #endif // NET_BASE_ADDRESS_LIST_H_ | 89 #endif // NET_BASE_ADDRESS_LIST_H_ |
OLD | NEW |