| Index: mojo/public/cpp/bindings/strong_associated_binding.h
|
| diff --git a/mojo/public/cpp/bindings/strong_associated_binding.h b/mojo/public/cpp/bindings/strong_associated_binding.h
|
| index a1e299bb2d8def727bed3f545382ee9c31f3b5c8..ae7d3fdddd56814d185feb119fe3fc1a526b6117 100644
|
| --- a/mojo/public/cpp/bindings/strong_associated_binding.h
|
| +++ b/mojo/public/cpp/bindings/strong_associated_binding.h
|
| @@ -58,16 +58,16 @@ class StrongAssociatedBinding {
|
| //
|
| // This method may only be called after this StrongAssociatedBinding has been
|
| // bound to a message pipe.
|
| - void set_connection_error_handler(const base::Closure& error_handler) {
|
| + void set_connection_error_handler(base::OnceClosure error_handler) {
|
| DCHECK(binding_.is_bound());
|
| - connection_error_handler_ = error_handler;
|
| + connection_error_handler_ = std::move(error_handler);
|
| connection_error_with_reason_handler_.Reset();
|
| }
|
|
|
| void set_connection_error_with_reason_handler(
|
| - const ConnectionErrorWithReasonCallback& error_handler) {
|
| + ConnectionErrorWithReasonCallback error_handler) {
|
| DCHECK(binding_.is_bound());
|
| - connection_error_with_reason_handler_ = error_handler;
|
| + connection_error_with_reason_handler_ = std::move(error_handler);
|
| connection_error_handler_.Reset();
|
| }
|
|
|
| @@ -96,15 +96,17 @@ class StrongAssociatedBinding {
|
|
|
| void OnConnectionError(uint32_t custom_reason,
|
| const std::string& description) {
|
| - if (!connection_error_handler_.is_null())
|
| - connection_error_handler_.Run();
|
| - else if (!connection_error_with_reason_handler_.is_null())
|
| - connection_error_with_reason_handler_.Run(custom_reason, description);
|
| + if (connection_error_handler_) {
|
| + std::move(connection_error_handler_).Run();
|
| + } else if (connection_error_with_reason_handler_) {
|
| + std::move(connection_error_with_reason_handler_)
|
| + .Run(custom_reason, description);
|
| + }
|
| Close();
|
| }
|
|
|
| std::unique_ptr<Interface> impl_;
|
| - base::Closure connection_error_handler_;
|
| + base::OnceClosure connection_error_handler_;
|
| ConnectionErrorWithReasonCallback connection_error_with_reason_handler_;
|
| AssociatedBinding<Interface> binding_;
|
| base::WeakPtrFactory<StrongAssociatedBinding> weak_factory_;
|
|
|