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

Unified Diff: mojo/public/cpp/bindings/README.md

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 | « no previous file | mojo/public/cpp/bindings/associated_binding.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/README.md
diff --git a/mojo/public/cpp/bindings/README.md b/mojo/public/cpp/bindings/README.md
index 48b1c8d518c818c0b58bd18d6a666124b4770c48..a797eaeb1599945fa7c857dabb12fcf2d9f52211 100644
--- a/mojo/public/cpp/bindings/README.md
+++ b/mojo/public/cpp/bindings/README.md
@@ -389,7 +389,7 @@ invocation:
``` cpp
sample::mojom::LoggerPtr logger;
LoggerImpl impl(mojo::MakeRequest(&logger));
-impl.set_connection_error_handler(base::Bind([] { LOG(ERROR) << "Bye."; }));
+impl.set_connection_error_handler(base::BindOnce([] { LOG(ERROR) << "Bye."; }));
logger->Log("OK cool");
logger.reset(); // Closes the client end.
```
@@ -406,7 +406,7 @@ handler within its constructor:
LoggerImpl::LoggerImpl(sample::mojom::LoggerRequest request)
: binding_(this, std::move(request)) {
binding_.set_connection_error_handler(
- base::Bind(&LoggerImpl::OnError, base::Unretained(this)));
+ base::BindOnce(&LoggerImpl::OnError, base::Unretained(this)));
}
void LoggerImpl::OnError() {
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/associated_binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698