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_MESSAGE_PIPE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ | 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "mojo/edk/embedder/platform_handle_vector.h" | 15 #include "mojo/edk/embedder/platform_handle_vector.h" |
16 #include "mojo/edk/system/channel_endpoint_client.h" | 16 #include "mojo/edk/system/channel_endpoint_client.h" |
17 #include "mojo/edk/system/dispatcher.h" | 17 #include "mojo/edk/system/dispatcher.h" |
18 #include "mojo/edk/system/handle_signals_state.h" | 18 #include "mojo/edk/system/handle_signals_state.h" |
19 #include "mojo/edk/system/memory.h" | 19 #include "mojo/edk/system/memory.h" |
20 #include "mojo/edk/system/message_in_transit.h" | 20 #include "mojo/edk/system/message_in_transit.h" |
21 #include "mojo/edk/system/message_pipe_endpoint.h" | 21 #include "mojo/edk/system/message_pipe_endpoint.h" |
22 #include "mojo/edk/system/mutex.h" | 22 #include "mojo/edk/system/mutex.h" |
23 #include "mojo/edk/system/system_impl_export.h" | |
24 #include "mojo/public/c/system/message_pipe.h" | 23 #include "mojo/public/c/system/message_pipe.h" |
25 #include "mojo/public/c/system/types.h" | 24 #include "mojo/public/c/system/types.h" |
26 #include "mojo/public/cpp/system/macros.h" | 25 #include "mojo/public/cpp/system/macros.h" |
27 | 26 |
28 namespace mojo { | 27 namespace mojo { |
29 namespace system { | 28 namespace system { |
30 | 29 |
31 class Awakable; | 30 class Awakable; |
32 class Channel; | 31 class Channel; |
33 class ChannelEndpoint; | 32 class ChannelEndpoint; |
34 class MessageInTransitQueue; | 33 class MessageInTransitQueue; |
35 | 34 |
36 // |MessagePipe| is the secondary object implementing a message pipe (see the | 35 // |MessagePipe| is the secondary object implementing a message pipe (see the |
37 // explanatory comment in core.cc). It is typically owned by the dispatcher(s) | 36 // explanatory comment in core.cc). It is typically owned by the dispatcher(s) |
38 // corresponding to the local endpoints. This class is thread-safe. | 37 // corresponding to the local endpoints. This class is thread-safe. |
39 class MOJO_SYSTEM_IMPL_EXPORT MessagePipe final : public ChannelEndpointClient { | 38 class MessagePipe final : public ChannelEndpointClient { |
40 public: | 39 public: |
41 // Creates a |MessagePipe| with two new |LocalMessagePipeEndpoint|s. | 40 // Creates a |MessagePipe| with two new |LocalMessagePipeEndpoint|s. |
42 static MessagePipe* CreateLocalLocal(); | 41 static MessagePipe* CreateLocalLocal(); |
43 | 42 |
44 // Creates a |MessagePipe| with a |LocalMessagePipeEndpoint| on port 0 and a | 43 // Creates a |MessagePipe| with a |LocalMessagePipeEndpoint| on port 0 and a |
45 // |ProxyMessagePipeEndpoint| on port 1. |*channel_endpoint| is set to the | 44 // |ProxyMessagePipeEndpoint| on port 1. |*channel_endpoint| is set to the |
46 // (newly-created) |ChannelEndpoint| for the latter. | 45 // (newly-created) |ChannelEndpoint| for the latter. |
47 static MessagePipe* CreateLocalProxy( | 46 static MessagePipe* CreateLocalProxy( |
48 scoped_refptr<ChannelEndpoint>* channel_endpoint); | 47 scoped_refptr<ChannelEndpoint>* channel_endpoint); |
49 | 48 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 mutable Mutex mutex_; | 140 mutable Mutex mutex_; |
142 std::unique_ptr<MessagePipeEndpoint> endpoints_[2] MOJO_GUARDED_BY(mutex_); | 141 std::unique_ptr<MessagePipeEndpoint> endpoints_[2] MOJO_GUARDED_BY(mutex_); |
143 | 142 |
144 MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipe); | 143 MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipe); |
145 }; | 144 }; |
146 | 145 |
147 } // namespace system | 146 } // namespace system |
148 } // namespace mojo | 147 } // namespace mojo |
149 | 148 |
150 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ | 149 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
OLD | NEW |