| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mojo_proxy_resolver_factory_impl.h" | 5 #include "net/proxy/mojo_proxy_resolver_factory_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 std::unique_ptr<ProxyResolverV8TracingFactory> proxy_resolver_factory) | 87 std::unique_ptr<ProxyResolverV8TracingFactory> proxy_resolver_factory) |
| 88 : proxy_resolver_impl_factory_(std::move(proxy_resolver_factory)) {} | 88 : proxy_resolver_impl_factory_(std::move(proxy_resolver_factory)) {} |
| 89 | 89 |
| 90 MojoProxyResolverFactoryImpl::MojoProxyResolverFactoryImpl() | 90 MojoProxyResolverFactoryImpl::MojoProxyResolverFactoryImpl() |
| 91 : MojoProxyResolverFactoryImpl(ProxyResolverV8TracingFactory::Create()) {} | 91 : MojoProxyResolverFactoryImpl(ProxyResolverV8TracingFactory::Create()) {} |
| 92 | 92 |
| 93 MojoProxyResolverFactoryImpl::~MojoProxyResolverFactoryImpl() { | 93 MojoProxyResolverFactoryImpl::~MojoProxyResolverFactoryImpl() { |
| 94 } | 94 } |
| 95 | 95 |
| 96 void MojoProxyResolverFactoryImpl::CreateResolver( | 96 void MojoProxyResolverFactoryImpl::CreateResolver( |
| 97 const mojo::String& pac_script, | 97 const std::string& pac_script, |
| 98 mojo::InterfaceRequest<interfaces::ProxyResolver> request, | 98 mojo::InterfaceRequest<interfaces::ProxyResolver> request, |
| 99 interfaces::ProxyResolverFactoryRequestClientPtr client) { | 99 interfaces::ProxyResolverFactoryRequestClientPtr client) { |
| 100 // The Job will call RemoveJob on |this| when either the create request | 100 // The Job will call RemoveJob on |this| when either the create request |
| 101 // finishes or |request| or |client| encounters a connection error. | 101 // finishes or |request| or |client| encounters a connection error. |
| 102 std::unique_ptr<Job> job = base::MakeUnique<Job>( | 102 std::unique_ptr<Job> job = |
| 103 this, ProxyResolverScriptData::FromUTF8(pac_script.To<std::string>()), | 103 base::MakeUnique<Job>(this, ProxyResolverScriptData::FromUTF8(pac_script), |
| 104 proxy_resolver_impl_factory_.get(), std::move(request), | 104 proxy_resolver_impl_factory_.get(), |
| 105 std::move(client)); | 105 std::move(request), std::move(client)); |
| 106 Job* job_ptr = job.get(); | 106 Job* job_ptr = job.get(); |
| 107 jobs_[job_ptr] = std::move(job); | 107 jobs_[job_ptr] = std::move(job); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void MojoProxyResolverFactoryImpl::RemoveJob(Job* job) { | 110 void MojoProxyResolverFactoryImpl::RemoveJob(Job* job) { |
| 111 auto it = jobs_.find(job); | 111 auto it = jobs_.find(job); |
| 112 DCHECK(it != jobs_.end()); | 112 DCHECK(it != jobs_.end()); |
| 113 jobs_.erase(it); | 113 jobs_.erase(it); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace net | 116 } // namespace net |
| OLD | NEW |