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

Unified Diff: mojo/public/cpp/bindings/lib/associated_binding.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
Index: mojo/public/cpp/bindings/lib/associated_binding.cc
diff --git a/mojo/public/cpp/bindings/lib/associated_binding.cc b/mojo/public/cpp/bindings/lib/associated_binding.cc
index 5f6db9a1e4ec55c8a03e8882e421c0505ae8b61d..6b1a3d273cc2b00e1229cba27f2d9cae58386722 100644
--- a/mojo/public/cpp/bindings/lib/associated_binding.cc
+++ b/mojo/public/cpp/bindings/lib/associated_binding.cc
@@ -28,15 +28,16 @@ void AssociatedBindingBase::CloseWithReason(uint32_t custom_reason,
}
void AssociatedBindingBase::set_connection_error_handler(
- const base::Closure& error_handler) {
+ base::OnceClosure error_handler) {
DCHECK(is_bound());
- endpoint_client_->set_connection_error_handler(error_handler);
+ endpoint_client_->set_connection_error_handler(std::move(error_handler));
}
void AssociatedBindingBase::set_connection_error_with_reason_handler(
- const ConnectionErrorWithReasonCallback& error_handler) {
+ ConnectionErrorWithReasonCallback error_handler) {
DCHECK(is_bound());
- endpoint_client_->set_connection_error_with_reason_handler(error_handler);
+ endpoint_client_->set_connection_error_with_reason_handler(
+ std::move(error_handler));
}
void AssociatedBindingBase::FlushForTesting() {
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698