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

Side by Side Diff: net/dns/async_host_resolver.cc

Issue 8533011: Remove unused HostResolver::Observer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove RequestInfo::referrer and Request::id 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
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 #include "net/dns/async_host_resolver.h" 5 #include "net/dns/async_host_resolver.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 DCHECK(request); 280 DCHECK(request);
281 281
282 request->source_net_log().BeginEvent( 282 request->source_net_log().BeginEvent(
283 NetLog::TYPE_ASYNC_HOST_RESOLVER, 283 NetLog::TYPE_ASYNC_HOST_RESOLVER,
284 make_scoped_refptr(new NetLogSourceParameter( 284 make_scoped_refptr(new NetLogSourceParameter(
285 "source_dependency", request->request_net_log().source()))); 285 "source_dependency", request->request_net_log().source())));
286 request->request_net_log().BeginEvent( 286 request->request_net_log().BeginEvent(
287 NetLog::TYPE_ASYNC_HOST_RESOLVER_REQUEST, 287 NetLog::TYPE_ASYNC_HOST_RESOLVER_REQUEST,
288 make_scoped_refptr(new RequestParameters( 288 make_scoped_refptr(new RequestParameters(
289 request->info(), request->source_net_log().source()))); 289 request->info(), request->source_net_log().source())));
290
291 FOR_EACH_OBSERVER(
292 HostResolver::Observer, observers_,
293 OnStartResolution(request->id(), request->info()));
294 } 290 }
295 291
296 void AsyncHostResolver::OnFinish(Request* request, int result) { 292 void AsyncHostResolver::OnFinish(Request* request, int result) {
297 DCHECK(request); 293 DCHECK(request);
298 bool was_resolved = result == OK;
299
300 FOR_EACH_OBSERVER(
301 HostResolver::Observer, observers_,
302 OnFinishResolutionWithStatus(
303 request->id(), was_resolved, request->info()));
304
305 request->request_net_log().EndEventWithNetErrorCode( 294 request->request_net_log().EndEventWithNetErrorCode(
306 NetLog::TYPE_ASYNC_HOST_RESOLVER_REQUEST, result); 295 NetLog::TYPE_ASYNC_HOST_RESOLVER_REQUEST, result);
307 request->source_net_log().EndEvent( 296 request->source_net_log().EndEvent(
308 NetLog::TYPE_ASYNC_HOST_RESOLVER, NULL); 297 NetLog::TYPE_ASYNC_HOST_RESOLVER, NULL);
309 } 298 }
310 299
311 void AsyncHostResolver::OnCancel(Request* request) { 300 void AsyncHostResolver::OnCancel(Request* request) {
312 DCHECK(request); 301 DCHECK(request);
313 302
314 FOR_EACH_OBSERVER(
315 HostResolver::Observer, observers_,
316 OnCancelResolution(request->id(), request->info()));
317
318 request->request_net_log().AddEvent( 303 request->request_net_log().AddEvent(
319 NetLog::TYPE_CANCELLED, NULL); 304 NetLog::TYPE_CANCELLED, NULL);
320 request->request_net_log().EndEvent( 305 request->request_net_log().EndEvent(
321 NetLog::TYPE_ASYNC_HOST_RESOLVER_REQUEST, NULL); 306 NetLog::TYPE_ASYNC_HOST_RESOLVER_REQUEST, NULL);
322 request->source_net_log().EndEvent( 307 request->source_net_log().EndEvent(
323 NetLog::TYPE_ASYNC_HOST_RESOLVER, NULL); 308 NetLog::TYPE_ASYNC_HOST_RESOLVER, NULL);
324 } 309 }
325 310
326 void AsyncHostResolver::CancelRequest(RequestHandle req_handle) { 311 void AsyncHostResolver::CancelRequest(RequestHandle req_handle) {
327 scoped_ptr<Request> request(reinterpret_cast<Request*>(req_handle)); 312 scoped_ptr<Request> request(reinterpret_cast<Request*>(req_handle));
328 DCHECK(request.get()); 313 DCHECK(request.get());
329 314
330 KeyRequestListMap::iterator it = requestlist_map_.find(request->key()); 315 KeyRequestListMap::iterator it = requestlist_map_.find(request->key());
331 if (it != requestlist_map_.end()) 316 if (it != requestlist_map_.end())
332 it->second.remove(request.get()); 317 it->second.remove(request.get());
333 else 318 else
334 pending_requests_[request->priority()].remove(request.get()); 319 pending_requests_[request->priority()].remove(request.get());
335 } 320 }
336 321
337 void AsyncHostResolver::AddObserver(HostResolver::Observer* observer) {
338 observers_.AddObserver(observer);
339 }
340
341 void AsyncHostResolver::RemoveObserver(HostResolver::Observer* observer) {
342 observers_.RemoveObserver(observer);
343 }
344
345 void AsyncHostResolver::SetDefaultAddressFamily( 322 void AsyncHostResolver::SetDefaultAddressFamily(
346 AddressFamily address_family) { 323 AddressFamily address_family) {
347 NOTIMPLEMENTED(); 324 NOTIMPLEMENTED();
348 } 325 }
349 326
350 AddressFamily AsyncHostResolver::GetDefaultAddressFamily() const { 327 AddressFamily AsyncHostResolver::GetDefaultAddressFamily() const {
351 return ADDRESS_FAMILY_IPV4; 328 return ADDRESS_FAMILY_IPV4;
352 } 329 }
353 330
354 HostCache* AsyncHostResolver::GetHostCache() { 331 HostCache* AsyncHostResolver::GetHostCache() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 ProcessPending(); 385 ProcessPending();
409 } 386 }
410 387
411 AsyncHostResolver::Request* AsyncHostResolver::CreateNewRequest( 388 AsyncHostResolver::Request* AsyncHostResolver::CreateNewRequest(
412 const RequestInfo& info, 389 const RequestInfo& info,
413 OldCompletionCallback* callback, 390 OldCompletionCallback* callback,
414 AddressList* addresses, 391 AddressList* addresses,
415 const BoundNetLog& source_net_log) { 392 const BoundNetLog& source_net_log) {
416 BoundNetLog request_net_log = BoundNetLog::Make(net_log_, 393 BoundNetLog request_net_log = BoundNetLog::Make(net_log_,
417 NetLog::SOURCE_ASYNC_HOST_RESOLVER_REQUEST); 394 NetLog::SOURCE_ASYNC_HOST_RESOLVER_REQUEST);
418 int id = next_request_id_++; 395 int id = next_request_id_++;
cbentzel 2011/11/15 10:49:01 Could you remove id here, and from Request?
419 return new Request( 396 return new Request(
420 this, source_net_log, request_net_log, id, info, callback, addresses); 397 this, source_net_log, request_net_log, id, info, callback, addresses);
421 } 398 }
422 399
423 bool AsyncHostResolver::AttachToRequestList(Request* request) { 400 bool AsyncHostResolver::AttachToRequestList(Request* request) {
424 KeyRequestListMap::iterator it = requestlist_map_.find(request->key()); 401 KeyRequestListMap::iterator it = requestlist_map_.find(request->key());
425 if (it == requestlist_map_.end()) 402 if (it == requestlist_map_.end())
426 return false; 403 return false;
427 it->second.push_back(request); 404 it->second.push_back(request);
428 return true; 405 return true;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 it = requests.erase(it); 493 it = requests.erase(it);
517 } else { 494 } else {
518 ++it; 495 ++it;
519 } 496 }
520 } 497 }
521 } 498 }
522 StartNewTransactionFor(request); 499 StartNewTransactionFor(request);
523 } 500 }
524 501
525 } // namespace net 502 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698