| 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 // A DnsSlave object processes hostname lookups | 5 // A DnsSlave object processes hostname lookups |
| 6 // via DNS on a single thread, waiting for that blocking | 6 // via DNS on a single thread, waiting for that blocking |
| 7 // call to complete, and then getting its next hostname | 7 // call to complete, and then getting its next hostname |
| 8 // from its associated DnsMaster object. | 8 // from its associated DnsMaster object. |
| 9 // Since this class only is concerned with prefetching | 9 // Since this class only is concerned with prefetching |
| 10 // to warm the underlying DNS cache, the actual IP | 10 // to warm the underlying DNS cache, the actual IP |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const struct addrinfo* hints, | 35 const struct addrinfo* hints, |
| 36 struct addrinfo** result); | 36 struct addrinfo** result); |
| 37 void SetAddrinfoCallbacks(GetAddrInfoFunction getaddrinfo, | 37 void SetAddrinfoCallbacks(GetAddrInfoFunction getaddrinfo, |
| 38 FreeAddrInfoFunction freeaddrinfo); | 38 FreeAddrInfoFunction freeaddrinfo); |
| 39 | 39 |
| 40 GetAddrInfoFunction get_getaddrinfo(); | 40 GetAddrInfoFunction get_getaddrinfo(); |
| 41 FreeAddrInfoFunction get_freeaddrinfo(); | 41 FreeAddrInfoFunction get_freeaddrinfo(); |
| 42 | 42 |
| 43 class DnsSlave { | 43 class DnsSlave { |
| 44 public: | 44 public: |
| 45 DnsSlave(DnsMaster* master, int slave_index) | 45 DnsSlave(DnsMaster* master, size_t slave_index) |
| 46 : slave_index_(slave_index), | 46 : master_(master), |
| 47 master_(master) { | 47 slave_index_(slave_index) { |
| 48 } | 48 } |
| 49 | 49 |
| 50 ~DnsSlave() { | 50 ~DnsSlave() { |
| 51 master_ = NULL; | 51 master_ = NULL; |
| 52 } | 52 } |
| 53 | 53 |
| 54 static DWORD WINAPI ThreadStart(void* pThis); | 54 static DWORD WINAPI ThreadStart(void* pThis); |
| 55 | 55 |
| 56 unsigned Run(); | 56 unsigned Run(); |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 std::string hostname_; // Name being looked up. | 59 std::string hostname_; // Name being looked up. |
| 60 | 60 |
| 61 DnsMaster* master_; // Master that started us. | 61 DnsMaster* master_; // Master that started us. |
| 62 int slave_index_; // Our index into DnsMaster's array. | 62 size_t slave_index_; // Our index into DnsMaster's array. |
| 63 | 63 |
| 64 void BlockingDnsLookup(); | 64 void BlockingDnsLookup(); |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(DnsSlave); | 66 DISALLOW_COPY_AND_ASSIGN(DnsSlave); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace chrome_browser_net | 69 } // namespace chrome_browser_net |
| 70 | 70 |
| 71 #endif // CHROME_BROWSER_NET_DNS_SLAVE_H_ | 71 #endif // CHROME_BROWSER_NET_DNS_SLAVE_H_ |
| 72 | 72 |
| OLD | NEW |