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

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

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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 | « net/base/directory_lister.cc ('k') | net/disk_cache/backend_unittest.cc » ('j') | 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) 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
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
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
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
OLDNEW
« no previous file with comments | « net/base/directory_lister.cc ('k') | net/disk_cache/backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698