OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
9 | 9 |
10 struct addrinfo; | 10 struct addrinfo; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Used by unit-tests to manually set the TCP socket address. | 47 // Used by unit-tests to manually set the TCP socket address. |
48 static AddressList CreateIPv6Address(unsigned char data[16]); | 48 static AddressList CreateIPv6Address(unsigned char data[16]); |
49 | 49 |
50 // Get access to the head of the addrinfo list. | 50 // Get access to the head of the addrinfo list. |
51 const struct addrinfo* head() const { return data_->head; } | 51 const struct addrinfo* head() const { return data_->head; } |
52 | 52 |
53 private: | 53 private: |
54 struct Data : public base::RefCountedThreadSafe<Data> { | 54 struct Data : public base::RefCountedThreadSafe<Data> { |
55 Data(struct addrinfo* ai, bool is_system_created) | 55 Data(struct addrinfo* ai, bool is_system_created) |
56 : head(ai), is_system_created(is_system_created) {} | 56 : head(ai), is_system_created(is_system_created) {} |
57 ~Data(); | |
58 struct addrinfo* head; | 57 struct addrinfo* head; |
59 | 58 |
60 // Indicates which free function to use for |head|. | 59 // Indicates which free function to use for |head|. |
61 bool is_system_created; | 60 bool is_system_created; |
| 61 |
| 62 private: |
| 63 friend class base::RefCountedThreadSafe<Data>; |
| 64 |
| 65 ~Data(); |
62 }; | 66 }; |
63 | 67 |
64 explicit AddressList(Data* data) : data_(data) {} | 68 explicit AddressList(Data* data) : data_(data) {} |
65 | 69 |
66 scoped_refptr<Data> data_; | 70 scoped_refptr<Data> data_; |
67 }; | 71 }; |
68 | 72 |
69 } // namespace net | 73 } // namespace net |
70 | 74 |
71 #endif // NET_BASE_ADDRESS_LIST_H_ | 75 #endif // NET_BASE_ADDRESS_LIST_H_ |
OLD | NEW |