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

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

Issue 220063005: Adds ScopedHandleBase::From (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 6 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/interface.h
diff --git a/mojo/public/cpp/bindings/interface.h b/mojo/public/cpp/bindings/interface.h
index bba8fef89fc685b0f6b46841363450f5cb321009..ff6bf36a4267e7669380bb2a97af1ef433fcafbc 100644
--- a/mojo/public/cpp/bindings/interface.h
+++ b/mojo/public/cpp/bindings/interface.h
@@ -63,6 +63,16 @@ struct Interface<mojo::NoInterface> {
typedef ScopedMessagePipeHandle ScopedHandle;
};
+// Use to convert from a ScopedMessagePipeHandle to an scoped interface
+// handle. For example,
+// ConvertToInterface<OmniboxPage>(message_pip_handle.Pass()),
vtl 2014/04/03 14:58:30 drive-by nit: message_pip -> message_pipe
+// where OmniboxPage names an interface in a mojom file.
+template <typename S>
+typename Interface<S>::ScopedHandle ConvertToInterface(
+ ScopedMessagePipeHandle message_pipe_handle) {
+ return Interface<S>::ScopedHandle(
+ Interface<S>::Handle(message_pipe_handle.release().value()));
+}
// InterfacePipe<S,P> is used to construct a MessagePipe with typed interfaces
// on either end.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698