| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "mojo/edk/system/message_in_transit.h" | 10 #include "mojo/edk/system/message_in_transit.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // For example, a |MessagePipe| with one endpoint local and the other endpoint | 26 // For example, a |MessagePipe| with one endpoint local and the other endpoint |
| 27 // remote consists of a |LocalMessagePipeEndpoint| and a | 27 // remote consists of a |LocalMessagePipeEndpoint| and a |
| 28 // |ProxyMessagePipeEndpoint|, with only the local endpoint being accessible via | 28 // |ProxyMessagePipeEndpoint|, with only the local endpoint being accessible via |
| 29 // a |MessagePipeDispatcher|. | 29 // a |MessagePipeDispatcher|. |
| 30 class MOJO_SYSTEM_IMPL_EXPORT ProxyMessagePipeEndpoint | 30 class MOJO_SYSTEM_IMPL_EXPORT ProxyMessagePipeEndpoint |
| 31 : public MessagePipeEndpoint { | 31 : public MessagePipeEndpoint { |
| 32 public: | 32 public: |
| 33 explicit ProxyMessagePipeEndpoint(ChannelEndpoint* channel_endpoint); | 33 explicit ProxyMessagePipeEndpoint(ChannelEndpoint* channel_endpoint); |
| 34 ~ProxyMessagePipeEndpoint() override; | 34 ~ProxyMessagePipeEndpoint() override; |
| 35 | 35 |
| 36 // Returns |channel_endpoint_| and resets |channel_endpoint_| to null. This |
| 37 // may be called at most once, after which |Close()| need not be called. |
| 38 // |
| 39 // Note: The returned |ChannelEndpoint| must have its client changed while |
| 40 // still under |MessagePipe|'s lock (which this must have also been called |
| 41 // under). |
| 42 scoped_refptr<ChannelEndpoint> ReleaseChannelEndpoint(); |
| 43 |
| 36 // |MessagePipeEndpoint| implementation: | 44 // |MessagePipeEndpoint| implementation: |
| 37 Type GetType() const override; | 45 Type GetType() const override; |
| 38 bool OnPeerClose() override; | 46 bool OnPeerClose() override; |
| 39 void EnqueueMessage(scoped_ptr<MessageInTransit> message) override; | 47 void EnqueueMessage(scoped_ptr<MessageInTransit> message) override; |
| 40 void Close() override; | 48 void Close() override; |
| 41 | 49 |
| 42 private: | 50 private: |
| 43 void DetachIfNecessary(); | 51 void DetachIfNecessary(); |
| 44 | 52 |
| 45 scoped_refptr<ChannelEndpoint> channel_endpoint_; | 53 scoped_refptr<ChannelEndpoint> channel_endpoint_; |
| 46 | 54 |
| 47 DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint); | 55 DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint); |
| 48 }; | 56 }; |
| 49 | 57 |
| 50 } // namespace system | 58 } // namespace system |
| 51 } // namespace mojo | 59 } // namespace mojo |
| 52 | 60 |
| 53 #endif // MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ | 61 #endif // MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ |
| OLD | NEW |