OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHANNEL_ENDPOINT_H_ | 5 #ifndef MOJO_SYSTEM_CHANNEL_ENDPOINT_H_ |
6 #define MOJO_SYSTEM_CHANNEL_ENDPOINT_H_ | 6 #define MOJO_SYSTEM_CHANNEL_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 "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // yet.] | 103 // yet.] |
104 // - Note that even if the local side is closed, it may still receive a | 104 // - Note that even if the local side is closed, it may still receive a |
105 // "remove" message from the other side (if the other side is closed | 105 // "remove" message from the other side (if the other side is closed |
106 // simultaneously, and both sides send "remove" messages). In that | 106 // simultaneously, and both sides send "remove" messages). In that |
107 // case, it must still remain alive until it receives the "remove | 107 // case, it must still remain alive until it receives the "remove |
108 // ack" (and it must ack the "remove" message that it received). | 108 // ack" (and it must ack the "remove" message that it received). |
109 class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpoint | 109 class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpoint |
110 : public base::RefCountedThreadSafe<ChannelEndpoint> { | 110 : public base::RefCountedThreadSafe<ChannelEndpoint> { |
111 public: | 111 public: |
112 // TODO(vtl): More comments.... | 112 // TODO(vtl): More comments.... |
113 // The caller must keep |channel| alive until the |Channel| has taken | |
114 // ownership of a reference to the created object. (TODO(vtl): Convert | |
115 // |Channel::AttachMessagePipeEndpoint()| to a |Channel::AttachEndpoint()| | |
116 // that takes a |ChannelEndpoint|, and move |ChannelEndpoint| creation out of | |
117 // |Channel|.) | |
118 ChannelEndpoint(MessagePipe* message_pipe, unsigned port); | 113 ChannelEndpoint(MessagePipe* message_pipe, unsigned port); |
119 | 114 |
120 // Methods called by |MessagePipe| (via |ProxyMessagePipeEndpoint|): | 115 // Methods called by |MessagePipe| (via |ProxyMessagePipeEndpoint|): |
121 | 116 |
122 // TODO(vtl): This currently only works if we're "running". We'll move the | 117 // TODO(vtl): This currently only works if we're "running". We'll move the |
123 // "paused message queue" here (will this be needed when we have | 118 // "paused message queue" here (will this be needed when we have |
124 // locally-allocated remote IDs?). | 119 // locally-allocated remote IDs?). |
125 bool EnqueueMessage(scoped_ptr<MessageInTransit> message); | 120 bool EnqueueMessage(scoped_ptr<MessageInTransit> message); |
126 | 121 |
127 void DetachFromMessagePipe(); | 122 void DetachFromMessagePipe(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 MessageInTransit::EndpointId local_id_; | 170 MessageInTransit::EndpointId local_id_; |
176 MessageInTransit::EndpointId remote_id_; | 171 MessageInTransit::EndpointId remote_id_; |
177 | 172 |
178 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); | 173 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); |
179 }; | 174 }; |
180 | 175 |
181 } // namespace system | 176 } // namespace system |
182 } // namespace mojo | 177 } // namespace mojo |
183 | 178 |
184 #endif // MOJO_SYSTEM_CHANNEL_ENDPOINT_H_ | 179 #endif // MOJO_SYSTEM_CHANNEL_ENDPOINT_H_ |
OLD | NEW |