Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: net/proxy/mojo_proxy_resolver_impl.cc

Issue 2259823002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « net/proxy/mojo_proxy_resolver_factory_impl.cc ('k') | net/proxy/proxy_resolver_factory_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698