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 "mojo/system/message_pipe.h" | 10 #include "mojo/system/message_pipe.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 // running since under the current scheme it wouldn't have a remote ID | 96 // running since under the current scheme it wouldn't have a remote ID |
97 // yet.] | 97 // yet.] |
98 // - Note that even if the local side is closed, it may still receive a | 98 // - Note that even if the local side is closed, it may still receive a |
99 // "remove" message from the other side (if the other side is closed | 99 // "remove" message from the other side (if the other side is closed |
100 // simultaneously, and both sides send "remove" messages). In that | 100 // simultaneously, and both sides send "remove" messages). In that |
101 // case, it must still remain alive until it receives the "remove | 101 // case, it must still remain alive until it receives the "remove |
102 // ack" (and it must ack the "remove" message that it received). | 102 // ack" (and it must ack the "remove" message that it received). |
103 class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpoint | 103 class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpoint |
104 : public base::RefCountedThreadSafe<ChannelEndpoint> { | 104 : public base::RefCountedThreadSafe<ChannelEndpoint> { |
105 public: | 105 public: |
106 ChannelEndpoint(MessagePipe* message_pipe, unsigned port); | 106 ChannelEndpoint(const scoped_refptr<MessagePipe>& message_pipe, |
vtl
2014/09/05 05:41:51
Why? The original form is fine, and avoids the ext
dcheng
2014/09/05 06:01:26
It's documentation. There's already been some disc
| |
107 unsigned port); | |
107 | 108 |
108 private: | 109 private: |
109 enum State { | 110 enum State { |
110 // Attached, possibly running or not. | 111 // Attached, possibly running or not. |
111 STATE_NORMAL, | 112 STATE_NORMAL, |
112 // "Zombie" states: | 113 // "Zombie" states: |
113 // Waiting for |DetachMessagePipeEndpoint()| before removing. | 114 // Waiting for |DetachMessagePipeEndpoint()| before removing. |
114 STATE_WAIT_LOCAL_DETACH, | 115 STATE_WAIT_LOCAL_DETACH, |
115 // Waiting for a |kSubtypeChannelRemoveMessagePipeEndpointAck| before | 116 // Waiting for a |kSubtypeChannelRemoveMessagePipeEndpointAck| before |
116 // removing. | 117 // removing. |
(...skipping 11 matching lines...) Expand all Loading... | |
128 scoped_refptr<MessagePipe> message_pipe_; | 129 scoped_refptr<MessagePipe> message_pipe_; |
129 unsigned port_; | 130 unsigned port_; |
130 | 131 |
131 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); | 132 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); |
132 }; | 133 }; |
133 | 134 |
134 } // namespace system | 135 } // namespace system |
135 } // namespace mojo | 136 } // namespace mojo |
136 | 137 |
137 #endif // MOJO_SYSTEM_CHANNEL_ENDPOINT_H_ | 138 #endif // MOJO_SYSTEM_CHANNEL_ENDPOINT_H_ |
OLD | NEW |