| 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_impl.h" | 5 #include "net/proxy/mojo_proxy_resolver_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h" | 13 #include "net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h" |
| 14 #include "net/proxy/mojo_proxy_type_converters.h" | |
| 15 #include "net/proxy/proxy_info.h" | 14 #include "net/proxy/proxy_info.h" |
| 16 #include "net/proxy/proxy_resolver_script_data.h" | 15 #include "net/proxy/proxy_resolver_script_data.h" |
| 17 #include "net/proxy/proxy_resolver_v8_tracing.h" | 16 #include "net/proxy/proxy_resolver_v8_tracing.h" |
| 18 | 17 |
| 19 namespace net { | 18 namespace net { |
| 20 | 19 |
| 21 class MojoProxyResolverImpl::Job { | 20 class MojoProxyResolverImpl::Job { |
| 22 public: | 21 public: |
| 23 Job(interfaces::ProxyResolverRequestClientPtr client, | 22 Job(interfaces::ProxyResolverRequestClientPtr client, |
| 24 MojoProxyResolverImpl* resolver, | 23 MojoProxyResolverImpl* resolver, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 &MojoProxyResolverImpl::Job::OnConnectionError, base::Unretained(this))); | 93 &MojoProxyResolverImpl::Job::OnConnectionError, base::Unretained(this))); |
| 95 } | 94 } |
| 96 | 95 |
| 97 void MojoProxyResolverImpl::Job::GetProxyDone(int error) { | 96 void MojoProxyResolverImpl::Job::GetProxyDone(int error) { |
| 98 done_ = true; | 97 done_ = true; |
| 99 DVLOG(1) << "GetProxyForUrl(" << url_ << ") finished with error " << error | 98 DVLOG(1) << "GetProxyForUrl(" << url_ << ") finished with error " << error |
| 100 << ". " << result_.proxy_list().size() << " Proxies returned:"; | 99 << ". " << result_.proxy_list().size() << " Proxies returned:"; |
| 101 for (const auto& proxy : result_.proxy_list().GetAll()) { | 100 for (const auto& proxy : result_.proxy_list().GetAll()) { |
| 102 DVLOG(1) << proxy.ToURI(); | 101 DVLOG(1) << proxy.ToURI(); |
| 103 } | 102 } |
| 104 mojo::Array<interfaces::ProxyServerPtr> result; | 103 if (error == OK) |
| 105 if (error == OK) { | 104 client_->ReportResult(error, result_); |
| 106 result = mojo::Array<interfaces::ProxyServerPtr>::From( | 105 else |
| 107 result_.proxy_list().GetAll()); | 106 client_->ReportResult(error, ProxyInfo()); |
| 108 } | 107 |
| 109 client_->ReportResult(error, std::move(result)); | |
| 110 resolver_->DeleteJob(this); | 108 resolver_->DeleteJob(this); |
| 111 } | 109 } |
| 112 | 110 |
| 113 void MojoProxyResolverImpl::Job::OnConnectionError() { | 111 void MojoProxyResolverImpl::Job::OnConnectionError() { |
| 114 resolver_->DeleteJob(this); | 112 resolver_->DeleteJob(this); |
| 115 } | 113 } |
| 116 | 114 |
| 117 } // namespace net | 115 } // namespace net |
| OLD | NEW |