OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_HOST_RESOLVER_H_ | 5 #ifndef NET_BASE_HOST_RESOLVER_H_ |
6 #define NET_BASE_HOST_RESOLVER_H_ | 6 #define NET_BASE_HOST_RESOLVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 }; | 124 }; |
125 | 125 |
126 // Opaque type used to cancel a request. | 126 // Opaque type used to cancel a request. |
127 typedef void* RequestHandle; | 127 typedef void* RequestHandle; |
128 | 128 |
129 // This value can be passed into CreateSystemHostResolver as the | 129 // This value can be passed into CreateSystemHostResolver as the |
130 // |max_concurrent_resolves| parameter. It will select a default level of | 130 // |max_concurrent_resolves| parameter. It will select a default level of |
131 // concurrency. | 131 // concurrency. |
132 static const size_t kDefaultParallelism = 0; | 132 static const size_t kDefaultParallelism = 0; |
133 | 133 |
| 134 // This value can be passed into CreateSystemHostResolver as the |
| 135 // |max_retry_attempts| parameter. This is the maximum number of times we |
| 136 // will retry for host resolution. |
| 137 static const size_t kDefaultRetryAttempts = -1; |
| 138 |
134 // If any completion callbacks are pending when the resolver is destroyed, | 139 // If any completion callbacks are pending when the resolver is destroyed, |
135 // the host resolutions are cancelled, and the completion callbacks will not | 140 // the host resolutions are cancelled, and the completion callbacks will not |
136 // be called. | 141 // be called. |
137 virtual ~HostResolver(); | 142 virtual ~HostResolver(); |
138 | 143 |
139 // Resolves the given hostname (or IP address literal), filling out the | 144 // Resolves the given hostname (or IP address literal), filling out the |
140 // |addresses| object upon success. The |info.port| parameter will be set as | 145 // |addresses| object upon success. The |info.port| parameter will be set as |
141 // the sin(6)_port field of the sockaddr_in{6} struct. Returns OK if | 146 // the sin(6)_port field of the sockaddr_in{6} struct. Returns OK if |
142 // successful or an error code upon failure. | 147 // successful or an error code upon failure. |
143 // | 148 // |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 239 |
235 DISALLOW_COPY_AND_ASSIGN(SingleRequestHostResolver); | 240 DISALLOW_COPY_AND_ASSIGN(SingleRequestHostResolver); |
236 }; | 241 }; |
237 | 242 |
238 // Creates a HostResolver implementation that queries the underlying system. | 243 // Creates a HostResolver implementation that queries the underlying system. |
239 // (Except if a unit-test has changed the global HostResolverProc using | 244 // (Except if a unit-test has changed the global HostResolverProc using |
240 // ScopedHostResolverProc to intercept requests to the system). | 245 // ScopedHostResolverProc to intercept requests to the system). |
241 // |max_concurrent_resolves| is how many resolve requests will be allowed to | 246 // |max_concurrent_resolves| is how many resolve requests will be allowed to |
242 // run in parallel. Pass HostResolver::kDefaultParallelism to choose a | 247 // run in parallel. Pass HostResolver::kDefaultParallelism to choose a |
243 // default value. | 248 // default value. |
| 249 // |max_retry_attempts| is the maximum number of times we will retry for host |
| 250 // resolution. Pass HostResolver::kDefaultRetryAttempts to choose a default |
| 251 // value. |
244 HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves, | 252 HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves, |
| 253 size_t max_retry_attempts, |
245 NetLog* net_log); | 254 NetLog* net_log); |
246 | 255 |
247 } // namespace net | 256 } // namespace net |
248 | 257 |
249 #endif // NET_BASE_HOST_RESOLVER_H_ | 258 #endif // NET_BASE_HOST_RESOLVER_H_ |
OLD | NEW |