| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 : public base::RefCountedThreadSafe<HostResolverImpl::Job> { | 357 : public base::RefCountedThreadSafe<HostResolverImpl::Job> { |
| 358 public: | 358 public: |
| 359 Job(int id, | 359 Job(int id, |
| 360 HostResolverImpl* resolver, | 360 HostResolverImpl* resolver, |
| 361 const Key& key, | 361 const Key& key, |
| 362 const BoundNetLog& source_net_log, | 362 const BoundNetLog& source_net_log, |
| 363 NetLog* net_log) | 363 NetLog* net_log) |
| 364 : id_(id), | 364 : id_(id), |
| 365 key_(key), | 365 key_(key), |
| 366 resolver_(resolver), | 366 resolver_(resolver), |
| 367 origin_loop_(base::MessageLoopProxy::CreateForCurrentThread()), | 367 origin_loop_(base::MessageLoopProxy::current()), |
| 368 resolver_proc_(resolver->effective_resolver_proc()), | 368 resolver_proc_(resolver->effective_resolver_proc()), |
| 369 unresponsive_delay_(resolver->unresponsive_delay()), | 369 unresponsive_delay_(resolver->unresponsive_delay()), |
| 370 attempt_number_(0), | 370 attempt_number_(0), |
| 371 completed_attempt_number_(0), | 371 completed_attempt_number_(0), |
| 372 completed_attempt_error_(ERR_UNEXPECTED), | 372 completed_attempt_error_(ERR_UNEXPECTED), |
| 373 had_non_speculative_request_(false), | 373 had_non_speculative_request_(false), |
| 374 net_log_(BoundNetLog::Make(net_log, | 374 net_log_(BoundNetLog::Make(net_log, |
| 375 NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB)) { | 375 NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB)) { |
| 376 DCHECK(resolver); | 376 DCHECK(resolver); |
| 377 net_log_.BeginEvent( | 377 net_log_.BeginEvent( |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 | 818 |
| 819 //----------------------------------------------------------------------------- | 819 //----------------------------------------------------------------------------- |
| 820 | 820 |
| 821 // This class represents a request to the worker pool for a "probe for IPv6 | 821 // This class represents a request to the worker pool for a "probe for IPv6 |
| 822 // support" call. | 822 // support" call. |
| 823 class HostResolverImpl::IPv6ProbeJob | 823 class HostResolverImpl::IPv6ProbeJob |
| 824 : public base::RefCountedThreadSafe<HostResolverImpl::IPv6ProbeJob> { | 824 : public base::RefCountedThreadSafe<HostResolverImpl::IPv6ProbeJob> { |
| 825 public: | 825 public: |
| 826 explicit IPv6ProbeJob(HostResolverImpl* resolver) | 826 explicit IPv6ProbeJob(HostResolverImpl* resolver) |
| 827 : resolver_(resolver), | 827 : resolver_(resolver), |
| 828 origin_loop_(base::MessageLoopProxy::CreateForCurrentThread()) { | 828 origin_loop_(base::MessageLoopProxy::current()) { |
| 829 DCHECK(resolver); | 829 DCHECK(resolver); |
| 830 } | 830 } |
| 831 | 831 |
| 832 void Start() { | 832 void Start() { |
| 833 DCHECK(origin_loop_->BelongsToCurrentThread()); | 833 DCHECK(origin_loop_->BelongsToCurrentThread()); |
| 834 if (was_cancelled()) | 834 if (was_cancelled()) |
| 835 return; | 835 return; |
| 836 const bool kIsSlow = true; | 836 const bool kIsSlow = true; |
| 837 base::WorkerPool::PostTask( | 837 base::WorkerPool::PostTask( |
| 838 FROM_HERE, NewRunnableMethod(this, &IPv6ProbeJob::DoProbe), kIsSlow); | 838 FROM_HERE, NewRunnableMethod(this, &IPv6ProbeJob::DoProbe), kIsSlow); |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; | 1638 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; |
| 1639 } else { | 1639 } else { |
| 1640 additional_resolver_flags_ &= ~HOST_RESOLVER_LOOPBACK_ONLY; | 1640 additional_resolver_flags_ &= ~HOST_RESOLVER_LOOPBACK_ONLY; |
| 1641 } | 1641 } |
| 1642 #endif | 1642 #endif |
| 1643 AbortAllInProgressJobs(); | 1643 AbortAllInProgressJobs(); |
| 1644 // |this| may be deleted inside AbortAllInProgressJobs(). | 1644 // |this| may be deleted inside AbortAllInProgressJobs(). |
| 1645 } | 1645 } |
| 1646 | 1646 |
| 1647 } // namespace net | 1647 } // namespace net |
| OLD | NEW |