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

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

Issue 160478: Modify a temporary hack to be more inclusive.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: change comment Created 11 years, 4 months 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 | « no previous file | no next file » | 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) 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 #include "net/base/host_resolver_impl.h" 5 #include "net/base/host_resolver_impl.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <ws2tcpip.h> 8 #include <ws2tcpip.h>
9 #include <wspiapi.h> // Needed for Win2k compat. 9 #include <wspiapi.h> // Needed for Win2k compat.
10 #elif defined(OS_POSIX) 10 #elif defined(OS_POSIX)
11 #include <netdb.h> 11 #include <netdb.h>
12 #include <sys/socket.h> 12 #include <sys/socket.h>
13 #endif 13 #endif
14 #if defined(OS_LINUX) 14 #if defined(OS_LINUX)
15 #include <resolv.h> 15 #include <resolv.h>
16 #endif 16 #endif
17 17
18 #include "base/compiler_specific.h" 18 #include "base/compiler_specific.h"
19 #include "base/debug_util.h"
19 #include "base/message_loop.h" 20 #include "base/message_loop.h"
20 #include "base/stl_util-inl.h" 21 #include "base/stl_util-inl.h"
21 #include "base/string_util.h" 22 #include "base/string_util.h"
22 #include "base/time.h" 23 #include "base/time.h"
23 #include "base/worker_pool.h" 24 #include "base/worker_pool.h"
24 #include "net/base/address_list.h" 25 #include "net/base/address_list.h"
25 #include "net/base/host_resolver_proc.h" 26 #include "net/base/host_resolver_proc.h"
26 #include "net/base/net_errors.h" 27 #include "net/base/net_errors.h"
27 28
28 #if defined(OS_WIN) 29 #if defined(OS_WIN)
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 job->Start(); 361 job->Start();
361 } 362 }
362 363
363 // Completion happens during OnJobComplete(Job*). 364 // Completion happens during OnJobComplete(Job*).
364 return ERR_IO_PENDING; 365 return ERR_IO_PENDING;
365 } 366 }
366 367
367 // See OnJobComplete(Job*) for why it is important not to clean out 368 // See OnJobComplete(Job*) for why it is important not to clean out
368 // cancelled requests from Job::requests_. 369 // cancelled requests from Job::requests_.
369 void HostResolverImpl::CancelRequest(RequestHandle req_handle) { 370 void HostResolverImpl::CancelRequest(RequestHandle req_handle) {
371 if (shutdown_) {
372 // TODO(eroman): temp hack for: http://crbug.com/16972.
373 // Because we destroy outstanding requests during Shutdown() as part of
374 // hack http://crbug.com/15513, |req_handle| is already cancelled.
375 LOG(ERROR) << "Called HostResolverImpl::CancelRequest() after Shutdown().";
376 StackTrace().PrintBacktrace();
377 return;
378 }
370 Request* req = reinterpret_cast<Request*>(req_handle); 379 Request* req = reinterpret_cast<Request*>(req_handle);
371 DCHECK(req); 380 DCHECK(req);
372 DCHECK(req->job()); 381 DCHECK(req->job());
373 // NULL out the fields of req, to mark it as cancelled. 382 // NULL out the fields of req, to mark it as cancelled.
374 req->MarkAsCancelled(); 383 req->MarkAsCancelled();
375 NotifyObserversCancelRequest(req->id(), req->info()); 384 NotifyObserversCancelRequest(req->id(), req->info());
376 } 385 }
377 386
378 void HostResolverImpl::AddObserver(Observer* observer) { 387 void HostResolverImpl::AddObserver(Observer* observer) {
379 observers_.push_back(observer); 388 observers_.push_back(observer);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 483
475 void HostResolverImpl::NotifyObserversCancelRequest(int request_id, 484 void HostResolverImpl::NotifyObserversCancelRequest(int request_id,
476 const RequestInfo& info) { 485 const RequestInfo& info) {
477 for (ObserversList::iterator it = observers_.begin(); 486 for (ObserversList::iterator it = observers_.begin();
478 it != observers_.end(); ++it) { 487 it != observers_.end(); ++it) {
479 (*it)->OnCancelResolution(request_id, info); 488 (*it)->OnCancelResolution(request_id, info);
480 } 489 }
481 } 490 }
482 491
483 } // namespace net 492 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698