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

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

Issue 1518037: Cancel IPv6 probe jobs during shutdown.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add a DCHECK for shutdown Created 10 years, 8 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "net/base/net_log.h" 6 #include "net/base/net_log.h"
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <deque> 9 #include <deque>
10 10
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 Flush(); // Give initial setup call. 844 Flush(); // Give initial setup call.
845 } 845 }
846 846
847 void HostResolverImpl::Shutdown() { 847 void HostResolverImpl::Shutdown() {
848 shutdown_ = true; 848 shutdown_ = true;
849 849
850 // Cancel the outstanding jobs. 850 // Cancel the outstanding jobs.
851 for (JobMap::iterator it = jobs_.begin(); it != jobs_.end(); ++it) 851 for (JobMap::iterator it = jobs_.begin(); it != jobs_.end(); ++it)
852 it->second->Cancel(); 852 it->second->Cancel();
853 jobs_.clear(); 853 jobs_.clear();
854 DiscardIPv6ProbeJob();
854 } 855 }
855 856
856 void HostResolverImpl::ClearRequestsTrace() { 857 void HostResolverImpl::ClearRequestsTrace() {
857 if (requests_trace_) 858 if (requests_trace_)
858 requests_trace_->Clear(); 859 requests_trace_->Clear();
859 } 860 }
860 861
861 void HostResolverImpl::EnableRequestsTracing(bool enable) { 862 void HostResolverImpl::EnableRequestsTracing(bool enable) {
862 requests_trace_ = enable ? new RequestsTrace : NULL; 863 requests_trace_ = enable ? new RequestsTrace : NULL;
863 if (enable) { 864 if (enable) {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONCANCEL); 1072 net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_OBSERVER_ONCANCEL);
1072 } 1073 }
1073 1074
1074 net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL); 1075 net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL);
1075 } 1076 }
1076 1077
1077 void HostResolverImpl::Flush() { 1078 void HostResolverImpl::Flush() {
1078 if (cache_.get()) 1079 if (cache_.get())
1079 cache_->clear(); 1080 cache_->clear();
1080 if (ipv6_probe_monitoring_) { 1081 if (ipv6_probe_monitoring_) {
1082 DCHECK(!shutdown_);
1083 if (shutdown_)
1084 return;
1081 DiscardIPv6ProbeJob(); 1085 DiscardIPv6ProbeJob();
1082 ipv6_probe_job_ = new IPv6ProbeJob(this); 1086 ipv6_probe_job_ = new IPv6ProbeJob(this);
1083 ipv6_probe_job_->Start(); 1087 ipv6_probe_job_->Start();
1084 } 1088 }
1085 } 1089 }
1086 1090
1087 void HostResolverImpl::DiscardIPv6ProbeJob() { 1091 void HostResolverImpl::DiscardIPv6ProbeJob() {
1088 if (ipv6_probe_job_.get()) { 1092 if (ipv6_probe_job_.get()) {
1089 ipv6_probe_job_->Cancel(); 1093 ipv6_probe_job_->Cancel();
1090 ipv6_probe_job_ = NULL; 1094 ipv6_probe_job_ = NULL;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 if (r == req) 1189 if (r == req)
1186 return error; 1190 return error;
1187 1191
1188 r->OnComplete(error, AddressList()); 1192 r->OnComplete(error, AddressList());
1189 } 1193 }
1190 1194
1191 return ERR_IO_PENDING; 1195 return ERR_IO_PENDING;
1192 } 1196 }
1193 1197
1194 } // namespace net 1198 } // 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