| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ |
| 7 | 7 |
| 8 #include "mojo/public/cpp/bindings/interface_ptr.h" | 8 #include "mojo/public/cpp/system/message_pipe.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| 11 | 11 |
| 12 template <typename I> |
| 13 class InterfacePtr; |
| 14 |
| 15 template <typename I> |
| 16 class InterfacePtrInfo; |
| 17 |
| 12 // Represents a request from a remote client for an implementation of Interface | 18 // Represents a request from a remote client for an implementation of Interface |
| 13 // over a specified message pipe. The implementor of the interface should | 19 // over a specified message pipe. The implementor of the interface should |
| 14 // remove the message pipe by calling PassMessagePipe() and bind it to the | 20 // remove the message pipe by calling PassMessagePipe() and bind it to the |
| 15 // implementation. If this is not done, the InterfaceRequest will automatically | 21 // implementation. If this is not done, the InterfaceRequest will automatically |
| 16 // close the pipe on destruction. Can also represent the absence of a request | 22 // close the pipe on destruction. Can also represent the absence of a request |
| 17 // if the client did not provide a message pipe. | 23 // if the client did not provide a message pipe. |
| 18 template <typename Interface> | 24 template <typename Interface> |
| 19 class InterfaceRequest { | 25 class InterfaceRequest { |
| 20 public: | 26 public: |
| 21 // Constructs an empty InterfaceRequest, representing that the client is not | 27 // Constructs an empty InterfaceRequest, representing that the client is not |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 template <typename Interface> | 116 template <typename Interface> |
| 111 InterfaceRequest<Interface> GetProxy(InterfacePtr<Interface>* ptr) { | 117 InterfaceRequest<Interface> GetProxy(InterfacePtr<Interface>* ptr) { |
| 112 MessagePipe pipe; | 118 MessagePipe pipe; |
| 113 ptr->Bind(InterfacePtrInfo<Interface>(pipe.handle0.Pass(), 0u)); | 119 ptr->Bind(InterfacePtrInfo<Interface>(pipe.handle0.Pass(), 0u)); |
| 114 return MakeRequest<Interface>(pipe.handle1.Pass()); | 120 return MakeRequest<Interface>(pipe.handle1.Pass()); |
| 115 } | 121 } |
| 116 | 122 |
| 117 } // namespace mojo | 123 } // namespace mojo |
| 118 | 124 |
| 119 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ | 125 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ |
| OLD | NEW |