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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file contains types/constants and functions specific to message pipes. 5 // This file contains types/constants and functions specific to message pipes.
6 // 6 //
7 // Note: This header should be compilable as C. 7 // Note: This header should be compilable as C.
8 8
9 #ifndef MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ 9 #ifndef MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_
10 #define MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ 10 #define MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // TODO(vtl): Reconsider the |MOJO_RESULT_RESOURCE_EXHAUSTED| error code; should 174 // TODO(vtl): Reconsider the |MOJO_RESULT_RESOURCE_EXHAUSTED| error code; should
175 // distinguish this from the hitting-system-limits case. 175 // distinguish this from the hitting-system-limits case.
176 MOJO_SYSTEM_EXPORT MojoResult 176 MOJO_SYSTEM_EXPORT MojoResult
177 MojoReadMessage(MojoHandle message_pipe_handle, 177 MojoReadMessage(MojoHandle message_pipe_handle,
178 void* bytes, // Optional out. 178 void* bytes, // Optional out.
179 uint32_t* num_bytes, // Optional in/out. 179 uint32_t* num_bytes, // Optional in/out.
180 MojoHandle* handles, // Optional out. 180 MojoHandle* handles, // Optional out.
181 uint32_t* num_handles, // Optional in/out. 181 uint32_t* num_handles, // Optional in/out.
182 MojoReadMessageFlags flags); 182 MojoReadMessageFlags flags);
183 183
184 // Fuses two message pipe endpoints together. Given two pipes:
185 //
186 // A <-> B and C <-> D
187 //
188 // Fusing handle B and handle C results in a single pipe:
189 //
190 // A <-> D
191 //
192 // Handles B and C are closed. Any unread messages at C will eventually be
193 // delivered to A, and any unread messages at B will eventually be delivered to
194 // D.
195 //
196 // NOTE: A handle may only be fused as long as it is open and has not been
197 // written to.
198 //
199 // Returns:
200 // |MOJO_RESULT_OK| on success.
201 // |MOJO_RESULT_FAILED_PRECONDITION| if both handles were valid message pipe
202 // handles but could not be merged (e.g. one of them has been written to).
203 // In this case the pipes are not fused and both handles are closed.
204 // |MOJO_INVALID_ARGUMENT| if either handle is not a fusable message pipe
205 // 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
206 MOJO_SYSTEM_EXPORT MojoResult
207 MojoFuseMessagePipes(MojoHandle handle0, MojoHandle handle1);
208
209
184 #ifdef __cplusplus 210 #ifdef __cplusplus
185 } // extern "C" 211 } // extern "C"
186 #endif 212 #endif
187 213
188 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ 214 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698