OLD | NEW |
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 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <Winsock2.h> | 8 #include <Winsock2.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <netdb.h> | 10 #include <netdb.h> |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 : id_(id), | 349 : id_(id), |
350 key_(key), | 350 key_(key), |
351 resolver_(resolver), | 351 resolver_(resolver), |
352 origin_loop_(MessageLoop::current()), | 352 origin_loop_(MessageLoop::current()), |
353 resolver_proc_(resolver->effective_resolver_proc()), | 353 resolver_proc_(resolver->effective_resolver_proc()), |
354 error_(OK), | 354 error_(OK), |
355 os_error_(0), | 355 os_error_(0), |
356 had_non_speculative_request_(false), | 356 had_non_speculative_request_(false), |
357 net_log_(BoundNetLog::Make(net_log, | 357 net_log_(BoundNetLog::Make(net_log, |
358 NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB)) { | 358 NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB)) { |
359 net_log_.BeginEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_JOB, | 359 net_log_.BeginEvent( |
360 new JobCreationParameters(key.hostname, | 360 NetLog::TYPE_HOST_RESOLVER_IMPL_JOB, |
361 source_net_log.source())); | 361 make_scoped_refptr( |
| 362 new JobCreationParameters(key.hostname, source_net_log.source()))); |
362 } | 363 } |
363 | 364 |
364 // Attaches a request to this job. The job takes ownership of |req| and will | 365 // Attaches a request to this job. The job takes ownership of |req| and will |
365 // take care to delete it. | 366 // take care to delete it. |
366 void AddRequest(Request* req) { | 367 void AddRequest(Request* req) { |
367 req->request_net_log().BeginEvent( | 368 req->request_net_log().BeginEvent( |
368 NetLog::TYPE_HOST_RESOLVER_IMPL_JOB_ATTACH, | 369 NetLog::TYPE_HOST_RESOLVER_IMPL_JOB_ATTACH, |
369 new NetLogSourceParameter("source_dependency", net_log_.source())); | 370 make_scoped_refptr(new NetLogSourceParameter( |
| 371 "source_dependency", net_log_.source()))); |
370 | 372 |
371 req->set_job(this); | 373 req->set_job(this); |
372 requests_.push_back(req); | 374 requests_.push_back(req); |
373 | 375 |
374 if (!req->info().is_speculative()) | 376 if (!req->info().is_speculative()) |
375 had_non_speculative_request_ = true; | 377 had_non_speculative_request_ = true; |
376 } | 378 } |
377 | 379 |
378 // Called from origin loop. | 380 // Called from origin loop. |
379 void Start() { | 381 void Start() { |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 | 1233 |
1232 cur_completing_job_ = NULL; | 1234 cur_completing_job_ = NULL; |
1233 } | 1235 } |
1234 | 1236 |
1235 void HostResolverImpl::OnStartRequest(const BoundNetLog& source_net_log, | 1237 void HostResolverImpl::OnStartRequest(const BoundNetLog& source_net_log, |
1236 const BoundNetLog& request_net_log, | 1238 const BoundNetLog& request_net_log, |
1237 int request_id, | 1239 int request_id, |
1238 const RequestInfo& info) { | 1240 const RequestInfo& info) { |
1239 source_net_log.BeginEvent( | 1241 source_net_log.BeginEvent( |
1240 NetLog::TYPE_HOST_RESOLVER_IMPL, | 1242 NetLog::TYPE_HOST_RESOLVER_IMPL, |
1241 new NetLogSourceParameter("source_dependency", request_net_log.source())); | 1243 make_scoped_refptr(new NetLogSourceParameter( |
| 1244 "source_dependency", request_net_log.source()))); |
1242 | 1245 |
1243 request_net_log.BeginEvent( | 1246 request_net_log.BeginEvent( |
1244 NetLog::TYPE_HOST_RESOLVER_IMPL_REQUEST, | 1247 NetLog::TYPE_HOST_RESOLVER_IMPL_REQUEST, |
1245 new RequestInfoParameters(info, source_net_log.source())); | 1248 make_scoped_refptr(new RequestInfoParameters( |
| 1249 info, source_net_log.source()))); |
1246 | 1250 |
1247 // Notify the observers of the start. | 1251 // Notify the observers of the start. |
1248 if (!observers_.empty()) { | 1252 if (!observers_.empty()) { |
1249 for (ObserversList::iterator it = observers_.begin(); | 1253 for (ObserversList::iterator it = observers_.begin(); |
1250 it != observers_.end(); ++it) { | 1254 it != observers_.end(); ++it) { |
1251 (*it)->OnStartResolution(request_id, info); | 1255 (*it)->OnStartResolution(request_id, info); |
1252 } | 1256 } |
1253 } | 1257 } |
1254 } | 1258 } |
1255 | 1259 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 job_pools_[i]->ResetNumOutstandingJobs(); | 1448 job_pools_[i]->ResetNumOutstandingJobs(); |
1445 JobMap jobs; | 1449 JobMap jobs; |
1446 jobs.swap(jobs_); | 1450 jobs.swap(jobs_); |
1447 for (JobMap::iterator it = jobs.begin(); it != jobs.end(); ++it) { | 1451 for (JobMap::iterator it = jobs.begin(); it != jobs.end(); ++it) { |
1448 AbortJob(it->second); | 1452 AbortJob(it->second); |
1449 it->second->Cancel(); | 1453 it->second->Cancel(); |
1450 } | 1454 } |
1451 } | 1455 } |
1452 | 1456 |
1453 } // namespace net | 1457 } // namespace net |
OLD | NEW |