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

Unified Diff: mojo/public/cpp/bindings/lib/associated_interface_ptr_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
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr_set.h ('k') | mojo/public/cpp/bindings/lib/binding_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h
diff --git a/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h b/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h
index e214335a9ea88049e3abacc7325c2745571dd291..8e015dcf012bf705f181a4103b8cd4028b68ad12 100644
--- a/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h
+++ b/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h
@@ -11,6 +11,7 @@
#include <memory>
#include <utility>
+#include "base/bind.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
@@ -51,17 +52,12 @@ class AssociatedInterfacePtrState {
}
void QueryVersion(const Callback<void(uint32_t)>& callback) {
- // It is safe to capture |this| because the callback won't be run after this
- // object goes away.
- auto callback_wrapper = [this, callback](uint32_t version) {
- this->version_ = version;
- callback.Run(version);
- };
-
// Do a static cast in case the interface contains methods with the same
- // name.
+ // name. It is safe to capture |this| because the callback won't be run
+ // after this object goes away.
static_cast<ControlMessageProxy*>(proxy_.get())
- ->QueryVersion(callback_wrapper);
+ ->QueryVersion(base::Bind(&AssociatedInterfacePtrState::OnQueryVersion,
+ base::Unretained(this), callback));
}
void RequireVersion(uint32_t version) {
@@ -129,6 +125,12 @@ class AssociatedInterfacePtrState {
private:
using Proxy = typename Interface::Proxy_;
+ void OnQueryVersion(const Callback<void(uint32_t)>& callback,
+ uint32_t version) {
+ version_ = version;
+ callback.Run(version);
+ }
+
std::unique_ptr<InterfaceEndpointClient> endpoint_client_;
std::unique_ptr<Proxy> proxy_;
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr_set.h ('k') | mojo/public/cpp/bindings/lib/binding_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698