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

Unified Diff: mojo/public/cpp/bindings/lib/interface_endpoint_client.cc

Issue 2932193002: Use OnceCallback for Mojo binding connection error handlers. (Closed)
Patch Set: Call Run() on rvalue. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/connector.cc ('k') | mojo/public/cpp/bindings/lib/interface_ptr_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
diff --git a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
index ef3a1fe6800fe052d5f8bc15e04bea7c10a1a4fd..6019b4559130248ba7a05094e358dd76bb7b2487 100644
--- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
+++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
@@ -6,8 +6,6 @@
#include <stdint.h>
-#include <utility>
-
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
@@ -309,16 +307,14 @@ void InterfaceEndpointClient::NotifyError(
control_message_proxy_.OnConnectionError();
- if (!error_handler_.is_null()) {
- base::Closure error_handler = std::move(error_handler_);
- error_handler.Run();
- } else if (!error_with_reason_handler_.is_null()) {
- ConnectionErrorWithReasonCallback error_with_reason_handler =
- std::move(error_with_reason_handler_);
+ if (error_handler_) {
+ std::move(error_handler_).Run();
+ } else if (error_with_reason_handler_) {
if (reason) {
- error_with_reason_handler.Run(reason->custom_reason, reason->description);
+ std::move(error_with_reason_handler_)
+ .Run(reason->custom_reason, reason->description);
} else {
- error_with_reason_handler.Run(0, std::string());
+ std::move(error_with_reason_handler_).Run(0, std::string());
}
}
}
« no previous file with comments | « mojo/public/cpp/bindings/lib/connector.cc ('k') | mojo/public/cpp/bindings/lib/interface_ptr_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698