| Index: net/base/host_resolver.cc
|
| ===================================================================
|
| --- net/base/host_resolver.cc (revision 19453)
|
| +++ net/base/host_resolver.cc (working copy)
|
| @@ -398,7 +398,8 @@
|
| //-----------------------------------------------------------------------------
|
|
|
| HostResolver::HostResolver(int max_cache_entries, int cache_duration_ms)
|
| - : cache_(max_cache_entries, cache_duration_ms), next_request_id_(0) {
|
| + : cache_(max_cache_entries, cache_duration_ms), next_request_id_(0),
|
| + shutdown_(false) {
|
| #if defined(OS_WIN)
|
| EnsureWinsockInit();
|
| #endif
|
| @@ -421,6 +422,9 @@
|
| AddressList* addresses,
|
| CompletionCallback* callback,
|
| Request** out_req) {
|
| + if (shutdown_)
|
| + return ERR_UNEXPECTED;
|
| +
|
| // Choose a unique ID number for observers to see.
|
| int request_id = next_request_id_++;
|
|
|
| @@ -517,6 +521,15 @@
|
| observers_.erase(it);
|
| }
|
|
|
| +void HostResolver::Shutdown() {
|
| + shutdown_ = true;
|
| +
|
| + // Cancel the outstanding jobs.
|
| + for (JobMap::iterator it = jobs_.begin(); it != jobs_.end(); ++it)
|
| + it->second->Cancel();
|
| + jobs_.clear();
|
| +}
|
| +
|
| void HostResolver::AddOutstandingJob(Job* job) {
|
| scoped_refptr<Job>& found_job = jobs_[job->host()];
|
| DCHECK(!found_job);
|
|
|