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 "mojo/edk/system/awakable_list.h" | 8 #include "mojo/edk/system/awakable_list.h" |
9 #include "mojo/edk/system/handle_signals_state.h" | 9 #include "mojo/edk/system/handle_signals_state.h" |
10 #include "mojo/edk/system/message_in_transit_queue.h" | 10 #include "mojo/edk/system/message_in_transit_queue.h" |
11 #include "mojo/edk/system/message_pipe_endpoint.h" | 11 #include "mojo/edk/system/message_pipe_endpoint.h" |
12 #include "mojo/edk/system/system_impl_export.h" | 12 #include "mojo/edk/system/system_impl_export.h" |
13 #include "mojo/public/cpp/system/macros.h" | 13 #include "mojo/public/cpp/system/macros.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 namespace system { | 16 namespace system { |
17 | 17 |
18 class MOJO_SYSTEM_IMPL_EXPORT LocalMessagePipeEndpoint final | 18 class MOJO_SYSTEM_IMPL_EXPORT LocalMessagePipeEndpoint final |
19 : public MessagePipeEndpoint { | 19 : public MessagePipeEndpoint { |
20 public: | 20 public: |
21 // If |message_queue| is non-null, its contents will be taken as the queue of | 21 // If |message_queue| is non-null, its contents will be taken as the queue of |
22 // (already-received) messages. | 22 // (already-received) messages. |
23 explicit LocalMessagePipeEndpoint( | 23 explicit LocalMessagePipeEndpoint( |
24 MessageInTransitQueue* message_queue = nullptr); | 24 MessageInTransitQueue* message_queue = nullptr); |
25 ~LocalMessagePipeEndpoint() override; | 25 ~LocalMessagePipeEndpoint() override; |
26 | 26 |
27 // |MessagePipeEndpoint| implementation: | 27 // |MessagePipeEndpoint| implementation: |
28 Type GetType() const override; | 28 Type GetType() const override; |
29 bool OnPeerClose() override; | 29 bool OnPeerClose() override; |
30 void EnqueueMessage(scoped_ptr<MessageInTransit> message) override; | 30 void EnqueueMessage(std::unique_ptr<MessageInTransit> message) override; |
31 | 31 |
32 // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to | 32 // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to |
33 // implement/override these: | 33 // implement/override these: |
34 void Close() override; | 34 void Close() override; |
35 void CancelAllAwakables() override; | 35 void CancelAllAwakables() override; |
36 MojoResult ReadMessage(UserPointer<void> bytes, | 36 MojoResult ReadMessage(UserPointer<void> bytes, |
37 UserPointer<uint32_t> num_bytes, | 37 UserPointer<uint32_t> num_bytes, |
38 DispatcherVector* dispatchers, | 38 DispatcherVector* dispatchers, |
39 uint32_t* num_dispatchers, | 39 uint32_t* num_dispatchers, |
40 MojoReadMessageFlags flags) override; | 40 MojoReadMessageFlags flags) override; |
(...skipping 16 matching lines...) Expand all Loading... |
57 MessageInTransitQueue message_queue_; | 57 MessageInTransitQueue message_queue_; |
58 AwakableList awakable_list_; | 58 AwakableList awakable_list_; |
59 | 59 |
60 MOJO_DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint); | 60 MOJO_DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace system | 63 } // namespace system |
64 } // namespace mojo | 64 } // namespace mojo |
65 | 65 |
66 #endif // MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | 66 #endif // MOJO_EDK_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ |
OLD | NEW |