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

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

Issue 1635603002: Make use of CreateInterfacePtrAndBind() where appropriate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks Created 4 years, 10 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
« no previous file with comments | « mojo/shell/application_manager_apptest.cc ('k') | sql/mojo/sql_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/proxy_resolver_factory_mojo.h" 5 #include "net/proxy/proxy_resolver_factory_mojo.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 : ClientMixin<interfaces::ProxyResolverRequestClient>( 191 : ClientMixin<interfaces::ProxyResolverRequestClient>(
192 resolver->host_resolver_, 192 resolver->host_resolver_,
193 resolver->error_observer_.get(), 193 resolver->error_observer_.get(),
194 resolver->net_log_, 194 resolver->net_log_,
195 net_log), 195 net_log),
196 resolver_(resolver), 196 resolver_(resolver),
197 url_(url), 197 url_(url),
198 results_(results), 198 results_(results),
199 callback_(callback), 199 callback_(callback),
200 binding_(this) { 200 binding_(this) {
201 interfaces::ProxyResolverRequestClientPtr client_ptr; 201 resolver_->mojo_proxy_resolver_ptr_->GetProxyForUrl(
202 binding_.Bind(mojo::GetProxy(&client_ptr)); 202 mojo::String::From(url_), binding_.CreateInterfacePtrAndBind());
203 binding_.set_connection_error_handler(base::Bind( 203 binding_.set_connection_error_handler(base::Bind(
204 &ProxyResolverMojo::Job::OnConnectionError, base::Unretained(this))); 204 &ProxyResolverMojo::Job::OnConnectionError, base::Unretained(this)));
205 resolver_->mojo_proxy_resolver_ptr_->GetProxyForUrl(mojo::String::From(url_),
206 std::move(client_ptr));
207 } 205 }
208 206
209 ProxyResolverMojo::Job::~Job() { 207 ProxyResolverMojo::Job::~Job() {
210 DCHECK(thread_checker_.CalledOnValidThread()); 208 DCHECK(thread_checker_.CalledOnValidThread());
211 if (!callback_.is_null()) 209 if (!callback_.is_null())
212 callback_.Run(ERR_PAC_SCRIPT_TERMINATED); 210 callback_.Run(ERR_PAC_SCRIPT_TERMINATED);
213 } 211 }
214 212
215 void ProxyResolverMojo::Job::Cancel() { 213 void ProxyResolverMojo::Job::Cancel() {
216 DCHECK(thread_checker_.CalledOnValidThread()); 214 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 : ClientMixin<interfaces::ProxyResolverFactoryRequestClient>( 331 : ClientMixin<interfaces::ProxyResolverFactoryRequestClient>(
334 factory->host_resolver_, 332 factory->host_resolver_,
335 error_observer.get(), 333 error_observer.get(),
336 factory->net_log_, 334 factory->net_log_,
337 BoundNetLog()), 335 BoundNetLog()),
338 factory_(factory), 336 factory_(factory),
339 resolver_(resolver), 337 resolver_(resolver),
340 callback_(callback), 338 callback_(callback),
341 binding_(this), 339 binding_(this),
342 error_observer_(std::move(error_observer)) { 340 error_observer_(std::move(error_observer)) {
343 interfaces::ProxyResolverFactoryRequestClientPtr client_ptr;
344 binding_.Bind(mojo::GetProxy(&client_ptr));
345 on_delete_callback_runner_ = factory_->mojo_proxy_factory_->CreateResolver( 341 on_delete_callback_runner_ = factory_->mojo_proxy_factory_->CreateResolver(
346 mojo::String::From(pac_script->utf16()), mojo::GetProxy(&resolver_ptr_), 342 mojo::String::From(pac_script->utf16()), mojo::GetProxy(&resolver_ptr_),
347 std::move(client_ptr)); 343 binding_.CreateInterfacePtrAndBind());
348 resolver_ptr_.set_connection_error_handler( 344 resolver_ptr_.set_connection_error_handler(
349 base::Bind(&ProxyResolverFactoryMojo::Job::OnConnectionError, 345 base::Bind(&ProxyResolverFactoryMojo::Job::OnConnectionError,
350 base::Unretained(this))); 346 base::Unretained(this)));
351 binding_.set_connection_error_handler( 347 binding_.set_connection_error_handler(
352 base::Bind(&ProxyResolverFactoryMojo::Job::OnConnectionError, 348 base::Bind(&ProxyResolverFactoryMojo::Job::OnConnectionError,
353 base::Unretained(this))); 349 base::Unretained(this)));
354 } 350 }
355 351
356 void OnConnectionError() { ReportResult(ERR_PAC_SCRIPT_TERMINATED); } 352 void OnConnectionError() { ReportResult(ERR_PAC_SCRIPT_TERMINATED); }
357 353
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 return ERR_PAC_SCRIPT_FAILED; 401 return ERR_PAC_SCRIPT_FAILED;
406 } 402 }
407 request->reset(new Job(this, pac_script, resolver, callback, 403 request->reset(new Job(this, pac_script, resolver, callback,
408 error_observer_factory_.is_null() 404 error_observer_factory_.is_null()
409 ? nullptr 405 ? nullptr
410 : error_observer_factory_.Run())); 406 : error_observer_factory_.Run()));
411 return ERR_IO_PENDING; 407 return ERR_IO_PENDING;
412 } 408 }
413 409
414 } // namespace net 410 } // namespace net
OLDNEW
« no previous file with comments | « mojo/shell/application_manager_apptest.cc ('k') | sql/mojo/sql_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698