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 #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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 void ProbeIPv6Support(); | 98 void ProbeIPv6Support(); |
99 | 99 |
100 virtual HostResolverImpl* GetAsHostResolverImpl() { return this; } | 100 virtual HostResolverImpl* GetAsHostResolverImpl() { return this; } |
101 | 101 |
102 // TODO(eroman): hack for http://crbug.com/15513 | 102 // TODO(eroman): hack for http://crbug.com/15513 |
103 void Shutdown(); | 103 void Shutdown(); |
104 | 104 |
105 // Returns the cache this resolver uses, or NULL if caching is disabled. | 105 // Returns the cache this resolver uses, or NULL if caching is disabled. |
106 HostCache* cache() { return cache_.get(); } | 106 HostCache* cache() { return cache_.get(); } |
107 | 107 |
108 // Clears the request trace log. | |
109 void ClearRequestsTrace(); | |
110 | |
111 // Starts/ends capturing requests to a trace log. | |
112 void EnableRequestsTracing(bool enable); | |
113 | |
114 bool IsRequestsTracingEnabled() const; | |
115 | |
116 // Gets a copy of the requests trace log. | |
117 bool GetRequestsTrace(CapturingNetLog::EntryList* entries); | |
118 | |
119 // Applies a set of constraints for requests that belong to the specified | 108 // Applies a set of constraints for requests that belong to the specified |
120 // pool. NOTE: Don't call this after requests have been already been started. | 109 // pool. NOTE: Don't call this after requests have been already been started. |
121 // | 110 // |
122 // |pool_index| -- Specifies which pool these constraints should be applied | 111 // |pool_index| -- Specifies which pool these constraints should be applied |
123 // to. | 112 // to. |
124 // |max_outstanding_jobs| -- How many concurrent jobs are allowed for this | 113 // |max_outstanding_jobs| -- How many concurrent jobs are allowed for this |
125 // pool. | 114 // pool. |
126 // |max_pending_requests| -- How many requests can be enqueued for this pool | 115 // |max_pending_requests| -- How many requests can be enqueued for this pool |
127 // before we start dropping requests. Dropped | 116 // before we start dropping requests. Dropped |
128 // requests fail with | 117 // requests fail with |
129 // ERR_HOST_RESOLVER_QUEUE_TOO_LARGE. | 118 // ERR_HOST_RESOLVER_QUEUE_TOO_LARGE. |
130 void SetPoolConstraints(JobPoolIndex pool_index, | 119 void SetPoolConstraints(JobPoolIndex pool_index, |
131 size_t max_outstanding_jobs, | 120 size_t max_outstanding_jobs, |
132 size_t max_pending_requests); | 121 size_t max_pending_requests); |
133 | 122 |
134 private: | 123 private: |
135 class Job; | 124 class Job; |
136 class JobPool; | 125 class JobPool; |
137 class IPv6ProbeJob; | 126 class IPv6ProbeJob; |
138 class Request; | 127 class Request; |
139 class RequestsTrace; | |
140 typedef std::vector<Request*> RequestsList; | 128 typedef std::vector<Request*> RequestsList; |
141 typedef HostCache::Key Key; | 129 typedef HostCache::Key Key; |
142 typedef std::map<Key, scoped_refptr<Job> > JobMap; | 130 typedef std::map<Key, scoped_refptr<Job> > JobMap; |
143 typedef std::vector<HostResolver::Observer*> ObserversList; | 131 typedef std::vector<HostResolver::Observer*> ObserversList; |
144 | 132 |
145 // If any completion callbacks are pending when the resolver is destroyed, | 133 // If any completion callbacks are pending when the resolver is destroyed, |
146 // the host resolutions are cancelled, and the completion callbacks will not | 134 // the host resolutions are cancelled, and the completion callbacks will not |
147 // be called. | 135 // be called. |
148 virtual ~HostResolverImpl(); | 136 virtual ~HostResolverImpl(); |
149 | 137 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 scoped_refptr<HostResolverProc> resolver_proc_; | 237 scoped_refptr<HostResolverProc> resolver_proc_; |
250 | 238 |
251 // Address family to use when the request doesn't specify one. | 239 // Address family to use when the request doesn't specify one. |
252 AddressFamily default_address_family_; | 240 AddressFamily default_address_family_; |
253 | 241 |
254 // TODO(eroman): hack for http://crbug.com/15513 | 242 // TODO(eroman): hack for http://crbug.com/15513 |
255 bool shutdown_; | 243 bool shutdown_; |
256 | 244 |
257 NetworkChangeNotifier* const network_change_notifier_; | 245 NetworkChangeNotifier* const network_change_notifier_; |
258 | 246 |
259 scoped_refptr<RequestsTrace> requests_trace_; | |
260 | |
261 // Indicate if probing is done after each network change event to set address | 247 // Indicate if probing is done after each network change event to set address |
262 // family. | 248 // family. |
263 // When false, explicit setting of address family is used. | 249 // When false, explicit setting of address family is used. |
264 bool ipv6_probe_monitoring_; | 250 bool ipv6_probe_monitoring_; |
265 | 251 |
266 // The last un-cancelled IPv6ProbeJob (if any). | 252 // The last un-cancelled IPv6ProbeJob (if any). |
267 scoped_refptr<IPv6ProbeJob> ipv6_probe_job_; | 253 scoped_refptr<IPv6ProbeJob> ipv6_probe_job_; |
268 | 254 |
269 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); | 255 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); |
270 }; | 256 }; |
271 | 257 |
272 } // namespace net | 258 } // namespace net |
273 | 259 |
274 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ | 260 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ |
OLD | NEW |