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_EXPORT HostResolverImpl | 62 class NET_EXPORT 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 298 } |
298 | 299 |
299 // Helper methods to get and set retry_factor_. | 300 // Helper methods to get and set retry_factor_. |
300 uint32 retry_factor() const { | 301 uint32 retry_factor() const { |
301 return retry_factor_; | 302 return retry_factor_; |
302 } | 303 } |
303 void set_retry_factor(const uint32 retry_factor) { | 304 void set_retry_factor(const uint32 retry_factor) { |
304 retry_factor_ = retry_factor; | 305 retry_factor_ = retry_factor; |
305 } | 306 } |
306 | 307 |
| 308 // NetworkChangeNotifier::OnDNSChanged methods: |
| 309 virtual void OnDNSChanged(); |
| 310 |
307 // Cache of host resolution results. | 311 // Cache of host resolution results. |
308 scoped_ptr<HostCache> cache_; | 312 scoped_ptr<HostCache> cache_; |
309 | 313 |
310 // Map from hostname to outstanding job. | 314 // Map from hostname to outstanding job. |
311 JobMap jobs_; | 315 JobMap jobs_; |
312 | 316 |
313 // Maximum number of concurrent jobs allowed, across all pools. Each job may | 317 // Maximum number of concurrent jobs allowed, across all pools. Each job may |
314 // create multiple concurrent resolve attempts for the hostname. | 318 // create multiple concurrent resolve attempts for the hostname. |
315 size_t max_jobs_; | 319 size_t max_jobs_; |
316 | 320 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 HostResolverFlags additional_resolver_flags_; | 368 HostResolverFlags additional_resolver_flags_; |
365 | 369 |
366 NetLog* net_log_; | 370 NetLog* net_log_; |
367 | 371 |
368 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); | 372 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); |
369 }; | 373 }; |
370 | 374 |
371 } // namespace net | 375 } // namespace net |
372 | 376 |
373 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ | 377 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ |
OLD | NEW |