| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ |
| 6 #define MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | 6 #define MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "mojo/edk/system/awakable_list.h" |
| 10 #include "mojo/edk/system/handle_signals_state.h" | 11 #include "mojo/edk/system/handle_signals_state.h" |
| 11 #include "mojo/edk/system/message_in_transit_queue.h" | 12 #include "mojo/edk/system/message_in_transit_queue.h" |
| 12 #include "mojo/edk/system/message_pipe_endpoint.h" | 13 #include "mojo/edk/system/message_pipe_endpoint.h" |
| 13 #include "mojo/edk/system/system_impl_export.h" | 14 #include "mojo/edk/system/system_impl_export.h" |
| 14 #include "mojo/edk/system/waiter_list.h" | |
| 15 | 15 |
| 16 namespace mojo { | 16 namespace mojo { |
| 17 namespace system { | 17 namespace system { |
| 18 | 18 |
| 19 class MOJO_SYSTEM_IMPL_EXPORT LocalMessagePipeEndpoint | 19 class MOJO_SYSTEM_IMPL_EXPORT LocalMessagePipeEndpoint |
| 20 : public MessagePipeEndpoint { | 20 : public MessagePipeEndpoint { |
| 21 public: | 21 public: |
| 22 LocalMessagePipeEndpoint(); | 22 LocalMessagePipeEndpoint(); |
| 23 ~LocalMessagePipeEndpoint() override; | 23 ~LocalMessagePipeEndpoint() override; |
| 24 | 24 |
| 25 // |MessagePipeEndpoint| implementation: | 25 // |MessagePipeEndpoint| implementation: |
| 26 Type GetType() const override; | 26 Type GetType() const override; |
| 27 bool OnPeerClose() override; | 27 bool OnPeerClose() override; |
| 28 void EnqueueMessage(scoped_ptr<MessageInTransit> message) override; | 28 void EnqueueMessage(scoped_ptr<MessageInTransit> message) override; |
| 29 | 29 |
| 30 // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to | 30 // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to |
| 31 // implement/override these: | 31 // implement/override these: |
| 32 void Close() override; | 32 void Close() override; |
| 33 void CancelAllWaiters() override; | 33 void CancelAllAwakables() override; |
| 34 MojoResult ReadMessage(UserPointer<void> bytes, | 34 MojoResult ReadMessage(UserPointer<void> bytes, |
| 35 UserPointer<uint32_t> num_bytes, | 35 UserPointer<uint32_t> num_bytes, |
| 36 DispatcherVector* dispatchers, | 36 DispatcherVector* dispatchers, |
| 37 uint32_t* num_dispatchers, | 37 uint32_t* num_dispatchers, |
| 38 MojoReadMessageFlags flags) override; | 38 MojoReadMessageFlags flags) override; |
| 39 HandleSignalsState GetHandleSignalsState() const override; | 39 HandleSignalsState GetHandleSignalsState() const override; |
| 40 MojoResult AddWaiter(Waiter* waiter, | 40 MojoResult AddAwakable(Awakable* awakable, |
| 41 MojoHandleSignals signals, | 41 MojoHandleSignals signals, |
| 42 uint32_t context, | 42 uint32_t context, |
| 43 HandleSignalsState* signals_state) override; | 43 HandleSignalsState* signals_state) override; |
| 44 void RemoveWaiter(Waiter* waiter, HandleSignalsState* signals_state) override; | 44 void RemoveAwakable(Awakable* awakable, |
| 45 HandleSignalsState* signals_state) override; |
| 45 | 46 |
| 46 // This is only to be used by |MessagePipe|: | 47 // This is only to be used by |MessagePipe|: |
| 47 MessageInTransitQueue* message_queue() { return &message_queue_; } | 48 MessageInTransitQueue* message_queue() { return &message_queue_; } |
| 48 | 49 |
| 49 private: | 50 private: |
| 50 bool is_open_; | 51 bool is_open_; |
| 51 bool is_peer_open_; | 52 bool is_peer_open_; |
| 52 | 53 |
| 53 // Queue of incoming messages. | 54 // Queue of incoming messages. |
| 54 MessageInTransitQueue message_queue_; | 55 MessageInTransitQueue message_queue_; |
| 55 WaiterList waiter_list_; | 56 AwakableList awakable_list_; |
| 56 | 57 |
| 57 DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint); | 58 DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint); |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 } // namespace system | 61 } // namespace system |
| 61 } // namespace mojo | 62 } // namespace mojo |
| 62 | 63 |
| 63 #endif // MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | 64 #endif // MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ |
| OLD | NEW |