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..0479a5471e3ab8482640ab195b86526148a336e8 100644 |
--- a/mojo/public/cpp/bindings/interface.h |
+++ b/mojo/public/cpp/bindings/interface.h |
@@ -16,77 +16,38 @@ namespace mojo { |
// NoInterface is for use in cases when a non-existent or empty interface is |
// needed (e.g., when the Mojom "Peer" attribute is not present). |
-class NoInterface; |
+class NoInterfaceProxy; |
+class NoInterfaceStub; |
+ |
+class NoInterface { |
+ public: |
+ typedef NoInterfaceProxy Proxy_; |
+ typedef NoInterfaceStub Stub_; |
+ typedef NoInterface Client_; |
+ virtual ~NoInterface() {} |
+ virtual void SetClient(NoInterface* client) {} |
+}; |
+ |
+class NoInterfaceProxy : public NoInterface { |
+ public: |
+ explicit NoInterfaceProxy(MessageReceiver* receiver) {} |
+}; |
class NoInterfaceStub : public MessageReceiver { |
public: |
- NoInterfaceStub(NoInterface* unused) {} |
+ NoInterfaceStub() {} |
+ void set_sink(NoInterface* sink) {} |
virtual bool Accept(Message* message) MOJO_OVERRIDE; |
virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder) |
MOJO_OVERRIDE; |
}; |
-class NoInterface { |
- public: |
- typedef NoInterfaceStub _Stub; |
- typedef NoInterface _Peer; |
-}; |
- |
// AnyInterface is for use in cases where any interface would do (e.g., see the |
// Shell::Connect method). |
typedef NoInterface AnyInterface; |
- |
-// InterfaceHandle<S> |
- |
-template <typename S> |
-class InterfaceHandle : public MessagePipeHandle { |
- public: |
- InterfaceHandle() {} |
- explicit InterfaceHandle(MojoHandle value) : MessagePipeHandle(value) {} |
-}; |
- |
- |
-// Interface<S> |
- |
-template <typename S> |
-struct Interface { |
- typedef InterfaceHandle<S> Handle; |
- typedef ScopedHandleBase<InterfaceHandle<S> > ScopedHandle; |
-}; |
- |
-template <> |
-struct Interface<mojo::NoInterface> { |
- typedef MessagePipeHandle Handle; |
- typedef ScopedMessagePipeHandle ScopedHandle; |
-}; |
- |
- |
-// InterfacePipe<S,P> is used to construct a MessagePipe with typed interfaces |
-// on either end. |
- |
-template <typename S, typename P = typename S::_Peer> |
-class InterfacePipe { |
- public: |
- InterfacePipe() { |
- typename Interface<S>::Handle h0; |
- typename Interface<P>::Handle h1; |
- MojoResult result MOJO_ALLOW_UNUSED = |
- MojoCreateMessagePipe(h0.mutable_value(), h1.mutable_value()); |
- assert(result == MOJO_RESULT_OK); |
- handle_to_self.reset(h0); |
- handle_to_peer.reset(h1); |
- } |
- |
- typename Interface<S>::ScopedHandle handle_to_self; |
- typename Interface<P>::ScopedHandle handle_to_peer; |
-}; |
- |
-// TODO(darin): Once we have the ability to use C++11 features, consider |
-// defining a template alias for ScopedInterfaceHandle<S>. |
- |
} // namespace mojo |
#endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_H_ |