Index: mojo/system/message_pipe.cc |
diff --git a/mojo/system/message_pipe.cc b/mojo/system/message_pipe.cc |
index d12e303c916d0396d2763bda3a9e9731d0076870..17cb5c07b844c41e0b9e1f8e9def975940c0f71a 100644 |
--- a/mojo/system/message_pipe.cc |
+++ b/mojo/system/message_pipe.cc |
@@ -75,7 +75,10 @@ void MessagePipe::Close(unsigned port) { |
unsigned destination_port = GetPeerPort(port); |
base::AutoLock locker(lock_); |
- DCHECK(endpoints_[port]); |
+ // The endpoint's |OnPeerClose()| may have been called first and returned |
+ // false, which would have resulted in its destruction. |
+ if (!endpoints_[port]) |
+ return; |
endpoints_[port]->Close(); |
if (endpoints_[destination_port]) { |
@@ -184,21 +187,6 @@ MojoResult MessagePipe::EnqueueMessage(unsigned port, |
return EnqueueMessageInternal(port, message.Pass(), nullptr); |
} |
-void MessagePipe::OnRemove(unsigned port) { |
- unsigned destination_port = GetPeerPort(port); |
- |
- base::AutoLock locker(lock_); |
- // A |OnPeerClose()| can come in first, before |OnRemove()| gets called. |
- if (!endpoints_[port]) |
- return; |
- |
- if (endpoints_[destination_port]) { |
- if (!endpoints_[destination_port]->OnPeerClose()) |
- endpoints_[destination_port].reset(); |
- } |
- endpoints_[port].reset(); |
-} |
- |
MessagePipe::MessagePipe() { |
} |