| 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 #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) |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 } | 362 } |
| 363 | 363 |
| 364 // Completion happens during OnJobComplete(Job*). | 364 // Completion happens during OnJobComplete(Job*). |
| 365 return ERR_IO_PENDING; | 365 return ERR_IO_PENDING; |
| 366 } | 366 } |
| 367 | 367 |
| 368 // 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 |
| 369 // cancelled requests from Job::requests_. | 369 // cancelled requests from Job::requests_. |
| 370 void HostResolverImpl::CancelRequest(RequestHandle req_handle) { | 370 void HostResolverImpl::CancelRequest(RequestHandle req_handle) { |
| 371 if (shutdown_) { | 371 if (shutdown_) { |
| 372 // TODO(eroman): temp hack for: http://crbug.com/16972. | 372 // TODO(eroman): temp hack for: http://crbug.com/18373 |
| 373 // Because we destroy outstanding requests during Shutdown() as part of | 373 // Because we destroy outstanding requests during Shutdown(), |
| 374 // hack http://crbug.com/15513, |req_handle| is already cancelled. | 374 // |req_handle| is already cancelled. |
| 375 LOG(ERROR) << "Called HostResolverImpl::CancelRequest() after Shutdown()."; | 375 LOG(ERROR) << "Called HostResolverImpl::CancelRequest() after Shutdown()."; |
| 376 StackTrace().PrintBacktrace(); | 376 StackTrace().PrintBacktrace(); |
| 377 return; | 377 return; |
| 378 } | 378 } |
| 379 Request* req = reinterpret_cast<Request*>(req_handle); | 379 Request* req = reinterpret_cast<Request*>(req_handle); |
| 380 DCHECK(req); | 380 DCHECK(req); |
| 381 DCHECK(req->job()); | 381 DCHECK(req->job()); |
| 382 // NULL out the fields of req, to mark it as cancelled. | 382 // NULL out the fields of req, to mark it as cancelled. |
| 383 req->MarkAsCancelled(); | 383 req->MarkAsCancelled(); |
| 384 NotifyObserversCancelRequest(req->id(), req->info()); | 384 NotifyObserversCancelRequest(req->id(), req->info()); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 483 |
| 484 void HostResolverImpl::NotifyObserversCancelRequest(int request_id, | 484 void HostResolverImpl::NotifyObserversCancelRequest(int request_id, |
| 485 const RequestInfo& info) { | 485 const RequestInfo& info) { |
| 486 for (ObserversList::iterator it = observers_.begin(); | 486 for (ObserversList::iterator it = observers_.begin(); |
| 487 it != observers_.end(); ++it) { | 487 it != observers_.end(); ++it) { |
| 488 (*it)->OnCancelResolution(request_id, info); | 488 (*it)->OnCancelResolution(request_id, info); |
| 489 } | 489 } |
| 490 } | 490 } |
| 491 | 491 |
| 492 } // namespace net | 492 } // namespace net |
| OLD | NEW |