| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // Thread safety: This class is not threadsafe, and must only be called | 44 // Thread safety: This class is not threadsafe, and must only be called |
| 45 // from one thread! | 45 // from one thread! |
| 46 // | 46 // |
| 47 // The HostResolverImpl enforces |max_jobs_| as the maximum number of concurrent | 47 // The HostResolverImpl enforces |max_jobs_| as the maximum number of concurrent |
| 48 // threads. | 48 // threads. |
| 49 // | 49 // |
| 50 // Requests are ordered in the queue based on their priority. | 50 // Requests are ordered in the queue based on their priority. |
| 51 | 51 |
| 52 class HostResolverImpl : public HostResolver, | 52 class HostResolverImpl : public HostResolver, |
| 53 public base::NonThreadSafe, | 53 public base::NonThreadSafe, |
| 54 public NetworkChangeNotifier::Observer { | 54 public NetworkChangeNotifier::IPAddressObserver { |
| 55 public: | 55 public: |
| 56 // The index into |job_pools_| for the various job pools. Pools with a higher | 56 // The index into |job_pools_| for the various job pools. Pools with a higher |
| 57 // index have lower priority. | 57 // index have lower priority. |
| 58 // | 58 // |
| 59 // Note: This is currently unused, since there is a single pool | 59 // Note: This is currently unused, since there is a single pool |
| 60 // for all requests. | 60 // for all requests. |
| 61 enum JobPoolIndex { | 61 enum JobPoolIndex { |
| 62 POOL_NORMAL = 0, | 62 POOL_NORMAL = 0, |
| 63 POOL_COUNT, | 63 POOL_COUNT, |
| 64 }; | 64 }; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 // Adds a pending request |req| to |pool|. | 217 // Adds a pending request |req| to |pool|. |
| 218 int EnqueueRequest(JobPool* pool, Request* req); | 218 int EnqueueRequest(JobPool* pool, Request* req); |
| 219 | 219 |
| 220 // Cancels all jobs. | 220 // Cancels all jobs. |
| 221 void CancelAllJobs(); | 221 void CancelAllJobs(); |
| 222 | 222 |
| 223 // Aborts all in progress jobs (but might start new ones). | 223 // Aborts all in progress jobs (but might start new ones). |
| 224 void AbortAllInProgressJobs(); | 224 void AbortAllInProgressJobs(); |
| 225 | 225 |
| 226 // NetworkChangeNotifier::Observer methods: | 226 // NetworkChangeNotifier::IPAddressObserver methods: |
| 227 virtual void OnIPAddressChanged(); | 227 virtual void OnIPAddressChanged(); |
| 228 | 228 |
| 229 // Cache of host resolution results. | 229 // Cache of host resolution results. |
| 230 scoped_ptr<HostCache> cache_; | 230 scoped_ptr<HostCache> cache_; |
| 231 | 231 |
| 232 // Map from hostname to outstanding job. | 232 // Map from hostname to outstanding job. |
| 233 JobMap jobs_; | 233 JobMap jobs_; |
| 234 | 234 |
| 235 // Maximum number of concurrent jobs allowed, across all pools. | 235 // Maximum number of concurrent jobs allowed, across all pools. |
| 236 size_t max_jobs_; | 236 size_t max_jobs_; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 HostResolverFlags additional_resolver_flags_; | 276 HostResolverFlags additional_resolver_flags_; |
| 277 | 277 |
| 278 NetLog* net_log_; | 278 NetLog* net_log_; |
| 279 | 279 |
| 280 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); | 280 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); |
| 281 }; | 281 }; |
| 282 | 282 |
| 283 } // namespace net | 283 } // namespace net |
| 284 | 284 |
| 285 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ | 285 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ |
| OLD | NEW |