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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // | 68 // |
69 // If |cache| is NULL, then no caching is used. Otherwise we take | 69 // If |cache| is NULL, then no caching is used. Otherwise we take |
70 // ownership of the |cache| pointer, and will free it during destructor. | 70 // ownership of the |cache| pointer, and will free it during destructor. |
71 // | 71 // |
72 // |resolver_proc| is used to perform the actual resolves; it must be | 72 // |resolver_proc| is used to perform the actual resolves; it must be |
73 // thread-safe since it is run from multiple worker threads. If | 73 // thread-safe since it is run from multiple worker threads. If |
74 // |resolver_proc| is NULL then the default host resolver procedure is | 74 // |resolver_proc| is NULL then the default host resolver procedure is |
75 // used (which is SystemHostResolverProc except if overridden). | 75 // used (which is SystemHostResolverProc except if overridden). |
76 // |max_jobs| specifies the maximum number of threads that the host resolver | 76 // |max_jobs| specifies the maximum number of threads that the host resolver |
77 // will use. Use SetPoolConstraints() to specify finer-grain settings. | 77 // will use. Use SetPoolConstraints() to specify finer-grain settings. |
| 78 // |
| 79 // |net_log| must remain valid for the life of the HostResolverImpl. |
78 HostResolverImpl(HostResolverProc* resolver_proc, | 80 HostResolverImpl(HostResolverProc* resolver_proc, |
79 HostCache* cache, | 81 HostCache* cache, |
80 size_t max_jobs); | 82 size_t max_jobs, |
| 83 NetLog* net_log); |
81 | 84 |
82 // HostResolver methods: | 85 // HostResolver methods: |
83 virtual int Resolve(const RequestInfo& info, | 86 virtual int Resolve(const RequestInfo& info, |
84 AddressList* addresses, | 87 AddressList* addresses, |
85 CompletionCallback* callback, | 88 CompletionCallback* callback, |
86 RequestHandle* out_req, | 89 RequestHandle* out_req, |
87 const BoundNetLog& net_log); | 90 const BoundNetLog& source_net_log); |
88 virtual void CancelRequest(RequestHandle req); | 91 virtual void CancelRequest(RequestHandle req); |
89 virtual void AddObserver(HostResolver::Observer* observer); | 92 virtual void AddObserver(HostResolver::Observer* observer); |
90 virtual void RemoveObserver(HostResolver::Observer* observer); | 93 virtual void RemoveObserver(HostResolver::Observer* observer); |
91 | 94 |
92 // Set address family, and disable IPv6 probe support. | 95 // Set address family, and disable IPv6 probe support. |
93 virtual void SetDefaultAddressFamily(AddressFamily address_family); | 96 virtual void SetDefaultAddressFamily(AddressFamily address_family); |
94 | 97 |
95 // Continuously observe whether IPv6 is supported, and set the allowable | 98 // Continuously observe whether IPv6 is supported, and set the allowable |
96 // address family to IPv4 iff IPv6 is not supported. | 99 // address family to IPv4 iff IPv6 is not supported. |
97 void ProbeIPv6Support(); | 100 void ProbeIPv6Support(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 Job* FindOutstandingJob(const Key& key); | 150 Job* FindOutstandingJob(const Key& key); |
148 | 151 |
149 // Removes |job| from the outstanding jobs list. | 152 // Removes |job| from the outstanding jobs list. |
150 void RemoveOutstandingJob(Job* job); | 153 void RemoveOutstandingJob(Job* job); |
151 | 154 |
152 // Callback for when |job| has completed with |net_error| and |addrlist|. | 155 // Callback for when |job| has completed with |net_error| and |addrlist|. |
153 void OnJobComplete(Job* job, int net_error, int os_error, | 156 void OnJobComplete(Job* job, int net_error, int os_error, |
154 const AddressList& addrlist); | 157 const AddressList& addrlist); |
155 | 158 |
156 // Called when a request has just been started. | 159 // Called when a request has just been started. |
157 void OnStartRequest(const BoundNetLog& net_log, | 160 void OnStartRequest(const BoundNetLog& source_net_log, |
| 161 const BoundNetLog& request_net_log, |
158 int request_id, | 162 int request_id, |
159 const RequestInfo& info); | 163 const RequestInfo& info); |
160 | 164 |
161 // Called when a request has just completed (before its callback is run). | 165 // Called when a request has just completed (before its callback is run). |
162 void OnFinishRequest(const BoundNetLog& net_log, | 166 void OnFinishRequest(const BoundNetLog& source_net_log, |
| 167 const BoundNetLog& request_net_log, |
163 int request_id, | 168 int request_id, |
164 const RequestInfo& info, | 169 const RequestInfo& info, |
165 int net_error, | 170 int net_error, |
166 int os_error, | 171 int os_error); |
167 bool was_from_cache); | |
168 | 172 |
169 // Called when a request has been cancelled. | 173 // Called when a request has been cancelled. |
170 void OnCancelRequest(const BoundNetLog& net_log, | 174 void OnCancelRequest(const BoundNetLog& source_net_log, |
| 175 const BoundNetLog& request_net_log, |
171 int request_id, | 176 int request_id, |
172 const RequestInfo& info); | 177 const RequestInfo& info); |
173 | 178 |
174 // NetworkChangeNotifier::Observer methods: | 179 // NetworkChangeNotifier::Observer methods: |
175 virtual void OnIPAddressChanged(); | 180 virtual void OnIPAddressChanged(); |
176 | 181 |
177 // Notify IPv6ProbeJob not to call back, and discard reference to the job. | 182 // Notify IPv6ProbeJob not to call back, and discard reference to the job. |
178 void DiscardIPv6ProbeJob(); | 183 void DiscardIPv6ProbeJob(); |
179 | 184 |
180 // Callback from IPv6 probe activity. | 185 // Callback from IPv6 probe activity. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 // family. | 253 // family. |
249 // When false, explicit setting of address family is used. | 254 // When false, explicit setting of address family is used. |
250 bool ipv6_probe_monitoring_; | 255 bool ipv6_probe_monitoring_; |
251 | 256 |
252 // The last un-cancelled IPv6ProbeJob (if any). | 257 // The last un-cancelled IPv6ProbeJob (if any). |
253 scoped_refptr<IPv6ProbeJob> ipv6_probe_job_; | 258 scoped_refptr<IPv6ProbeJob> ipv6_probe_job_; |
254 | 259 |
255 // Any resolver flags that should be added to a request by default. | 260 // Any resolver flags that should be added to a request by default. |
256 HostResolverFlags additional_resolver_flags_; | 261 HostResolverFlags additional_resolver_flags_; |
257 | 262 |
| 263 NetLog* net_log_; |
| 264 |
258 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); | 265 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); |
259 }; | 266 }; |
260 | 267 |
261 } // namespace net | 268 } // namespace net |
262 | 269 |
263 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ | 270 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ |
OLD | NEW |