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_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ | 5 #ifndef MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ |
6 #define MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ | 6 #define MOJO_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/system/message_in_transit.h" | 10 #include "mojo/system/message_in_transit.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // - A |ProxyMessagePipeEndpoint| starts out *detached*, i.e., not associated | 30 // - A |ProxyMessagePipeEndpoint| starts out *detached*, i.e., not associated |
31 // to any |Channel|. When *attached*, it gets a reference to a |Channel| and | 31 // to any |Channel|. When *attached*, it gets a reference to a |Channel| and |
32 // is assigned a local ID. A |ProxyMessagePipeEndpoint| must be detached | 32 // is assigned a local ID. A |ProxyMessagePipeEndpoint| must be detached |
33 // before destruction; this is done inside |Close()|. | 33 // before destruction; this is done inside |Close()|. |
34 // - When attached, a |ProxyMessagePipeEndpoint| starts out not running. When | 34 // - When attached, a |ProxyMessagePipeEndpoint| starts out not running. When |
35 // run, it gets a remote ID. | 35 // run, it gets a remote ID. |
36 class MOJO_SYSTEM_IMPL_EXPORT ProxyMessagePipeEndpoint | 36 class MOJO_SYSTEM_IMPL_EXPORT ProxyMessagePipeEndpoint |
37 : public MessagePipeEndpoint { | 37 : public MessagePipeEndpoint { |
38 public: | 38 public: |
39 explicit ProxyMessagePipeEndpoint(ChannelEndpoint* channel_endpoint); | 39 explicit ProxyMessagePipeEndpoint(ChannelEndpoint* channel_endpoint); |
40 // Constructs a |ProxyMessagePipeEndpoint|, whose peer may already be closed. | |
41 // This is used to construct one to replace a |LocalMessagePipeEndpoint|, when | |
42 // transferring a message pipe handle over a remote message pipe. | |
43 ProxyMessagePipeEndpoint( | |
44 ChannelEndpoint* channel_endpoint, | |
45 bool is_peer_open); | |
46 virtual ~ProxyMessagePipeEndpoint(); | 40 virtual ~ProxyMessagePipeEndpoint(); |
47 | 41 |
48 // |MessagePipeEndpoint| implementation: | 42 // |MessagePipeEndpoint| implementation: |
49 virtual Type GetType() const OVERRIDE; | 43 virtual Type GetType() const OVERRIDE; |
50 virtual bool OnPeerClose() OVERRIDE; | 44 virtual bool OnPeerClose() OVERRIDE; |
51 virtual void EnqueueMessage(scoped_ptr<MessageInTransit> message) OVERRIDE; | 45 virtual void EnqueueMessage(scoped_ptr<MessageInTransit> message) OVERRIDE; |
52 virtual bool Run() OVERRIDE; | |
53 virtual void OnRemove() OVERRIDE; | 46 virtual void OnRemove() OVERRIDE; |
54 | 47 |
55 private: | 48 private: |
56 void Detach(); | 49 void Detach(); |
57 | 50 |
58 // TODO(vtl): Get rid of these. | 51 // TODO(vtl): Get rid of this. |
59 bool is_attached() const { return !!channel_endpoint_.get(); } | 52 bool is_attached() const { return !!channel_endpoint_.get(); } |
60 bool is_running() const { return is_running_; } | |
61 | 53 |
62 // This should only be set if we're attached. | 54 // This should only be set if we're attached. |
63 scoped_refptr<ChannelEndpoint> channel_endpoint_; | 55 scoped_refptr<ChannelEndpoint> channel_endpoint_; |
64 | 56 |
65 // TODO(vtl): Get rid of this. | |
66 bool is_running_; | |
67 | |
68 bool is_peer_open_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint); | 57 DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint); |
71 }; | 58 }; |
72 | 59 |
73 } // namespace system | 60 } // namespace system |
74 } // namespace mojo | 61 } // namespace mojo |
75 | 62 |
76 #endif // MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ | 63 #endif // MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ |
OLD | NEW |