Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | |
| 6 #define MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | |
| 7 | |
| 8 #include <deque> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "mojo/public/system/core.h" | |
| 13 #include "mojo/system/message_pipe_endpoint.h" | |
| 14 #include "mojo/system/waiter_list.h" | |
| 15 | |
| 16 namespace mojo { | |
| 17 namespace system { | |
| 18 | |
| 19 class MessageInTransit; | |
| 20 | |
| 21 class LocalMessagePipeEndpoint : public MessagePipeEndpoint { | |
| 22 public: | |
| 23 LocalMessagePipeEndpoint(); | |
| 24 virtual ~LocalMessagePipeEndpoint(); | |
| 25 | |
| 26 // All implementations must implement these. | |
| 27 virtual void OnPeerClose() OVERRIDE; | |
| 28 virtual MojoResult EnqueueMessage( | |
| 29 const void* bytes, uint32_t num_bytes, | |
| 30 const MojoHandle* handles, uint32_t num_handles, | |
| 31 MojoWriteMessageFlags flags) OVERRIDE; | |
| 32 | |
| 33 // 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.
| |
| 34 // to a local |MessagePipeDispatcher|. They implement the methods of the same | |
| 35 // name in |MessagePipe|, though |MessagePipe|'s implementation may have to do | |
| 36 // a little more if the operation involves both endpoints. | |
| 37 virtual void CancelAllWaiters() OVERRIDE; | |
| 38 virtual void Close() OVERRIDE; | |
| 39 virtual MojoResult ReadMessage(void* bytes, uint32_t* num_bytes, | |
| 40 MojoHandle* handles, uint32_t* num_handles, | |
| 41 MojoReadMessageFlags flags) OVERRIDE; | |
| 42 virtual MojoResult AddWaiter(Waiter* waiter, | |
| 43 MojoWaitFlags flags, | |
| 44 MojoResult wake_result) OVERRIDE; | |
| 45 virtual void RemoveWaiter(Waiter* waiter) OVERRIDE; | |
| 46 | |
| 47 private: | |
| 48 MojoWaitFlags SatisfiedFlags(); | |
| 49 MojoWaitFlags SatisfiableFlags(); | |
| 50 | |
| 51 bool is_open_; | |
| 52 bool is_peer_open_; | |
| 53 | |
| 54 std::deque<MessageInTransit*> message_queue_; | |
| 55 WaiterList waiter_list_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint); | |
| 58 }; | |
| 59 | |
| 60 } // namespace system | |
| 61 } // namespace mojo | |
| 62 | |
| 63 #endif // MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | |
| OLD | NEW |