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

Unified Diff: mojo/public/cpp/bindings/interface_endpoint_client.h

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/connector.h ('k') | mojo/public/cpp/bindings/interface_ptr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/interface_endpoint_client.h
diff --git a/mojo/public/cpp/bindings/interface_endpoint_client.h b/mojo/public/cpp/bindings/interface_endpoint_client.h
index b519fe92bbbbc79cbc4d1be01954ce4d70827f26..2e3038437a2e77127683846876cec6f2b184918c 100644
--- a/mojo/public/cpp/bindings/interface_endpoint_client.h
+++ b/mojo/public/cpp/bindings/interface_endpoint_client.h
@@ -9,6 +9,7 @@
#include <map>
#include <memory>
+#include <utility>
#include "base/callback.h"
#include "base/compiler_specific.h"
@@ -51,16 +52,16 @@ class MOJO_CPP_BINDINGS_EXPORT InterfaceEndpointClient
// Sets the error handler to receive notifications when an error is
// encountered.
- void set_connection_error_handler(const base::Closure& error_handler) {
+ void set_connection_error_handler(base::OnceClosure error_handler) {
DCHECK(thread_checker_.CalledOnValidThread());
- error_handler_ = error_handler;
+ error_handler_ = std::move(error_handler);
error_with_reason_handler_.Reset();
}
void set_connection_error_with_reason_handler(
- const ConnectionErrorWithReasonCallback& error_handler) {
+ ConnectionErrorWithReasonCallback error_handler) {
DCHECK(thread_checker_.CalledOnValidThread());
- error_with_reason_handler_ = error_handler;
+ error_with_reason_handler_ = std::move(error_handler);
error_handler_.Reset();
}
@@ -172,7 +173,7 @@ class MOJO_CPP_BINDINGS_EXPORT InterfaceEndpointClient
uint64_t next_request_id_ = 1;
- base::Closure error_handler_;
+ base::OnceClosure error_handler_;
ConnectionErrorWithReasonCallback error_with_reason_handler_;
bool encountered_error_ = false;
« no previous file with comments | « mojo/public/cpp/bindings/connector.h ('k') | mojo/public/cpp/bindings/interface_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698