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 #include "mojo/edk/system/channel_endpoint.h" | 5 #include "mojo/edk/system/channel_endpoint.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "mojo/edk/platform/thread_utils.h" | 10 #include "mojo/edk/platform/thread_utils.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 bool ChannelEndpoint::WriteMessageNoLock( | 158 bool ChannelEndpoint::WriteMessageNoLock( |
159 std::unique_ptr<MessageInTransit> message) { | 159 std::unique_ptr<MessageInTransit> message) { |
160 DCHECK(message); | 160 DCHECK(message); |
161 | 161 |
162 mutex_.AssertHeld(); | 162 mutex_.AssertHeld(); |
163 | 163 |
164 DCHECK(channel_); | 164 DCHECK(channel_); |
165 DCHECK(local_id_.is_valid()); | 165 DCHECK(local_id_.is_valid()); |
166 DCHECK(remote_id_.is_valid()); | 166 DCHECK(remote_id_.is_valid()); |
167 | 167 |
168 message->SerializeAndCloseDispatchers(channel_); | 168 message->SerializeAndCloseHandles(channel_); |
169 message->set_source_id(local_id_); | 169 message->set_source_id(local_id_); |
170 message->set_destination_id(remote_id_); | 170 message->set_destination_id(remote_id_); |
171 return channel_->WriteMessage(std::move(message)); | 171 return channel_->WriteMessage(std::move(message)); |
172 } | 172 } |
173 | 173 |
174 void ChannelEndpoint::OnReadMessageForClient( | 174 void ChannelEndpoint::OnReadMessageForClient( |
175 std::unique_ptr<MessageInTransit> message) { | 175 std::unique_ptr<MessageInTransit> message) { |
176 DCHECK_EQ(message->type(), MessageInTransit::Type::ENDPOINT_CLIENT); | 176 DCHECK_EQ(message->type(), MessageInTransit::Type::ENDPOINT_CLIENT); |
177 | 177 |
178 RefPtr<ChannelEndpointClient> client; | 178 RefPtr<ChannelEndpointClient> client; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 DCHECK(remote_id_.is_valid()); | 223 DCHECK(remote_id_.is_valid()); |
224 | 224 |
225 state_ = State::DEAD; | 225 state_ = State::DEAD; |
226 channel_ = nullptr; | 226 channel_ = nullptr; |
227 local_id_ = ChannelEndpointId(); | 227 local_id_ = ChannelEndpointId(); |
228 remote_id_ = ChannelEndpointId(); | 228 remote_id_ = ChannelEndpointId(); |
229 } | 229 } |
230 | 230 |
231 } // namespace system | 231 } // namespace system |
232 } // namespace mojo | 232 } // namespace mojo |
OLD | NEW |