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

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

Issue 1660143006: Mojo C++ bindings: Move MakeProxy() -> InterfacePtr::Create(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix failed 'gn' Created 4 years, 10 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/interface_ptr.h
diff --git a/mojo/public/cpp/bindings/interface_ptr.h b/mojo/public/cpp/bindings/interface_ptr.h
index c17e6bf2534b2f83c685b79770cb7cd27f546b68..7363b2d0ccc99699983884415ac076c431228672 100644
--- a/mojo/public/cpp/bindings/interface_ptr.h
+++ b/mojo/public/cpp/bindings/interface_ptr.h
@@ -57,6 +57,18 @@ class InterfacePtr {
// Closes the bound message pipe (if any) on destruction.
~InterfacePtr() {}
+ // If |info| is valid (containing a valid message pipe handle), returns an
+ // InterfacePtr bound to it. Otherwise, returns an unbound InterfacePtr. The
+ // specified |waiter| will be used as in the InterfacePtr::Bind() method.
+ static InterfacePtr<Interface> Create(
+ InterfaceHandle<Interface> info,
+ const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
+ InterfacePtr<Interface> ptr;
+ if (info.is_valid())
+ ptr.Bind(info.Pass(), waiter);
+ return ptr;
+ }
+
// Binds the InterfacePtr to a remote implementation of Interface. The
// |waiter| is used for receiving notifications when there is data to read
// from the message pipe. For most callers, the default |waiter| will be
@@ -172,19 +184,6 @@ class InterfacePtr {
MOJO_MOVE_ONLY_TYPE(InterfacePtr);
};
-// If |info| is valid (containing a valid message pipe handle), returns an
-// InterfacePtr bound to it. Otherwise, returns an unbound InterfacePtr. The
-// specified |waiter| will be used as in the InterfacePtr::Bind() method.
-template <typename Interface>
-InterfacePtr<Interface> MakeProxy(
- InterfaceHandle<Interface> info,
- const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
- InterfacePtr<Interface> ptr;
- if (info.is_valid())
- ptr.Bind(info.Pass(), waiter);
- return ptr;
-}
-
} // namespace mojo
#endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_

Powered by Google App Engine
This is Rietveld 408576698