| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |