Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: mojo/system/proxy_message_pipe_endpoint.cc

Issue 619623003: Mojo: Don't do any work in ProxyMessagePipeEndpoint's destructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/system/proxy_message_pipe_endpoint.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « mojo/system/proxy_message_pipe_endpoint.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698