| Index: mojo/public/cpp/bindings/associated_interface_request.h
|
| diff --git a/mojo/public/cpp/bindings/associated_interface_request.h b/mojo/public/cpp/bindings/associated_interface_request.h
|
| index 36cbe3eb48c0db45b29fe0117e63c2ffe9282b25..a7a7f662166b7e2111a626760b82fcbcaa54270c 100644
|
| --- a/mojo/public/cpp/bindings/associated_interface_request.h
|
| +++ b/mojo/public/cpp/bindings/associated_interface_request.h
|
| @@ -8,14 +8,10 @@
|
| #include <utility>
|
|
|
| #include "base/macros.h"
|
| -#include "mojo/public/cpp/bindings/lib/scoped_interface_endpoint_handle.h"
|
| +#include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
|
|
|
| namespace mojo {
|
|
|
| -namespace internal {
|
| -class AssociatedInterfaceRequestHelper;
|
| -}
|
| -
|
| // AssociatedInterfaceRequest represents an associated interface request. It is
|
| // similar to InterfaceRequest except that it doesn't own a message pipe handle.
|
| template <typename Interface>
|
| @@ -51,39 +47,30 @@ class AssociatedInterfaceRequest {
|
| // handle.
|
| bool is_pending() const { return handle_.is_valid(); }
|
|
|
| - private:
|
| - friend class internal::AssociatedInterfaceRequestHelper;
|
| -
|
| - internal::ScopedInterfaceEndpointHandle handle_;
|
| -};
|
| -
|
| -namespace internal {
|
| -
|
| -// With this helper, AssociatedInterfaceRequest doesn't have to expose any
|
| -// operations related to ScopedInterfaceEndpointHandle, which is an internal
|
| -// class.
|
| -class AssociatedInterfaceRequestHelper {
|
| - public:
|
| - template <typename Interface>
|
| - static ScopedInterfaceEndpointHandle PassHandle(
|
| - AssociatedInterfaceRequest<Interface>* request) {
|
| - return std::move(request->handle_);
|
| + void Bind(ScopedInterfaceEndpointHandle handle) {
|
| + handle_ = std::move(handle);
|
| }
|
|
|
| - template <typename Interface>
|
| - static const ScopedInterfaceEndpointHandle& GetHandle(
|
| - AssociatedInterfaceRequest<Interface>* request) {
|
| - return request->handle_;
|
| + ScopedInterfaceEndpointHandle PassHandle() {
|
| + return std::move(handle_);
|
| }
|
|
|
| - template <typename Interface>
|
| - static void SetHandle(AssociatedInterfaceRequest<Interface>* request,
|
| - ScopedInterfaceEndpointHandle handle) {
|
| - request->handle_ = std::move(handle);
|
| - }
|
| + const ScopedInterfaceEndpointHandle& handle() const { return handle_; }
|
| +
|
| + private:
|
| + ScopedInterfaceEndpointHandle handle_;
|
| };
|
|
|
| -} // namespace internal
|
| +// Makes an AssociatedInterfaceRequest bound to the specified associated
|
| +// endpoint.
|
| +template <typename Interface>
|
| +AssociatedInterfaceRequest<Interface> MakeAssociatedRequest(
|
| + ScopedInterfaceEndpointHandle handle) {
|
| + AssociatedInterfaceRequest<Interface> request;
|
| + request.Bind(std::move(handle));
|
| + return request;
|
| +}
|
| +
|
| } // namespace mojo
|
|
|
| #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_REQUEST_H_
|
|
|