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

Side by Side Diff: net/proxy/multi_threaded_proxy_resolver.cc

Issue 10066045: RefCounted types should not have public destructors, net/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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) 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/proxy/multi_threaded_proxy_resolver.h" 5 #include "net/proxy/multi_threaded_proxy_resolver.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 ProxyResolver* resolver = executor()->resolver(); 194 ProxyResolver* resolver = executor()->resolver();
195 int rv = resolver->SetPacScript(script_data_, CompletionCallback()); 195 int rv = resolver->SetPacScript(script_data_, CompletionCallback());
196 196
197 DCHECK_NE(rv, ERR_IO_PENDING); 197 DCHECK_NE(rv, ERR_IO_PENDING);
198 origin_loop->PostTask( 198 origin_loop->PostTask(
199 FROM_HERE, 199 FROM_HERE,
200 base::Bind(&SetPacScriptJob::RequestComplete, this, rv)); 200 base::Bind(&SetPacScriptJob::RequestComplete, this, rv));
201 } 201 }
202 202
203 private: 203 private:
204 virtual ~SetPacScriptJob() {}
205
204 // Runs the completion callback on the origin thread. 206 // Runs the completion callback on the origin thread.
205 void RequestComplete(int result_code) { 207 void RequestComplete(int result_code) {
206 // The task may have been cancelled after it was started. 208 // The task may have been cancelled after it was started.
207 if (!was_cancelled() && has_user_callback()) { 209 if (!was_cancelled() && has_user_callback()) {
208 RunUserCallback(result_code); 210 RunUserCallback(result_code);
209 } 211 }
210 OnJobCompleted(); 212 OnJobCompleted();
211 } 213 }
212 214
213 const scoped_refptr<ProxyResolverScriptData> script_data_; 215 const scoped_refptr<ProxyResolverScriptData> script_data_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 int rv = resolver->GetProxyForURL( 262 int rv = resolver->GetProxyForURL(
261 url_, &results_buf_, CompletionCallback(), NULL, net_log_); 263 url_, &results_buf_, CompletionCallback(), NULL, net_log_);
262 DCHECK_NE(rv, ERR_IO_PENDING); 264 DCHECK_NE(rv, ERR_IO_PENDING);
263 265
264 origin_loop->PostTask( 266 origin_loop->PostTask(
265 FROM_HERE, 267 FROM_HERE,
266 base::Bind(&GetProxyForURLJob::QueryComplete, this, rv)); 268 base::Bind(&GetProxyForURLJob::QueryComplete, this, rv));
267 } 269 }
268 270
269 private: 271 private:
272 virtual ~GetProxyForURLJob() {}
273
270 // Runs the completion callback on the origin thread. 274 // Runs the completion callback on the origin thread.
271 void QueryComplete(int result_code) { 275 void QueryComplete(int result_code) {
272 // The Job may have been cancelled after it was started. 276 // The Job may have been cancelled after it was started.
273 if (!was_cancelled()) { 277 if (!was_cancelled()) {
274 if (result_code >= OK) { // Note: unit-tests use values > 0. 278 if (result_code >= OK) { // Note: unit-tests use values > 0.
275 results_->Use(results_buf_); 279 results_->Use(results_buf_);
276 } 280 }
277 RunUserCallback(result_code); 281 RunUserCallback(result_code);
278 } 282 }
279 OnJobCompleted(); 283 OnJobCompleted();
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 return; 581 return;
578 582
579 // Get the next job to process (FIFO). Transfer it from the pending queue 583 // Get the next job to process (FIFO). Transfer it from the pending queue
580 // to the executor. 584 // to the executor.
581 scoped_refptr<Job> job = pending_jobs_.front(); 585 scoped_refptr<Job> job = pending_jobs_.front();
582 pending_jobs_.pop_front(); 586 pending_jobs_.pop_front();
583 executor->StartJob(job); 587 executor->StartJob(job);
584 } 588 }
585 589
586 } // namespace net 590 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698