OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DNS_DNS_SOCKET_POOL_H_ | 5 #ifndef NET_DNS_DNS_SOCKET_POOL_H_ |
6 #define NET_DNS_DNS_SOCKET_POOL_H_ | 6 #define NET_DNS_DNS_SOCKET_POOL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // for which the DnsSocketPool will manage sockets; |net_log| is the NetLog | 46 // for which the DnsSocketPool will manage sockets; |net_log| is the NetLog |
47 // used when constructing sockets with the factory. | 47 // used when constructing sockets with the factory. |
48 // | 48 // |
49 // Initialize may not be called more than once, and must be called before | 49 // Initialize may not be called more than once, and must be called before |
50 // calling AllocateSocket or FreeSocket. | 50 // calling AllocateSocket or FreeSocket. |
51 virtual void Initialize( | 51 virtual void Initialize( |
52 const std::vector<IPEndPoint>* nameservers, | 52 const std::vector<IPEndPoint>* nameservers, |
53 NetLog* net_log) = 0; | 53 NetLog* net_log) = 0; |
54 | 54 |
55 // Allocates a socket that is already connected to the nameserver referenced | 55 // Allocates a socket that is already connected to the nameserver referenced |
56 // by |server_index|. May return a scoped_ptr to NULL if no sockets are | 56 // by |server_index|. May return a std::unique_ptr to NULL if no sockets are |
57 // available to reuse and the factory fails to produce a socket (or produces | 57 // available to reuse and the factory fails to produce a socket (or produces |
58 // one on which Connect fails). | 58 // one on which Connect fails). |
59 virtual std::unique_ptr<DatagramClientSocket> AllocateSocket( | 59 virtual std::unique_ptr<DatagramClientSocket> AllocateSocket( |
60 unsigned server_index) = 0; | 60 unsigned server_index) = 0; |
61 | 61 |
62 // Frees a socket allocated by AllocateSocket. |server_index| must be the | 62 // Frees a socket allocated by AllocateSocket. |server_index| must be the |
63 // same index passed to AllocateSocket. | 63 // same index passed to AllocateSocket. |
64 virtual void FreeSocket(unsigned server_index, | 64 virtual void FreeSocket(unsigned server_index, |
65 std::unique_ptr<DatagramClientSocket> socket) = 0; | 65 std::unique_ptr<DatagramClientSocket> socket) = 0; |
66 | 66 |
(...skipping 22 matching lines...) Expand all Loading... |
89 NetLog* net_log_; | 89 NetLog* net_log_; |
90 const std::vector<IPEndPoint>* nameservers_; | 90 const std::vector<IPEndPoint>* nameservers_; |
91 bool initialized_; | 91 bool initialized_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(DnsSocketPool); | 93 DISALLOW_COPY_AND_ASSIGN(DnsSocketPool); |
94 }; | 94 }; |
95 | 95 |
96 } // namespace net | 96 } // namespace net |
97 | 97 |
98 #endif // NET_DNS_DNS_SOCKET_POOL_H_ | 98 #endif // NET_DNS_DNS_SOCKET_POOL_H_ |
OLD | NEW |