Chromium Code Reviews| 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 #include "net/base/net_export.h" | |
| 12 | |
| 13 namespace net { | |
| 14 | |
| 15 class ClientSocketFactory; | |
| 16 class DatagramClientSocket; | |
| 17 class IPEndPoint; | |
| 18 class NetLog; | |
| 19 | |
| 20 class NET_EXPORT_PRIVATE DnsSocketPool { | |
|
cbentzel
2012/10/25 21:15:45
Please provide a brief comment about what this cla
| |
| 21 public: | |
| 22 virtual ~DnsSocketPool() { } | |
| 23 | |
| 24 static scoped_ptr<DnsSocketPool> CreateDefault( | |
| 25 ClientSocketFactory* factory); | |
| 26 | |
| 27 static scoped_ptr<DnsSocketPool> CreateNull( | |
| 28 ClientSocketFactory* factory); | |
| 29 | |
| 30 virtual void Initialize( | |
| 31 const std::vector<IPEndPoint>* nameservers, | |
| 32 NetLog* net_log) = 0; | |
| 33 | |
| 34 virtual scoped_ptr<DatagramClientSocket> AllocateSocket( | |
| 35 unsigned server_index) = 0; | |
| 36 | |
| 37 virtual void FreeSocket( | |
| 38 unsigned server_index, | |
| 39 scoped_ptr<DatagramClientSocket> socket) = 0; | |
| 40 | |
| 41 protected: | |
| 42 DnsSocketPool(ClientSocketFactory* socket_factory); | |
| 43 | |
| 44 void InitializeInternal( | |
| 45 const std::vector<IPEndPoint>* nameservers, | |
| 46 NetLog* net_log); | |
| 47 | |
| 48 scoped_ptr<DatagramClientSocket> CreateConnectedSocket( | |
| 49 unsigned server_index); | |
| 50 | |
| 51 private: | |
| 52 ClientSocketFactory* socket_factory_; | |
| 53 NetLog* net_log_; | |
| 54 const std::vector<IPEndPoint>* nameservers_; | |
| 55 bool initialized_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(DnsSocketPool); | |
| 58 }; | |
| 59 | |
| 60 } // namespace net | |
| 61 | |
| 62 #endif // NET_DNS_DNS_SOCKET_POOL_H_ | |
| OLD | NEW |