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

Side by Side Diff: chrome/browser/net/dns_probe_job.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/net/dns_probe_job.h" 5 #include "chrome/browser/net/dns_probe_job.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 dns_client_(dns_client.Pass()), 98 dns_client_(dns_client.Pass()),
99 callback_(callback), 99 callback_(callback),
100 good_running_(false), 100 good_running_(false),
101 bad_running_(false), 101 bad_running_(false),
102 good_result_(QUERY_UNKNOWN), 102 good_result_(QUERY_UNKNOWN),
103 bad_result_(QUERY_UNKNOWN), 103 bad_result_(QUERY_UNKNOWN),
104 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 104 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
105 DCHECK(dns_client_.get()); 105 DCHECK(dns_client_.get());
106 DCHECK(dns_client_->GetConfig()); 106 DCHECK(dns_client_->GetConfig());
107 107
108 MessageLoop::current()->PostTask( 108 base::MessageLoop::current()->PostTask(
109 FROM_HERE, 109 FROM_HERE,
110 base::Bind(&DnsProbeJobImpl::Start, 110 base::Bind(&DnsProbeJobImpl::Start, weak_factory_.GetWeakPtr()));
111 weak_factory_.GetWeakPtr()));
112 } 111 }
113 112
114 DnsProbeJobImpl::~DnsProbeJobImpl() { 113 DnsProbeJobImpl::~DnsProbeJobImpl() {
115 } 114 }
116 115
117 void DnsProbeJobImpl::Start() { 116 void DnsProbeJobImpl::Start() {
118 // TODO(ttuttle): Pick a good random hostname for the bad case. 117 // TODO(ttuttle): Pick a good random hostname for the bad case.
119 // Consider running transactions in series? 118 // Consider running transactions in series?
120 good_transaction_ = CreateTransaction("google.com"); 119 good_transaction_ = CreateTransaction("google.com");
121 bad_transaction_ = CreateTransaction("thishostname.doesnotresolve"); 120 bad_transaction_ = CreateTransaction("thishostname.doesnotresolve");
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 226
228 scoped_ptr<DnsProbeJob> DnsProbeJob::CreateJob( 227 scoped_ptr<DnsProbeJob> DnsProbeJob::CreateJob(
229 scoped_ptr<DnsClient> dns_client, 228 scoped_ptr<DnsClient> dns_client,
230 const CallbackType& callback, 229 const CallbackType& callback,
231 NetLog* net_log) { 230 NetLog* net_log) {
232 return scoped_ptr<DnsProbeJob>( 231 return scoped_ptr<DnsProbeJob>(
233 new DnsProbeJobImpl(dns_client.Pass(), callback, net_log)); 232 new DnsProbeJobImpl(dns_client.Pass(), callback, net_log));
234 } 233 }
235 234
236 } // namespace chrome_browser_net 235 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698