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

Unified Diff: mojo/public/cpp/bindings/lib/binding_state.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
Index: mojo/public/cpp/bindings/lib/binding_state.h
diff --git a/mojo/public/cpp/bindings/lib/binding_state.h b/mojo/public/cpp/bindings/lib/binding_state.h
index 93030878122404431f2bcfafa635bd986d6d59b6..6bea3a318548cb0b06e589735a86609508175655 100644
--- a/mojo/public/cpp/bindings/lib/binding_state.h
+++ b/mojo/public/cpp/bindings/lib/binding_state.h
@@ -8,6 +8,7 @@
#include <memory>
#include <utility>
+#include "base/bind.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
@@ -58,7 +59,8 @@ class BindingState<Interface, false> {
Interface::HasSyncMethods_, std::move(runner));
router_->set_incoming_receiver(&stub_);
router_->set_connection_error_handler(
- [this]() { connection_error_handler_.Run(); });
+ base::Bind(&BindingState::RunConnectionErrorHandler,
+ base::Unretained(this)));
}
bool HasAssociatedInterfaces() const { return false; }
@@ -119,7 +121,12 @@ class BindingState<Interface, false> {
router_->set_connection_error_handler(Closure());
delete router_;
router_ = nullptr;
- connection_error_handler_.reset();
+ connection_error_handler_.Reset();
+ }
+
+ void RunConnectionErrorHandler() {
+ if (!connection_error_handler_.is_null())
+ connection_error_handler_.Run();
}
internal::Router* router_ = nullptr;
@@ -155,7 +162,8 @@ class BindingState<Interface, true> {
Interface::HasSyncMethods_, std::move(runner)));
endpoint_client_->set_connection_error_handler(
- [this]() { connection_error_handler_.Run(); });
+ base::Bind(&BindingState::RunConnectionErrorHandler,
+ base::Unretained(this)));
}
bool HasAssociatedInterfaces() const {
@@ -184,7 +192,7 @@ class BindingState<Interface, true> {
endpoint_client_.reset();
router_->CloseMessagePipe();
router_ = nullptr;
- connection_error_handler_.reset();
+ connection_error_handler_.Reset();
}
InterfaceRequest<Interface> Unbind() {
@@ -192,7 +200,7 @@ class BindingState<Interface, true> {
InterfaceRequest<Interface> request =
MakeRequest<Interface>(router_->PassMessagePipe());
router_ = nullptr;
- connection_error_handler_.reset();
+ connection_error_handler_.Reset();
return request;
}
@@ -220,6 +228,11 @@ class BindingState<Interface, true> {
}
private:
+ void RunConnectionErrorHandler() {
+ if (!connection_error_handler_.is_null())
+ connection_error_handler_.Run();
+ }
+
scoped_refptr<internal::MultiplexRouter> router_;
std::unique_ptr<internal::InterfaceEndpointClient> endpoint_client_;
« no previous file with comments | « mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h ('k') | mojo/public/cpp/bindings/lib/callback_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698