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

Unified Diff: mojo/public/c/system/message_pipe.h

Issue 1785843002: [mojo] Implement pipe fusion API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
Index: mojo/public/c/system/message_pipe.h
diff --git a/mojo/public/c/system/message_pipe.h b/mojo/public/c/system/message_pipe.h
index 10da5256740546f076dd42d29b871b4a2924e1d7..01435f1b09d6232002f03f464440628a443d4c04 100644
--- a/mojo/public/c/system/message_pipe.h
+++ b/mojo/public/c/system/message_pipe.h
@@ -181,6 +181,32 @@ MOJO_SYSTEM_EXPORT MojoResult
uint32_t* num_handles, // Optional in/out.
MojoReadMessageFlags flags);
+// Fuses two message pipe endpoints together. Given two pipes:
+//
+// A <-> B and C <-> D
+//
+// Fusing handle B and handle C results in a single pipe:
+//
+// A <-> D
+//
+// Handles B and C are closed. Any unread messages at C will eventually be
+// delivered to A, and any unread messages at B will eventually be delivered to
+// D.
+//
+// NOTE: A handle may only be fused as long as it is open and has not been
+// written to.
+//
+// Returns:
+// |MOJO_RESULT_OK| on success.
+// |MOJO_RESULT_FAILED_PRECONDITION| if both handles were valid message pipe
+// handles but could not be merged (e.g. one of them has been written to).
+// In this case the pipes are not fused and both handles are closed.
+// |MOJO_INVALID_ARGUMENT| if either handle is not a fusable message pipe
+// handle. In this case both handles remain unaffected.
yzshen1 2016/03/10 23:49:03 Is it easier if we always close the handles? That
Ken Rockot(use gerrit already) 2016/03/11 00:32:46 SGTM - I considered both and didn't feel strongly
+MOJO_SYSTEM_EXPORT MojoResult
+ MojoFuseMessagePipes(MojoHandle handle0, MojoHandle handle1);
+
+
#ifdef __cplusplus
} // extern "C"
#endif

Powered by Google App Engine
This is Rietveld 408576698