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

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

Issue 2062333002: mojo::Callback -> base::Callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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/shared_ptr.h ('k') | mojo/public/cpp/bindings/tests/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/strong_binding.h
diff --git a/mojo/public/cpp/bindings/strong_binding.h b/mojo/public/cpp/bindings/strong_binding.h
index 5c48eae08b195d28a7e171585f1e4ea04e74841f..1116030925f39093f2c8f473fdb1369fba974f67 100644
--- a/mojo/public/cpp/bindings/strong_binding.h
+++ b/mojo/public/cpp/bindings/strong_binding.h
@@ -7,6 +7,7 @@
#include <utility>
+#include "base/bind.h"
#include "base/logging.h"
#include "base/macros.h"
#include "mojo/public/cpp/bindings/binding.h"
@@ -72,19 +73,22 @@ class StrongBinding {
void Bind(ScopedMessagePipeHandle handle) {
DCHECK(!binding_.is_bound());
binding_.Bind(std::move(handle));
- binding_.set_connection_error_handler([this]() { OnConnectionError(); });
+ binding_.set_connection_error_handler(
+ base::Bind(&StrongBinding::OnConnectionError, base::Unretained(this)));
}
void Bind(InterfacePtr<Interface>* ptr) {
DCHECK(!binding_.is_bound());
binding_.Bind(ptr);
- binding_.set_connection_error_handler([this]() { OnConnectionError(); });
+ binding_.set_connection_error_handler(
+ base::Bind(&StrongBinding::OnConnectionError, base::Unretained(this)));
}
void Bind(InterfaceRequest<Interface> request) {
DCHECK(!binding_.is_bound());
binding_.Bind(std::move(request));
- binding_.set_connection_error_handler([this]() { OnConnectionError(); });
+ binding_.set_connection_error_handler(
+ base::Bind(&StrongBinding::OnConnectionError, base::Unretained(this)));
}
bool WaitForIncomingMethodCall() {
@@ -105,7 +109,8 @@ class StrongBinding {
internal::Router* internal_router() { return binding_.internal_router(); }
void OnConnectionError() {
- connection_error_handler_.Run();
+ if (!connection_error_handler_.is_null())
+ connection_error_handler_.Run();
delete binding_.impl();
}
« no previous file with comments | « mojo/public/cpp/bindings/lib/shared_ptr.h ('k') | mojo/public/cpp/bindings/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698