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_PROXY_MESSAGE_PIPE_ENDPOINT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ |
6 #define MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ | 6 #define MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "mojo/edk/system/message_in_transit.h" | 9 #include "mojo/edk/system/message_in_transit.h" |
10 #include "mojo/edk/system/message_pipe_endpoint.h" | 10 #include "mojo/edk/system/message_pipe_endpoint.h" |
11 #include "mojo/edk/system/system_impl_export.h" | |
12 #include "mojo/public/cpp/system/macros.h" | 11 #include "mojo/public/cpp/system/macros.h" |
13 | 12 |
14 namespace mojo { | 13 namespace mojo { |
15 namespace system { | 14 namespace system { |
16 | 15 |
17 class ChannelEndpoint; | 16 class ChannelEndpoint; |
18 class LocalMessagePipeEndpoint; | 17 class LocalMessagePipeEndpoint; |
19 class MessagePipe; | 18 class MessagePipe; |
20 | 19 |
21 // A |ProxyMessagePipeEndpoint| is an endpoint which delegates everything to a | 20 // A |ProxyMessagePipeEndpoint| is an endpoint which delegates everything to a |
22 // |ChannelEndpoint|, which may be co-owned by a |Channel|. Like any | 21 // |ChannelEndpoint|, which may be co-owned by a |Channel|. Like any |
23 // |MessagePipeEndpoint|, a |ProxyMessagePipeEndpoint| is owned by a | 22 // |MessagePipeEndpoint|, a |ProxyMessagePipeEndpoint| is owned by a |
24 // |MessagePipe|. | 23 // |MessagePipe|. |
25 // | 24 // |
26 // For example, a |MessagePipe| with one endpoint local and the other endpoint | 25 // For example, a |MessagePipe| with one endpoint local and the other endpoint |
27 // remote consists of a |LocalMessagePipeEndpoint| and a | 26 // remote consists of a |LocalMessagePipeEndpoint| and a |
28 // |ProxyMessagePipeEndpoint|, with only the local endpoint being accessible via | 27 // |ProxyMessagePipeEndpoint|, with only the local endpoint being accessible via |
29 // a |MessagePipeDispatcher|. | 28 // a |MessagePipeDispatcher|. |
30 class MOJO_SYSTEM_IMPL_EXPORT ProxyMessagePipeEndpoint final | 29 class ProxyMessagePipeEndpoint final : public MessagePipeEndpoint { |
31 : public MessagePipeEndpoint { | |
32 public: | 30 public: |
33 explicit ProxyMessagePipeEndpoint(ChannelEndpoint* channel_endpoint); | 31 explicit ProxyMessagePipeEndpoint(ChannelEndpoint* channel_endpoint); |
34 ~ProxyMessagePipeEndpoint() override; | 32 ~ProxyMessagePipeEndpoint() override; |
35 | 33 |
36 // Returns |channel_endpoint_| and resets |channel_endpoint_| to null. This | 34 // Returns |channel_endpoint_| and resets |channel_endpoint_| to null. This |
37 // may be called at most once, after which |Close()| need not be called. | 35 // may be called at most once, after which |Close()| need not be called. |
38 // | 36 // |
39 // Note: The returned |ChannelEndpoint| must have its client changed while | 37 // Note: The returned |ChannelEndpoint| must have its client changed while |
40 // still under |MessagePipe|'s lock (which this must have also been called | 38 // still under |MessagePipe|'s lock (which this must have also been called |
41 // under). | 39 // under). |
(...skipping 10 matching lines...) Expand all Loading... |
52 | 50 |
53 scoped_refptr<ChannelEndpoint> channel_endpoint_; | 51 scoped_refptr<ChannelEndpoint> channel_endpoint_; |
54 | 52 |
55 MOJO_DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint); | 53 MOJO_DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint); |
56 }; | 54 }; |
57 | 55 |
58 } // namespace system | 56 } // namespace system |
59 } // namespace mojo | 57 } // namespace mojo |
60 | 58 |
61 #endif // MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ | 59 #endif // MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ |
OLD | NEW |