Index: mojo/edk/system/message_pipe_dispatcher.cc |
diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc |
index 005b0948e740a0dd356c34fcb2fe44e922e9d09a..a0d5d02b62dead1c22f9ad19f8ae2f4b4dcf6aeb 100644 |
--- a/mojo/edk/system/message_pipe_dispatcher.cc |
+++ b/mojo/edk/system/message_pipe_dispatcher.cc |
@@ -133,9 +133,22 @@ void MessagePipeDispatcher::CloseImplNoLock() { |
} |
RefPtr<Dispatcher> |
-MessagePipeDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() { |
+MessagePipeDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock( |
+ MessagePipe* message_pipe, |
+ unsigned port) { |
mutex().AssertHeld(); |
+ // "We" are being sent over our peer. |
+ if (message_pipe == message_pipe_.get()) { |
+ // A message pipe dispatcher can't be sent over itself (this should be |
+ // disallowed by |Core|). Note that |port| is the destination port. |
+ DCHECK_EQ(port, port_); |
+ // In this case, |message_pipe_|'s mutex should already be held! |
+ message_pipe_->CancelAllAwakablesNoLock(port_); |
+ } else { |
+ CancelAllAwakablesNoLock(); |
+ } |
+ |
// TODO(vtl): Currently, there are no options, so we just use |
// |kDefaultCreateOptions|. Eventually, we'll have to duplicate the options |
// too. |
@@ -220,14 +233,5 @@ bool MessagePipeDispatcher::EndSerializeAndCloseImplNoLock( |
return rv; |
} |
-// MessagePipeDispatcherTransport ---------------------------------------------- |
- |
-MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( |
- DispatcherTransport transport) |
- : DispatcherTransport(transport) { |
- DCHECK_EQ(message_pipe_dispatcher()->GetType(), |
- Dispatcher::Type::MESSAGE_PIPE); |
-} |
- |
} // namespace system |
} // namespace mojo |