| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 STATE_WAIT_REMOTE_REMOVE_ACK, | 149 STATE_WAIT_REMOTE_REMOVE_ACK, |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 // TODO(vtl): This is totally temporary, until this becomes a proper | 152 // TODO(vtl): This is totally temporary, until this becomes a proper |
| 153 // self-contained class. See the plan above. | 153 // self-contained class. See the plan above. |
| 154 friend class Channel; | 154 friend class Channel; |
| 155 | 155 |
| 156 friend class base::RefCountedThreadSafe<ChannelEndpoint>; | 156 friend class base::RefCountedThreadSafe<ChannelEndpoint>; |
| 157 ~ChannelEndpoint(); | 157 ~ChannelEndpoint(); |
| 158 | 158 |
| 159 // Must be called with |lock_| held. |
| 160 bool WriteMessageNoLock(scoped_ptr<MessageInTransit> message); |
| 161 |
| 162 // TODO(vtl): Move these under lock. |
| 159 State state_; | 163 State state_; |
| 160 // TODO(vtl): When moved under lock, this can/should be made a raw pointer. | 164 // TODO(vtl): When moved under lock, this can/should be made a raw pointer. |
| 161 scoped_refptr<MessagePipe> message_pipe_; | 165 scoped_refptr<MessagePipe> message_pipe_; |
| 162 unsigned port_; | 166 unsigned port_; |
| 163 | 167 |
| 164 // TODO(vtl): Move the things above under lock. | 168 // TODO(vtl): Move the things above under lock. |
| 165 // Protects the members below. | 169 // Protects the members below. |
| 166 base::Lock lock_; | 170 base::Lock lock_; |
| 167 | 171 |
| 168 // |channel_| must be alive whenever this is non-null. Before the |channel_| | 172 // |channel_| must be alive whenever this is non-null. Before the |channel_| |
| 169 // gives up its reference to this object, it will call |DetachFromChannel()|. | 173 // gives up its reference to this object, it will call |DetachFromChannel()|. |
| 170 Channel* channel_; | 174 Channel* channel_; |
| 171 MessageInTransit::EndpointId local_id_; | 175 MessageInTransit::EndpointId local_id_; |
| 172 MessageInTransit::EndpointId remote_id_; | 176 MessageInTransit::EndpointId remote_id_; |
| 173 | 177 |
| 174 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); | 178 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); |
| 175 }; | 179 }; |
| 176 | 180 |
| 177 } // namespace system | 181 } // namespace system |
| 178 } // namespace mojo | 182 } // namespace mojo |
| 179 | 183 |
| 180 #endif // MOJO_SYSTEM_CHANNEL_ENDPOINT_H_ | 184 #endif // MOJO_SYSTEM_CHANNEL_ENDPOINT_H_ |
| OLD | NEW |