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

Side by Side Diff: net/proxy/multi_threaded_proxy_resolver.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
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/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 DCHECK(!outstanding_job_); 314 DCHECK(!outstanding_job_);
315 outstanding_job_ = job; 315 outstanding_job_ = job;
316 316
317 // Run the job. Once it has completed (regardless of whether it was 317 // Run the job. Once it has completed (regardless of whether it was
318 // cancelled), it will invoke OnJobCompleted() on this thread. 318 // cancelled), it will invoke OnJobCompleted() on this thread.
319 job->set_executor(this); 319 job->set_executor(this);
320 job->FinishedWaitingForThread(); 320 job->FinishedWaitingForThread();
321 thread_->message_loop()->PostTask( 321 thread_->message_loop()->PostTask(
322 FROM_HERE, 322 FROM_HERE,
323 NewRunnableMethod(job, &Job::Run, 323 NewRunnableMethod(job, &Job::Run,
324 base::MessageLoopProxy::CreateForCurrentThread())); 324 base::MessageLoopProxy::current()));
325 } 325 }
326 326
327 void MultiThreadedProxyResolver::Executor::OnJobCompleted(Job* job) { 327 void MultiThreadedProxyResolver::Executor::OnJobCompleted(Job* job) {
328 DCHECK_EQ(job, outstanding_job_.get()); 328 DCHECK_EQ(job, outstanding_job_.get());
329 outstanding_job_ = NULL; 329 outstanding_job_ = NULL;
330 coordinator_->OnExecutorReady(this); 330 coordinator_->OnExecutorReady(this);
331 } 331 }
332 332
333 void MultiThreadedProxyResolver::Executor::Destroy() { 333 void MultiThreadedProxyResolver::Executor::Destroy() {
334 DCHECK(coordinator_); 334 DCHECK(coordinator_);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 return; 562 return;
563 563
564 // Get the next job to process (FIFO). Transfer it from the pending queue 564 // Get the next job to process (FIFO). Transfer it from the pending queue
565 // to the executor. 565 // to the executor.
566 scoped_refptr<Job> job = pending_jobs_.front(); 566 scoped_refptr<Job> job = pending_jobs_.front();
567 pending_jobs_.pop_front(); 567 pending_jobs_.pop_front();
568 executor->StartJob(job); 568 executor->StartJob(job);
569 } 569 }
570 570
571 } // namespace net 571 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/dhcp_proxy_script_fetcher_win.cc ('k') | net/proxy/network_delegate_error_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698