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_IMPL_H_ | 5 #ifndef NET_BASE_HOST_RESOLVER_IMPL_H_ |
6 #define NET_BASE_HOST_RESOLVER_IMPL_H_ | 6 #define NET_BASE_HOST_RESOLVER_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // | 55 // |
56 // Whenever we try to resolve the host, we post a delayed task to check if host | 56 // Whenever we try to resolve the host, we post a delayed task to check if host |
57 // resolution (OnLookupComplete) is completed or not. If the original attempt | 57 // resolution (OnLookupComplete) is completed or not. If the original attempt |
58 // hasn't completed, then we start another attempt for host resolution. We take | 58 // hasn't completed, then we start another attempt for host resolution. We take |
59 // the results from the first attempt that finishes and ignore the results from | 59 // the results from the first attempt that finishes and ignore the results from |
60 // all other attempts. | 60 // all other attempts. |
61 | 61 |
62 class NET_API HostResolverImpl | 62 class NET_API HostResolverImpl |
63 : public HostResolver, | 63 : public HostResolver, |
64 NON_EXPORTED_BASE(public base::NonThreadSafe), | 64 NON_EXPORTED_BASE(public base::NonThreadSafe), |
65 public NetworkChangeNotifier::IPAddressObserver { | 65 public NetworkChangeNotifier::IPAddressObserver, |
| 66 public NetworkChangeNotifier::DNSObserver { |
66 public: | 67 public: |
67 // The index into |job_pools_| for the various job pools. Pools with a higher | 68 // The index into |job_pools_| for the various job pools. Pools with a higher |
68 // index have lower priority. | 69 // index have lower priority. |
69 // | 70 // |
70 // Note: This is currently unused, since there is a single pool | 71 // Note: This is currently unused, since there is a single pool |
71 // for all requests. | 72 // for all requests. |
72 enum JobPoolIndex { | 73 enum JobPoolIndex { |
73 POOL_NORMAL = 0, | 74 POOL_NORMAL = 0, |
74 POOL_COUNT, | 75 POOL_COUNT, |
75 }; | 76 }; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 268 } |
268 | 269 |
269 // Helper methods to get and set retry_factor_. | 270 // Helper methods to get and set retry_factor_. |
270 uint32 retry_factor() const { | 271 uint32 retry_factor() const { |
271 return retry_factor_; | 272 return retry_factor_; |
272 } | 273 } |
273 void set_retry_factor(const uint32 retry_factor) { | 274 void set_retry_factor(const uint32 retry_factor) { |
274 retry_factor_ = retry_factor; | 275 retry_factor_ = retry_factor; |
275 } | 276 } |
276 | 277 |
| 278 // NetworkChangeNotifier::OnDNSChanged methods: |
| 279 virtual void OnDNSChanged(); |
| 280 |
277 // Cache of host resolution results. | 281 // Cache of host resolution results. |
278 scoped_ptr<HostCache> cache_; | 282 scoped_ptr<HostCache> cache_; |
279 | 283 |
280 // Map from hostname to outstanding job. | 284 // Map from hostname to outstanding job. |
281 JobMap jobs_; | 285 JobMap jobs_; |
282 | 286 |
283 // Maximum number of concurrent jobs allowed, across all pools. Each job may | 287 // Maximum number of concurrent jobs allowed, across all pools. Each job may |
284 // create multiple concurrent resolve attempts for the hostname. | 288 // create multiple concurrent resolve attempts for the hostname. |
285 size_t max_jobs_; | 289 size_t max_jobs_; |
286 | 290 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 HostResolverFlags additional_resolver_flags_; | 338 HostResolverFlags additional_resolver_flags_; |
335 | 339 |
336 NetLog* net_log_; | 340 NetLog* net_log_; |
337 | 341 |
338 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); | 342 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); |
339 }; | 343 }; |
340 | 344 |
341 } // namespace net | 345 } // namespace net |
342 | 346 |
343 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ | 347 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ |
OLD | NEW |