| Index: mojo/system/proxy_message_pipe_endpoint.cc
|
| diff --git a/mojo/system/proxy_message_pipe_endpoint.cc b/mojo/system/proxy_message_pipe_endpoint.cc
|
| index a14fa965b136a6e6ae68a2a1bc4e1b3cc6f02f5a..935955caaacd0062c4016abd2b4c03bc0036259c 100644
|
| --- a/mojo/system/proxy_message_pipe_endpoint.cc
|
| +++ b/mojo/system/proxy_message_pipe_endpoint.cc
|
| @@ -20,7 +20,7 @@ ProxyMessagePipeEndpoint::ProxyMessagePipeEndpoint(
|
| }
|
|
|
| ProxyMessagePipeEndpoint::~ProxyMessagePipeEndpoint() {
|
| - channel_endpoint_->DetachFromMessagePipe();
|
| + DCHECK(!channel_endpoint_.get());
|
| }
|
|
|
| MessagePipeEndpoint::Type ProxyMessagePipeEndpoint::GetType() const {
|
| @@ -28,6 +28,7 @@ MessagePipeEndpoint::Type ProxyMessagePipeEndpoint::GetType() const {
|
| }
|
|
|
| bool ProxyMessagePipeEndpoint::OnPeerClose() {
|
| + DetachIfNecessary();
|
| return false;
|
| }
|
|
|
| @@ -41,5 +42,16 @@ void ProxyMessagePipeEndpoint::EnqueueMessage(
|
| << "Failed to write enqueue message to channel";
|
| }
|
|
|
| +void ProxyMessagePipeEndpoint::Close() {
|
| + DetachIfNecessary();
|
| +}
|
| +
|
| +void ProxyMessagePipeEndpoint::DetachIfNecessary() {
|
| + if (channel_endpoint_.get()) {
|
| + channel_endpoint_->DetachFromMessagePipe();
|
| + channel_endpoint_ = nullptr;
|
| + }
|
| +}
|
| +
|
| } // namespace system
|
| } // namespace mojo
|
|
|