Index: mojo/system/message_pipe_endpoint.h |
diff --git a/mojo/system/message_pipe_endpoint.h b/mojo/system/message_pipe_endpoint.h |
index 03e61587bd556a3cc167765d028f7ba16b1b9e92..e64d23dd92c0f1728833fb5354621aa8b1a174a6 100644 |
--- a/mojo/system/message_pipe_endpoint.h |
+++ b/mojo/system/message_pipe_endpoint.h |
@@ -6,11 +6,14 @@ |
#define MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
#include "base/basictypes.h" |
+#include "base/memory/ref_counted.h" |
#include "mojo/public/system/core.h" |
+#include "mojo/system/message_in_transit.h" |
namespace mojo { |
namespace system { |
+class Channel; |
class Waiter; |
// This is an interface to one of the ends of a message pipe, and is used by |
@@ -26,22 +29,21 @@ class MessagePipeEndpoint { |
virtual ~MessagePipeEndpoint() {} |
// All implementations must implement these. |
- virtual void OnPeerClose() = 0; |
- virtual MojoResult EnqueueMessage( |
- const void* bytes, uint32_t num_bytes, |
- const MojoHandle* handles, uint32_t num_handles, |
- MojoWriteMessageFlags flags) = 0; |
+ virtual void Close() = 0; |
+ // Returns false if the endpoint should be closed and destroyed, else true. |
+ virtual bool OnPeerClose() = 0; |
+ // Takes ownership of |message|. |
+ virtual MojoResult EnqueueMessage(MessageInTransit* message) = 0; |
// Implementations must override these if they represent a local endpoint, |
// i.e., one for which there's a |MessagePipeDispatcher| (and thus a handle). |
- // An implementation for a remote endpoint (for which there's no dispatcher) |
+ // An implementation for a proxy endpoint (for which there's no dispatcher) |
// needs not override these methods, since they should never be called. |
// |
// These methods implement the methods of the same name in |MessagePipe|, |
// though |MessagePipe|'s implementation may have to do a little more if the |
// operation involves both endpoints. |
virtual void CancelAllWaiters(); |
- virtual void Close(); |
virtual MojoResult ReadMessage(void* bytes, uint32_t* num_bytes, |
MojoHandle* handles, uint32_t* num_handles, |
MojoReadMessageFlags flags); |
@@ -50,6 +52,14 @@ class MessagePipeEndpoint { |
MojoResult wake_result); |
virtual void RemoveWaiter(Waiter* waiter); |
+ // Implementations must override these if they represent a proxy endpoint. An |
+ // implementation for a local endpoint needs not override these methods, since |
+ // they should never be called. |
+ virtual void Attach(scoped_refptr<Channel> channel, |
+ MessageInTransit::EndpointId local_id); |
+ // Returns false if the endpoint should be closed and destroyed, else true. |
+ virtual bool Run(MessageInTransit::EndpointId remote_id); |
+ |
protected: |
MessagePipeEndpoint() {} |