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

Unified Diff: mojo/system/message_pipe.cc

Issue 612183002: Mojo: Remove MessagePipe::OnRemove(); instead just use MessagePipe::Close(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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/message_pipe.h ('k') | mojo/system/message_pipe_endpoint.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
}
« no previous file with comments | « mojo/system/message_pipe.h ('k') | mojo/system/message_pipe_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698