Chromium Code Reviews| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 job->Cancel(); | 450 job->Cancel(); |
| 451 } else { | 451 } else { |
| 452 // Otherwise the job is just sitting in a queue. | 452 // Otherwise the job is just sitting in a queue. |
| 453 PendingJobsQueue::iterator it = | 453 PendingJobsQueue::iterator it = |
| 454 std::find(pending_jobs_.begin(), pending_jobs_.end(), job); | 454 std::find(pending_jobs_.begin(), pending_jobs_.end(), job); |
| 455 DCHECK(it != pending_jobs_.end()); | 455 DCHECK(it != pending_jobs_.end()); |
| 456 pending_jobs_.erase(it); | 456 pending_jobs_.erase(it); |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 | 459 |
| 460 LoadState MultiThreadedProxyResolver::GetLoadState(RequestHandle req) const { | |
| 461 DCHECK(CalledOnValidThread()); | |
| 462 DCHECK(req); | |
| 463 | |
| 464 Job* job = reinterpret_cast<Job*>(req); | |
| 465 if (job->executor()) | |
| 466 return job->executor()->resolver()->GetLoadStateThreadSafe(req); | |
|
eroman
2011/11/07 21:52:01
passing in |req| doesn't make sense here, please p
willchan no longer on Chromium
2011/11/07 23:23:39
Done.
| |
| 467 return LOAD_STATE_RESOLVING_PROXY_FOR_URL; | |
| 468 } | |
| 469 | |
| 470 LoadState MultiThreadedProxyResolver::GetLoadStateThreadSafe( | |
| 471 RequestHandle req) const { | |
| 472 NOTIMPLEMENTED(); | |
| 473 return LOAD_STATE_IDLE; | |
| 474 } | |
| 475 | |
| 460 void MultiThreadedProxyResolver::CancelSetPacScript() { | 476 void MultiThreadedProxyResolver::CancelSetPacScript() { |
| 461 DCHECK(CalledOnValidThread()); | 477 DCHECK(CalledOnValidThread()); |
| 462 DCHECK_EQ(0u, pending_jobs_.size()); | 478 DCHECK_EQ(0u, pending_jobs_.size()); |
| 463 DCHECK_EQ(1u, executors_.size()); | 479 DCHECK_EQ(1u, executors_.size()); |
| 464 DCHECK_EQ(Job::TYPE_SET_PAC_SCRIPT, | 480 DCHECK_EQ(Job::TYPE_SET_PAC_SCRIPT, |
| 465 executors_[0]->outstanding_job()->type()); | 481 executors_[0]->outstanding_job()->type()); |
| 466 | 482 |
| 467 // Defensively clear some data which shouldn't be getting used | 483 // Defensively clear some data which shouldn't be getting used |
| 468 // anymore. | 484 // anymore. |
| 469 current_script_data_ = NULL; | 485 current_script_data_ = NULL; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 562 return; | 578 return; |
| 563 | 579 |
| 564 // Get the next job to process (FIFO). Transfer it from the pending queue | 580 // Get the next job to process (FIFO). Transfer it from the pending queue |
| 565 // to the executor. | 581 // to the executor. |
| 566 scoped_refptr<Job> job = pending_jobs_.front(); | 582 scoped_refptr<Job> job = pending_jobs_.front(); |
| 567 pending_jobs_.pop_front(); | 583 pending_jobs_.pop_front(); |
| 568 executor->StartJob(job); | 584 executor->StartJob(job); |
| 569 } | 585 } |
| 570 | 586 |
| 571 } // namespace net | 587 } // namespace net |
| OLD | NEW |