Index: mojo/system/message_pipe.h |
diff --git a/mojo/system/message_pipe.h b/mojo/system/message_pipe.h |
index bb2f4ff0a7d8366551c988333d02c5bfaef49261..67f99d2f584e1ed7ebf717c8f6311ac923ae8218 100644 |
--- a/mojo/system/message_pipe.h |
+++ b/mojo/system/message_pipe.h |
@@ -6,15 +6,18 @@ |
#define MOJO_SYSTEM_MESSAGE_PIPE_H_ |
#include "base/basictypes.h" |
+#include "base/callback.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/synchronization/lock.h" |
#include "mojo/public/system/core.h" |
#include "mojo/public/system/system_export.h" |
+#include "mojo/system/message_in_transit.h" |
namespace mojo { |
namespace system { |
+class Channel; |
class MessagePipeEndpoint; |
class Waiter; |
@@ -32,6 +35,9 @@ class MOJO_SYSTEM_EXPORT MessagePipe : |
// |LocalMessagePipeEndpoint|s. |
MessagePipe(); |
+ // Gets the other port number (i.e., 0 -> 1, 1 -> 0). |
+ static unsigned GetPeerPort(unsigned port); |
+ |
// These are called by the dispatcher to implement its methods of |
// corresponding names. In all cases, the port |port| must be open. |
void CancelAllWaiters(unsigned port); |
@@ -54,10 +60,26 @@ class MOJO_SYSTEM_EXPORT MessagePipe : |
MojoResult wake_result); |
void RemoveWaiter(unsigned port, Waiter* waiter); |
+ // This is used internally by |WriteMessage()| and by |Channel| to enqueue |
+ // messages (typically to a |LocalMessagePipeEndpoint|). Unlike |
+ // |WriteMessage()|, |port| is the *destination* port. Takes ownership of |
+ // |message|. |
+ MojoResult EnqueueMessage(unsigned port, MessageInTransit* message); |
+ |
+ // These are used by |Channel|. |
+ void Attach(unsigned port, |
+ scoped_refptr<Channel> channel, |
+ MessageInTransit::EndpointId local_id); |
+ void Run(unsigned port, MessageInTransit::EndpointId remote_id); |
+ |
private: |
friend class base::RefCountedThreadSafe<MessagePipe>; |
virtual ~MessagePipe(); |
+ // Used by |EnqueueMessage()| to handle control messages that are actually |
+ // meant for us. |
+ MojoResult HandleControlMessage(unsigned port, MessageInTransit* message); |
+ |
base::Lock lock_; // Protects the following members. |
scoped_ptr<MessagePipeEndpoint> endpoints_[2]; |