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" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 MojoProxyResolverImpl::Job::~Job() { | 83 MojoProxyResolverImpl::Job::~Job() { |
84 if (request_handle_ && !done_) | 84 if (request_handle_ && !done_) |
85 resolver_->resolver_->CancelRequest(request_handle_); | 85 resolver_->resolver_->CancelRequest(request_handle_); |
86 } | 86 } |
87 | 87 |
88 void MojoProxyResolverImpl::Job::Start() { | 88 void MojoProxyResolverImpl::Job::Start() { |
89 resolver_->resolver_->GetProxyForURL( | 89 resolver_->resolver_->GetProxyForURL( |
90 url_, &result_, base::Bind(&Job::GetProxyDone, base::Unretained(this)), | 90 url_, &result_, base::Bind(&Job::GetProxyDone, base::Unretained(this)), |
91 &request_handle_, | 91 &request_handle_, |
92 base::WrapUnique(new MojoProxyResolverV8TracingBindings< | 92 base::MakeUnique<MojoProxyResolverV8TracingBindings< |
93 interfaces::ProxyResolverRequestClient>(client_.get()))); | 93 interfaces::ProxyResolverRequestClient>>(client_.get())); |
94 client_.set_connection_error_handler(base::Bind( | 94 client_.set_connection_error_handler(base::Bind( |
95 &MojoProxyResolverImpl::Job::OnConnectionError, base::Unretained(this))); | 95 &MojoProxyResolverImpl::Job::OnConnectionError, base::Unretained(this))); |
96 } | 96 } |
97 | 97 |
98 void MojoProxyResolverImpl::Job::GetProxyDone(int error) { | 98 void MojoProxyResolverImpl::Job::GetProxyDone(int error) { |
99 done_ = true; | 99 done_ = true; |
100 DVLOG(1) << "GetProxyForUrl(" << url_ << ") finished with error " << error | 100 DVLOG(1) << "GetProxyForUrl(" << url_ << ") finished with error " << error |
101 << ". " << result_.proxy_list().size() << " Proxies returned:"; | 101 << ". " << result_.proxy_list().size() << " Proxies returned:"; |
102 for (const auto& proxy : result_.proxy_list().GetAll()) { | 102 for (const auto& proxy : result_.proxy_list().GetAll()) { |
103 DVLOG(1) << proxy.ToURI(); | 103 DVLOG(1) << proxy.ToURI(); |
104 } | 104 } |
105 mojo::Array<interfaces::ProxyServerPtr> result; | 105 mojo::Array<interfaces::ProxyServerPtr> result; |
106 if (error == OK) { | 106 if (error == OK) { |
107 result = mojo::Array<interfaces::ProxyServerPtr>::From( | 107 result = mojo::Array<interfaces::ProxyServerPtr>::From( |
108 result_.proxy_list().GetAll()); | 108 result_.proxy_list().GetAll()); |
109 } | 109 } |
110 client_->ReportResult(error, std::move(result)); | 110 client_->ReportResult(error, std::move(result)); |
111 resolver_->DeleteJob(this); | 111 resolver_->DeleteJob(this); |
112 } | 112 } |
113 | 113 |
114 void MojoProxyResolverImpl::Job::OnConnectionError() { | 114 void MojoProxyResolverImpl::Job::OnConnectionError() { |
115 resolver_->DeleteJob(this); | 115 resolver_->DeleteJob(this); |
116 } | 116 } |
117 | 117 |
118 } // namespace net | 118 } // namespace net |
OLD | NEW |