Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: net/base/host_resolver_impl.h

Issue 8533011: Remove unused HostResolver::Observer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove id from AsyncHostResolver; add double-cancelation check; comments' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/host_resolver.h ('k') | net/base/host_resolver_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // HostResolver methods: 129 // HostResolver methods:
130 virtual int Resolve(const RequestInfo& info, 130 virtual int Resolve(const RequestInfo& info,
131 AddressList* addresses, 131 AddressList* addresses,
132 OldCompletionCallback* callback, 132 OldCompletionCallback* callback,
133 RequestHandle* out_req, 133 RequestHandle* out_req,
134 const BoundNetLog& source_net_log) OVERRIDE; 134 const BoundNetLog& source_net_log) OVERRIDE;
135 virtual int ResolveFromCache(const RequestInfo& info, 135 virtual int ResolveFromCache(const RequestInfo& info,
136 AddressList* addresses, 136 AddressList* addresses,
137 const BoundNetLog& source_net_log) OVERRIDE; 137 const BoundNetLog& source_net_log) OVERRIDE;
138 virtual void CancelRequest(RequestHandle req) OVERRIDE; 138 virtual void CancelRequest(RequestHandle req) OVERRIDE;
139 virtual void AddObserver(HostResolver::Observer* observer) OVERRIDE;
140 virtual void RemoveObserver(HostResolver::Observer* observer) OVERRIDE;
141 virtual void SetDefaultAddressFamily(AddressFamily address_family) OVERRIDE; 139 virtual void SetDefaultAddressFamily(AddressFamily address_family) OVERRIDE;
142 virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE; 140 virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE;
143 virtual void ProbeIPv6Support() OVERRIDE; 141 virtual void ProbeIPv6Support() OVERRIDE;
144 virtual HostCache* GetHostCache() OVERRIDE; 142 virtual HostCache* GetHostCache() OVERRIDE;
145 143
146 private: 144 private:
147 // Allow tests to access our innards for testing purposes. 145 // Allow tests to access our innards for testing purposes.
148 friend class LookupAttemptHostResolverProc; 146 friend class LookupAttemptHostResolverProc;
149 147
150 // Allow tests to access our innards for testing purposes. 148 // Allow tests to access our innards for testing purposes.
151 FRIEND_TEST_ALL_PREFIXES(HostResolverImplTest, MultipleAttempts); 149 FRIEND_TEST_ALL_PREFIXES(HostResolverImplTest, MultipleAttempts);
152 150
153 class Job; 151 class Job;
154 class JobPool; 152 class JobPool;
155 class IPv6ProbeJob; 153 class IPv6ProbeJob;
156 class Request; 154 class Request;
157 typedef std::vector<Request*> RequestsList; 155 typedef std::vector<Request*> RequestsList;
158 typedef HostCache::Key Key; 156 typedef HostCache::Key Key;
159 typedef std::map<Key, scoped_refptr<Job> > JobMap; 157 typedef std::map<Key, scoped_refptr<Job> > JobMap;
160 typedef std::vector<HostResolver::Observer*> ObserversList;
161 158
162 // Helper used by |Resolve()| and |ResolveFromCache()|. Performs IP 159 // Helper used by |Resolve()| and |ResolveFromCache()|. Performs IP
163 // literal and cache lookup, returns OK if successful, 160 // literal and cache lookup, returns OK if successful,
164 // ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is 161 // ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is
165 // incompatible, ERR_DNS_CACHE_MISS if entry was not found in cache. 162 // incompatible, ERR_DNS_CACHE_MISS if entry was not found in cache.
166 int ResolveHelper(int request_id, 163 int ResolveHelper(const Key& key,
167 const Key& key,
168 const RequestInfo& info, 164 const RequestInfo& info,
169 AddressList* addresses, 165 AddressList* addresses,
170 const BoundNetLog& request_net_log); 166 const BoundNetLog& request_net_log);
171 167
172 // Tries to resolve |key| as an IP, returns true and sets |net_error| if 168 // Tries to resolve |key| as an IP, returns true and sets |net_error| if
173 // succeeds, returns false otherwise. 169 // succeeds, returns false otherwise.
174 bool ResolveAsIP(const Key& key, 170 bool ResolveAsIP(const Key& key,
175 const RequestInfo& info, 171 const RequestInfo& info,
176 int* net_error, 172 int* net_error,
177 AddressList* addresses); 173 AddressList* addresses);
(...skipping 30 matching lines...) Expand all
208 // from |jobs_| and does not cache the result (ERR_ABORTED). 204 // from |jobs_| and does not cache the result (ERR_ABORTED).
209 void AbortJob(Job* job); 205 void AbortJob(Job* job);
210 206
211 // Used by both OnJobComplete() and AbortJob(); 207 // Used by both OnJobComplete() and AbortJob();
212 void OnJobCompleteInternal(Job* job, int net_error, int os_error, 208 void OnJobCompleteInternal(Job* job, int net_error, int os_error,
213 const AddressList& addrlist); 209 const AddressList& addrlist);
214 210
215 // Called when a request has just been started. 211 // Called when a request has just been started.
216 void OnStartRequest(const BoundNetLog& source_net_log, 212 void OnStartRequest(const BoundNetLog& source_net_log,
217 const BoundNetLog& request_net_log, 213 const BoundNetLog& request_net_log,
218 int request_id,
219 const RequestInfo& info); 214 const RequestInfo& info);
220 215
221 // Called when a request has just completed (before its callback is run). 216 // Called when a request has just completed (before its callback is run).
222 void OnFinishRequest(const BoundNetLog& source_net_log, 217 void OnFinishRequest(const BoundNetLog& source_net_log,
223 const BoundNetLog& request_net_log, 218 const BoundNetLog& request_net_log,
224 int request_id,
225 const RequestInfo& info, 219 const RequestInfo& info,
226 int net_error, 220 int net_error,
227 int os_error); 221 int os_error);
228 222
229 // Called when a request has been cancelled. 223 // Called when a request has been cancelled.
230 void OnCancelRequest(const BoundNetLog& source_net_log, 224 void OnCancelRequest(const BoundNetLog& source_net_log,
231 const BoundNetLog& request_net_log, 225 const BoundNetLog& request_net_log,
232 int request_id,
233 const RequestInfo& info); 226 const RequestInfo& info);
234 227
235 // Notify IPv6ProbeJob not to call back, and discard reference to the job. 228 // Notify IPv6ProbeJob not to call back, and discard reference to the job.
236 void DiscardIPv6ProbeJob(); 229 void DiscardIPv6ProbeJob();
237 230
238 // Callback from IPv6 probe activity. 231 // Callback from IPv6 probe activity.
239 void IPv6ProbeSetDefaultAddressFamily(AddressFamily address_family); 232 void IPv6ProbeSetDefaultAddressFamily(AddressFamily address_family);
240 233
241 // Returns true if the constraints for |pool| are met, and a new job can be 234 // Returns true if the constraints for |pool| are met, and a new job can be
242 // created for this pool. 235 // created for this pool.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 uint32 retry_factor_; 314 uint32 retry_factor_;
322 315
323 // The information to track pending requests for a JobPool, as well as 316 // The information to track pending requests for a JobPool, as well as
324 // how many outstanding jobs the pool already has, and its constraints. 317 // how many outstanding jobs the pool already has, and its constraints.
325 JobPool* job_pools_[POOL_COUNT]; 318 JobPool* job_pools_[POOL_COUNT];
326 319
327 // The job that OnJobComplete() is currently processing (needed in case 320 // The job that OnJobComplete() is currently processing (needed in case
328 // HostResolver gets deleted from within the callback). 321 // HostResolver gets deleted from within the callback).
329 scoped_refptr<Job> cur_completing_job_; 322 scoped_refptr<Job> cur_completing_job_;
330 323
331 // The observers to notify when a request starts/ends.
332 ObserversList observers_;
333
334 // Monotonically increasing ID number to assign to the next request.
335 // Observers are the only consumers of this ID number.
336 int next_request_id_;
337
338 // Monotonically increasing ID number to assign to the next job. 324 // Monotonically increasing ID number to assign to the next job.
339 // The only consumer of this ID is the requests tracing code. 325 // The only consumer of this ID is the requests tracing code.
340 int next_job_id_; 326 int next_job_id_;
341 327
342 // The procedure to use for resolving host names. This will be NULL, except 328 // The procedure to use for resolving host names. This will be NULL, except
343 // in the case of unit-tests which inject custom host resolving behaviors. 329 // in the case of unit-tests which inject custom host resolving behaviors.
344 scoped_refptr<HostResolverProc> resolver_proc_; 330 scoped_refptr<HostResolverProc> resolver_proc_;
345 331
346 // Address family to use when the request doesn't specify one. 332 // Address family to use when the request doesn't specify one.
347 AddressFamily default_address_family_; 333 AddressFamily default_address_family_;
(...skipping 10 matching lines...) Expand all
358 HostResolverFlags additional_resolver_flags_; 344 HostResolverFlags additional_resolver_flags_;
359 345
360 NetLog* net_log_; 346 NetLog* net_log_;
361 347
362 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); 348 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl);
363 }; 349 };
364 350
365 } // namespace net 351 } // namespace net
366 352
367 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ 353 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_
OLDNEW
« no previous file with comments | « net/base/host_resolver.h ('k') | net/base/host_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698