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

Unified Diff: mojo/public/cpp/bindings/connector.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
Index: mojo/public/cpp/bindings/connector.h
diff --git a/mojo/public/cpp/bindings/connector.h b/mojo/public/cpp/bindings/connector.h
index 48c302c2865e0133749d5b84af9e5131191617ed..75db16a5f9fcdafa4b6803ec5e31b0da70d1f2e9 100644
--- a/mojo/public/cpp/bindings/connector.h
+++ b/mojo/public/cpp/bindings/connector.h
@@ -6,6 +6,7 @@
#define MOJO_PUBLIC_CPP_BINDINGS_CONNECTOR_H_
#include <memory>
+#include <utility>
#include "base/callback.h"
#include "base/compiler_specific.h"
@@ -70,9 +71,9 @@ class MOJO_CPP_BINDINGS_EXPORT Connector
// Sets the error handler to receive notifications when an error is
// encountered while reading from the pipe or waiting to read from the pipe.
- void set_connection_error_handler(const base::Closure& error_handler) {
+ void set_connection_error_handler(base::OnceClosure error_handler) {
DCHECK(thread_checker_.CalledOnValidThread());
- connection_error_handler_ = error_handler;
+ connection_error_handler_ = std::move(error_handler);
}
// Returns true if an error was encountered while reading from the pipe or
@@ -185,7 +186,7 @@ class MOJO_CPP_BINDINGS_EXPORT Connector
void EnsureSyncWatcherExists();
- base::Closure connection_error_handler_;
+ base::OnceClosure connection_error_handler_;
ScopedMessagePipeHandle message_pipe_;
MessageReceiver* incoming_receiver_ = nullptr;
« no previous file with comments | « mojo/public/cpp/bindings/connection_error_callback.h ('k') | mojo/public/cpp/bindings/interface_endpoint_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698