| OLD | NEW |
| 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 Loading... |
| 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 ALWAYS closed. Any unread messages at C will eventually |
| 193 // be delivered to A, and any unread messages at B will eventually be delivered |
| 194 // to D. |
| 195 // |
| 196 // NOTE: A handle may only be fused if it is an open message pipe handle which |
| 197 // has not been 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 // |MOJO_INVALID_ARGUMENT| if either handle is not a fusable message pipe |
| 204 // handle. |
| 205 MOJO_SYSTEM_EXPORT MojoResult |
| 206 MojoFuseMessagePipes(MojoHandle handle0, MojoHandle handle1); |
| 207 |
| 208 |
| 184 #ifdef __cplusplus | 209 #ifdef __cplusplus |
| 185 } // extern "C" | 210 } // extern "C" |
| 186 #endif | 211 #endif |
| 187 | 212 |
| 188 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ | 213 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ |
| OLD | NEW |