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

Unified Diff: mojo/system/local_message_pipe_endpoint.h

Issue 27060003: Mojo: Abstract out the endpoints of MessagePipes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 2 months 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
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/system/local_message_pipe_endpoint.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/local_message_pipe_endpoint.h
diff --git a/mojo/system/local_message_pipe_endpoint.h b/mojo/system/local_message_pipe_endpoint.h
new file mode 100644
index 0000000000000000000000000000000000000000..caed81df6e6de527957b3bd4aa073318fd5133a1
--- /dev/null
+++ b/mojo/system/local_message_pipe_endpoint.h
@@ -0,0 +1,61 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_
+#define MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_
+
+#include <deque>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "mojo/public/system/core.h"
+#include "mojo/system/message_pipe_endpoint.h"
+#include "mojo/system/waiter_list.h"
+
+namespace mojo {
+namespace system {
+
+class MessageInTransit;
+
+class LocalMessagePipeEndpoint : public MessagePipeEndpoint {
+ public:
+ LocalMessagePipeEndpoint();
+ virtual ~LocalMessagePipeEndpoint();
+
+ // |MessagePipeEndpoint| implementation:
+ virtual void OnPeerClose() OVERRIDE;
+ virtual MojoResult EnqueueMessage(
+ const void* bytes, uint32_t num_bytes,
+ const MojoHandle* handles, uint32_t num_handles,
+ MojoWriteMessageFlags flags) OVERRIDE;
+
+ // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to
+ // implement/override these:
+ virtual void CancelAllWaiters() OVERRIDE;
+ virtual void Close() OVERRIDE;
+ virtual MojoResult ReadMessage(void* bytes, uint32_t* num_bytes,
+ MojoHandle* handles, uint32_t* num_handles,
+ MojoReadMessageFlags flags) OVERRIDE;
+ virtual MojoResult AddWaiter(Waiter* waiter,
+ MojoWaitFlags flags,
+ MojoResult wake_result) OVERRIDE;
+ virtual void RemoveWaiter(Waiter* waiter) OVERRIDE;
+
+ private:
+ MojoWaitFlags SatisfiedFlags();
+ MojoWaitFlags SatisfiableFlags();
+
+ bool is_open_;
+ bool is_peer_open_;
+
+ std::deque<MessageInTransit*> message_queue_;
+ WaiterList waiter_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint);
+};
+
+} // namespace system
+} // namespace mojo
+
+#endif // MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/system/local_message_pipe_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698