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

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

Issue 1926123002: Add a ctor for InterfaceRequest<I> that takes a ScopedMessagePipeHandle, and remove MakeRequest<I>(… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 8 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/binding.h ('k') | mojo/public/cpp/bindings/lib/array_serialization.h » ('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 5542a371590547ad47be80ea733c9e2f0c28558a..a16f5da5669ceb89da2a7e88df75b4197cd25eb2 100644
--- a/mojo/public/cpp/bindings/interface_request.h
+++ b/mojo/public/cpp/bindings/interface_request.h
@@ -27,11 +27,16 @@ class InterfaceHandle;
template <typename Interface>
class InterfaceRequest {
public:
- // Constructs an empty InterfaceRequest, representing that the client is not
+ // Constructs an "empty" InterfaceRequest, representing that the client is not
// requesting an implementation of Interface.
InterfaceRequest() {}
InterfaceRequest(std::nullptr_t) {}
+ // Constructs an InterfaceRequest from a message pipe handle (if |handle| is
+ // not set, then this constructs an "empty" InterfaceRequest).
+ explicit InterfaceRequest(ScopedMessagePipeHandle handle)
+ : handle_(handle.Pass()) {}
+
// Takes the message pipe from another InterfaceRequest.
InterfaceRequest(InterfaceRequest&& other) { handle_ = other.handle_.Pass(); }
InterfaceRequest& operator=(InterfaceRequest&& other) {
@@ -63,16 +68,6 @@ class InterfaceRequest {
MOJO_MOVE_ONLY_TYPE(InterfaceRequest);
};
-// Makes an InterfaceRequest bound to the specified message pipe. If |handle|
-// is empty or invalid, the resulting InterfaceRequest will represent the
-// absence of a request.
-template <typename Interface>
-InterfaceRequest<Interface> MakeRequest(ScopedMessagePipeHandle handle) {
- InterfaceRequest<Interface> request;
- request.Bind(handle.Pass());
- return request;
-}
-
// Creates a new message pipe over which Interface is to be served, and one end
// into the supplied |handle| and the returns the other inside an
// InterfaceRequest<>. The InterfaceHandle<> can be used to create a client
@@ -85,7 +80,7 @@ template <typename Interface>
InterfaceRequest<Interface> GetProxy(InterfaceHandle<Interface>* handle) {
MessagePipe pipe;
*handle = InterfaceHandle<Interface>(pipe.handle0.Pass(), 0u);
- return MakeRequest<Interface>(pipe.handle1.Pass());
+ return InterfaceRequest<Interface>(pipe.handle1.Pass());
}
// Creates a new message pipe over which Interface is to be served. Binds the
« no previous file with comments | « mojo/public/cpp/bindings/binding.h ('k') | mojo/public/cpp/bindings/lib/array_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698