| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_DNS_DNS_SOCKET_POOL_H_ |
| 6 #define NET_DNS_DNS_SOCKET_POOL_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 |
| 12 namespace net { |
| 13 |
| 14 class ClientSocketFactory; |
| 15 class DatagramClientSocket; |
| 16 class IPEndPoint; |
| 17 class NetLog; |
| 18 |
| 19 class DnsSocketPool { |
| 20 public: |
| 21 virtual ~DnsSocketPool() { } |
| 22 |
| 23 static scoped_ptr<DnsSocketPool> CreateDefault( |
| 24 ClientSocketFactory* factory); |
| 25 |
| 26 static scoped_ptr<DnsSocketPool> CreateNull( |
| 27 ClientSocketFactory* factory); |
| 28 |
| 29 virtual void Initialize( |
| 30 const std::vector<IPEndPoint>* nameservers, |
| 31 NetLog* net_log) = 0; |
| 32 |
| 33 virtual scoped_ptr<DatagramClientSocket> AllocateSocket( |
| 34 unsigned server_index) = 0; |
| 35 |
| 36 virtual void FreeSocket( |
| 37 unsigned server_index, |
| 38 scoped_ptr<DatagramClientSocket> socket) = 0; |
| 39 |
| 40 protected: |
| 41 DnsSocketPool(ClientSocketFactory* socket_factory); |
| 42 |
| 43 void InitializeInternal( |
| 44 const std::vector<IPEndPoint>* nameservers, |
| 45 NetLog* net_log); |
| 46 |
| 47 scoped_ptr<DatagramClientSocket> CreateConnectedSocket( |
| 48 unsigned server_index); |
| 49 |
| 50 private: |
| 51 ClientSocketFactory* socket_factory_; |
| 52 NetLog* net_log_; |
| 53 const std::vector<IPEndPoint>* nameservers_; |
| 54 bool initialized_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(DnsSocketPool); |
| 57 }; |
| 58 |
| 59 } // namespace net |
| 60 |
| 61 #endif // NET_DNS_DNS_SOCKET_POOL_H_ |
| OLD | NEW |