| 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_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | |
| 6 #define MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "mojo/edk/system/awakable_list.h" | |
| 11 #include "mojo/edk/system/handle_signals_state.h" | |
| 12 #include "mojo/edk/system/message_in_transit_queue.h" | |
| 13 #include "mojo/edk/system/message_pipe_endpoint.h" | |
| 14 #include "mojo/edk/system/system_impl_export.h" | |
| 15 | |
| 16 namespace mojo { | |
| 17 namespace system { | |
| 18 | |
| 19 class MOJO_SYSTEM_IMPL_EXPORT LocalMessagePipeEndpoint | |
| 20 : public MessagePipeEndpoint { | |
| 21 public: | |
| 22 // If |message_queue| is non-null, its contents will be taken as the queue of | |
| 23 // (already-received) messages. | |
| 24 explicit LocalMessagePipeEndpoint( | |
| 25 MessageInTransitQueue* message_queue = nullptr); | |
| 26 ~LocalMessagePipeEndpoint() override; | |
| 27 | |
| 28 // |MessagePipeEndpoint| implementation: | |
| 29 Type GetType() const override; | |
| 30 bool OnPeerClose() override; | |
| 31 void EnqueueMessage(scoped_ptr<MessageInTransit> message) override; | |
| 32 | |
| 33 // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to | |
| 34 // implement/override these: | |
| 35 void Close() override; | |
| 36 void CancelAllAwakables() override; | |
| 37 MojoResult ReadMessage(UserPointer<void> bytes, | |
| 38 UserPointer<uint32_t> num_bytes, | |
| 39 DispatcherVector* dispatchers, | |
| 40 uint32_t* num_dispatchers, | |
| 41 MojoReadMessageFlags flags) override; | |
| 42 HandleSignalsState GetHandleSignalsState() const override; | |
| 43 MojoResult AddAwakable(Awakable* awakable, | |
| 44 MojoHandleSignals signals, | |
| 45 uint32_t context, | |
| 46 HandleSignalsState* signals_state) override; | |
| 47 void RemoveAwakable(Awakable* awakable, | |
| 48 HandleSignalsState* signals_state) override; | |
| 49 | |
| 50 // This is only to be used by |MessagePipe|: | |
| 51 MessageInTransitQueue* message_queue() { return &message_queue_; } | |
| 52 | |
| 53 private: | |
| 54 bool is_open_; | |
| 55 bool is_peer_open_; | |
| 56 | |
| 57 // Queue of incoming messages. | |
| 58 MessageInTransitQueue message_queue_; | |
| 59 AwakableList awakable_list_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint); | |
| 62 }; | |
| 63 | |
| 64 } // namespace system | |
| 65 } // namespace mojo | |
| 66 | |
| 67 #endif // MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | |
| OLD | NEW |