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

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

Issue 2080083002: Revert of Deletes mojo::Callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/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"
11 #include "base/callback.h"
12 #include "base/logging.h" 11 #include "base/logging.h"
13 #include "base/macros.h" 12 #include "base/macros.h"
14 #include "base/stl_util.h" 13 #include "base/stl_util.h"
15 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
16 #include "base/values.h" 15 #include "base/values.h"
17 #include "mojo/common/common_type_converters.h" 16 #include "mojo/common/common_type_converters.h"
18 #include "mojo/common/url_type_converters.h" 17 #include "mojo/common/url_type_converters.h"
19 #include "mojo/public/cpp/bindings/binding.h" 18 #include "mojo/public/cpp/bindings/binding.h"
20 #include "net/base/load_states.h" 19 #include "net/base/load_states.h"
21 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 base::Unretained(this))); 346 base::Unretained(this)));
348 binding_.set_connection_error_handler( 347 binding_.set_connection_error_handler(
349 base::Bind(&ProxyResolverFactoryMojo::Job::OnConnectionError, 348 base::Bind(&ProxyResolverFactoryMojo::Job::OnConnectionError,
350 base::Unretained(this))); 349 base::Unretained(this)));
351 } 350 }
352 351
353 void OnConnectionError() { ReportResult(ERR_PAC_SCRIPT_TERMINATED); } 352 void OnConnectionError() { ReportResult(ERR_PAC_SCRIPT_TERMINATED); }
354 353
355 private: 354 private:
356 void ReportResult(int32_t error) override { 355 void ReportResult(int32_t error) override {
357 resolver_ptr_.set_connection_error_handler(base::Closure()); 356 resolver_ptr_.set_connection_error_handler(mojo::Closure());
358 binding_.set_connection_error_handler(base::Closure()); 357 binding_.set_connection_error_handler(mojo::Closure());
359 if (error == OK) { 358 if (error == OK) {
360 resolver_->reset(new ProxyResolverMojo( 359 resolver_->reset(new ProxyResolverMojo(
361 std::move(resolver_ptr_), factory_->host_resolver_, 360 std::move(resolver_ptr_), factory_->host_resolver_,
362 std::move(on_delete_callback_runner_), std::move(error_observer_), 361 std::move(on_delete_callback_runner_), std::move(error_observer_),
363 factory_->net_log_)); 362 factory_->net_log_));
364 } 363 }
365 on_delete_callback_runner_.reset(); 364 on_delete_callback_runner_.reset();
366 callback_.Run(error); 365 callback_.Run(error);
367 } 366 }
368 367
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 return ERR_PAC_SCRIPT_FAILED; 400 return ERR_PAC_SCRIPT_FAILED;
402 } 401 }
403 request->reset(new Job(this, pac_script, resolver, callback, 402 request->reset(new Job(this, pac_script, resolver, callback,
404 error_observer_factory_.is_null() 403 error_observer_factory_.is_null()
405 ? nullptr 404 ? nullptr
406 : error_observer_factory_.Run())); 405 : error_observer_factory_.Run()));
407 return ERR_IO_PENDING; 406 return ERR_IO_PENDING;
408 } 407 }
409 408
410 } // namespace net 409 } // namespace net
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl ('k') | services/shell/public/cpp/connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698