Chromium Code Reviews| 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..5b83641d0b42692b1682ee306ed8e21391d45f8f |
| --- /dev/null |
| +++ b/mojo/system/local_message_pipe_endpoint.h |
| @@ -0,0 +1,63 @@ |
| +// 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(); |
| + |
| + // All implementations must implement these. |
| + virtual void OnPeerClose() OVERRIDE; |
| + virtual MojoResult EnqueueMessage( |
| + const void* bytes, uint32_t num_bytes, |
| + const MojoHandle* handles, uint32_t num_handles, |
| + MojoWriteMessageFlags flags) OVERRIDE; |
| + |
| + // Implementations need only implement/override these if they are "connected" |
|
darin (slow to review)
2013/10/15 06:50:36
nit: This comment seems out of place. Looks to hav
viettrungluu
2013/10/15 17:48:58
Done.
|
| + // to a local |MessagePipeDispatcher|. They 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() 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_ |