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

Unified Diff: mojo/edk/system/message_pipe_dispatcher.h

Issue 1554623005: Ensure that in-flight message pipes are always closed and the other end is notified. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix dcheck of lock being acquired at destruction Created 5 years 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/edk/system/message_in_transit.h ('k') | mojo/edk/system/message_pipe_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/message_pipe_dispatcher.h
diff --git a/mojo/edk/system/message_pipe_dispatcher.h b/mojo/edk/system/message_pipe_dispatcher.h
index 9acbaf9bc07f828f1efa994dd8763e479fc2a61a..a49a45d6abd26658ea79a910377434996f723172 100644
--- a/mojo/edk/system/message_pipe_dispatcher.h
+++ b/mojo/edk/system/message_pipe_dispatcher.h
@@ -93,6 +93,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MessagePipeDispatcher final
~MessagePipeDispatcher() override;
void InitOnIO();
+ void CloseOnIOAndRelease();
void CloseOnIO();
// |Dispatcher| protected methods:
@@ -171,11 +172,21 @@ class MOJO_SYSTEM_IMPL_EXPORT MessagePipeDispatcher final
// get a RawChannel.
uint64_t pipe_id_;
enum NonTransferableState {
+ // The pipe_id hasn't been bound to this object yet until it's read,
+ // written, or waited on.
WAITING_FOR_READ_OR_WRITE,
+ // This object was interacted with, so the pipe_id has been bound and we are
+ // waiting for the broker to connect both sides.
CONNECT_CALLED,
+ // We have a connection to the other end of the message pipe.
CONNECTED,
+ // This object has been closed before it's connected. To ensure that the
+ // other end receives a closed message from this end, we've initiated
+ // connecting and will close after it succeeds.
WAITING_FOR_CONNECT_TO_CLOSE,
+ // The message pipe is closed.
CLOSED,
+ // The message pipe has been transferred.
SERIALISED,
};
@@ -198,6 +209,10 @@ class MOJO_SYSTEM_IMPL_EXPORT MessagePipeDispatcher final
bool write_error_;
// Whether it can be sent after read or write.
bool transferable_;
+ // When this object is closed, it has to wait to flush any pending messages
+ // from the other side to ensure that any in-queue message pipes are closed.
+ // If this is true, we have already sent the other side the request.
+ bool close_requested_;
MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher);
};
« no previous file with comments | « mojo/edk/system/message_in_transit.h ('k') | mojo/edk/system/message_pipe_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698