Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Unified Diff: mojo/system/message_pipe_endpoint.h

Issue 60103005: Mojo: First stab at making MessagePipes work across OS pipes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..14e989765c36119a2e527c1e7aac59bdf8b729ab 100644
--- a/mojo/system/message_pipe_endpoint.h
+++ b/mojo/system/message_pipe_endpoint.h
@@ -6,11 +6,15 @@
#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/public/system/system_export.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
@@ -21,27 +25,26 @@ class Waiter;
// |MessagePipeEndpoint| also implements the functionality required by the
// dispatcher, e.g., to read messages and to wait. Implementations of this class
// are not thread-safe; instances are protected by |MesssagePipe|'s lock.
-class MessagePipeEndpoint {
+class MOJO_SYSTEM_EXPORT MessagePipeEndpoint {
public:
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 +53,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() {}

Powered by Google App Engine
This is Rietveld 408576698