Index: mojo/public/cpp/bindings/interface_request.h |
diff --git a/mojo/public/cpp/bindings/interface_request.h b/mojo/public/cpp/bindings/interface_request.h |
index 29d883615e6a8638fa7f89f814d1fa5b5164a67a..d17209206827c21baa4486b7d42189caf98f659c 100644 |
--- a/mojo/public/cpp/bindings/interface_request.h |
+++ b/mojo/public/cpp/bindings/interface_request.h |
@@ -46,6 +46,15 @@ class InterfaceRequest { |
Bind(std::move(pipe.handle1)); |
} |
+ // Similar to the constructor above, but binds one end of the message pipe to |
+ // an InterfacePtrInfo instance. |
+ explicit InterfaceRequest(InterfacePtrInfo<Interface>* ptr_info) { |
+ MessagePipe pipe; |
+ ptr_info->set_handle(std::move(pipe.handle0)); |
+ ptr_info->set_version(0u); |
+ Bind(std::move(pipe.handle1)); |
+ } |
+ |
// Takes the message pipe from another InterfaceRequest. |
InterfaceRequest(InterfaceRequest&& other) { |
handle_ = std::move(other.handle_); |
@@ -163,6 +172,13 @@ InterfaceRequest<Interface> MakeRequest( |
return InterfaceRequest<Interface>(ptr, runner); |
} |
+// Similar to the constructor above, but binds one end of the message pipe to |
+// an InterfacePtrInfo instance. |
+template <typename Interface> |
+InterfaceRequest<Interface> MakeRequest(InterfacePtrInfo<Interface>* ptr_info) { |
+ return InterfaceRequest<Interface>(ptr_info); |
+} |
+ |
// Fuses an InterfaceRequest<T> endpoint with an InterfacePtrInfo<T> endpoint. |
// Returns |true| on success or |false| on failure. |
template <typename Interface> |