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

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

Issue 2855303003: Mojo C++ bindings: add a MakeRequest overload that binds InterfacePtrInfo. (Closed)
Patch Set: Created 3 years, 7 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.h ('k') | mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698