| 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 #include "mojo/system/message_pipe.h" | 5 #include "mojo/system/message_pipe.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/system/channel_endpoint.h" | 8 #include "mojo/system/channel_endpoint.h" |
| 9 #include "mojo/system/local_message_pipe_endpoint.h" | 9 #include "mojo/system/local_message_pipe_endpoint.h" |
| 10 #include "mojo/system/message_in_transit.h" | 10 #include "mojo/system/message_in_transit.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 185 } |
| 186 | 186 |
| 187 void MessagePipe::OnRemove(unsigned port) { | 187 void MessagePipe::OnRemove(unsigned port) { |
| 188 unsigned destination_port = GetPeerPort(port); | 188 unsigned destination_port = GetPeerPort(port); |
| 189 | 189 |
| 190 base::AutoLock locker(lock_); | 190 base::AutoLock locker(lock_); |
| 191 // A |OnPeerClose()| can come in first, before |OnRemove()| gets called. | 191 // A |OnPeerClose()| can come in first, before |OnRemove()| gets called. |
| 192 if (!endpoints_[port]) | 192 if (!endpoints_[port]) |
| 193 return; | 193 return; |
| 194 | 194 |
| 195 endpoints_[port]->OnRemove(); | |
| 196 if (endpoints_[destination_port]) { | 195 if (endpoints_[destination_port]) { |
| 197 if (!endpoints_[destination_port]->OnPeerClose()) | 196 if (!endpoints_[destination_port]->OnPeerClose()) |
| 198 endpoints_[destination_port].reset(); | 197 endpoints_[destination_port].reset(); |
| 199 } | 198 } |
| 200 endpoints_[port].reset(); | 199 endpoints_[port].reset(); |
| 201 } | 200 } |
| 202 | 201 |
| 203 MessagePipe::MessagePipe() { | 202 MessagePipe::MessagePipe() { |
| 204 } | 203 } |
| 205 | 204 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 MojoResult MessagePipe::HandleControlMessage( | 289 MojoResult MessagePipe::HandleControlMessage( |
| 291 unsigned /*port*/, | 290 unsigned /*port*/, |
| 292 scoped_ptr<MessageInTransit> message) { | 291 scoped_ptr<MessageInTransit> message) { |
| 293 LOG(WARNING) << "Unrecognized MessagePipe control message subtype " | 292 LOG(WARNING) << "Unrecognized MessagePipe control message subtype " |
| 294 << message->subtype(); | 293 << message->subtype(); |
| 295 return MOJO_RESULT_UNKNOWN; | 294 return MOJO_RESULT_UNKNOWN; |
| 296 } | 295 } |
| 297 | 296 |
| 298 } // namespace system | 297 } // namespace system |
| 299 } // namespace mojo | 298 } // namespace mojo |
| OLD | NEW |