OLD | NEW |
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 "net/proxy/multi_threaded_proxy_resolver.h" | 5 #include "net/proxy/multi_threaded_proxy_resolver.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
| 8 #include <utility> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
12 #include "base/location.h" | 13 #include "base/location.h" |
13 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
17 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 executor_->Destroy(); | 570 executor_->Destroy(); |
570 executor_ = nullptr; | 571 executor_ = nullptr; |
571 factory_ = nullptr; | 572 factory_ = nullptr; |
572 } | 573 } |
573 | 574 |
574 private: | 575 private: |
575 void OnExecutorReady(Executor* executor) override { | 576 void OnExecutorReady(Executor* executor) override { |
576 int error = OK; | 577 int error = OK; |
577 if (executor->resolver()) { | 578 if (executor->resolver()) { |
578 resolver_out_->reset(new MultiThreadedProxyResolver( | 579 resolver_out_->reset(new MultiThreadedProxyResolver( |
579 resolver_factory_.Pass(), max_num_threads_, script_data_.Pass(), | 580 std::move(resolver_factory_), max_num_threads_, |
580 executor_)); | 581 std::move(script_data_), executor_)); |
581 } else { | 582 } else { |
582 error = ERR_PAC_SCRIPT_FAILED; | 583 error = ERR_PAC_SCRIPT_FAILED; |
583 executor_->Destroy(); | 584 executor_->Destroy(); |
584 } | 585 } |
585 factory_->RemoveJob(this); | 586 factory_->RemoveJob(this); |
586 factory_ = nullptr; | 587 factory_ = nullptr; |
587 callback_.Run(error); | 588 callback_.Run(error); |
588 } | 589 } |
589 | 590 |
590 MultiThreadedProxyResolverFactory* factory_; | 591 MultiThreadedProxyResolverFactory* factory_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 return ERR_IO_PENDING; | 624 return ERR_IO_PENDING; |
624 } | 625 } |
625 | 626 |
626 void MultiThreadedProxyResolverFactory::RemoveJob( | 627 void MultiThreadedProxyResolverFactory::RemoveJob( |
627 MultiThreadedProxyResolverFactory::Job* job) { | 628 MultiThreadedProxyResolverFactory::Job* job) { |
628 size_t erased = jobs_.erase(job); | 629 size_t erased = jobs_.erase(job); |
629 DCHECK_EQ(1u, erased); | 630 DCHECK_EQ(1u, erased); |
630 } | 631 } |
631 | 632 |
632 } // namespace net | 633 } // namespace net |
OLD | NEW |