| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request) | 124 mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request) |
| 125 : proxy_resolver_impl_factory_(std::move(proxy_resolver_factory)), | 125 : proxy_resolver_impl_factory_(std::move(proxy_resolver_factory)), |
| 126 binding_(this, std::move(request)) {} | 126 binding_(this, std::move(request)) {} |
| 127 | 127 |
| 128 MojoProxyResolverFactoryImpl::MojoProxyResolverFactoryImpl( | 128 MojoProxyResolverFactoryImpl::MojoProxyResolverFactoryImpl( |
| 129 mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request) | 129 mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request) |
| 130 : MojoProxyResolverFactoryImpl(ProxyResolverV8TracingFactory::Create(), | 130 : MojoProxyResolverFactoryImpl(ProxyResolverV8TracingFactory::Create(), |
| 131 std::move(request)) {} | 131 std::move(request)) {} |
| 132 | 132 |
| 133 MojoProxyResolverFactoryImpl::~MojoProxyResolverFactoryImpl() { | 133 MojoProxyResolverFactoryImpl::~MojoProxyResolverFactoryImpl() { |
| 134 STLDeleteElements(&jobs_); | 134 base::STLDeleteElements(&jobs_); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void MojoProxyResolverFactoryImpl::CreateResolver( | 137 void MojoProxyResolverFactoryImpl::CreateResolver( |
| 138 const mojo::String& pac_script, | 138 const mojo::String& pac_script, |
| 139 mojo::InterfaceRequest<interfaces::ProxyResolver> request, | 139 mojo::InterfaceRequest<interfaces::ProxyResolver> request, |
| 140 interfaces::ProxyResolverFactoryRequestClientPtr client) { | 140 interfaces::ProxyResolverFactoryRequestClientPtr client) { |
| 141 // The Job will call RemoveJob on |this| when either the create request | 141 // The Job will call RemoveJob on |this| when either the create request |
| 142 // finishes or |request| or |client| encounters a connection error. | 142 // finishes or |request| or |client| encounters a connection error. |
| 143 jobs_.insert(new Job( | 143 jobs_.insert(new Job( |
| 144 this, ProxyResolverScriptData::FromUTF8(pac_script.To<std::string>()), | 144 this, ProxyResolverScriptData::FromUTF8(pac_script.To<std::string>()), |
| 145 proxy_resolver_impl_factory_.get(), std::move(request), | 145 proxy_resolver_impl_factory_.get(), std::move(request), |
| 146 std::move(client))); | 146 std::move(client))); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void MojoProxyResolverFactoryImpl::RemoveJob(Job* job) { | 149 void MojoProxyResolverFactoryImpl::RemoveJob(Job* job) { |
| 150 size_t erased = jobs_.erase(job); | 150 size_t erased = jobs_.erase(job); |
| 151 DCHECK_EQ(1u, erased); | 151 DCHECK_EQ(1u, erased); |
| 152 delete job; | 152 delete job; |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace net | 155 } // namespace net |
| OLD | NEW |