Chromium Code Reviews| 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_ |
| 11 | 11 |
| 12 #include "mojo/public/c/system/macros.h" | 12 #include "mojo/public/c/system/macros.h" |
| 13 #include "mojo/public/c/system/system_export.h" | 13 #include "mojo/public/c/system/system_export.h" |
| 14 #include "mojo/public/c/system/types.h" | 14 #include "mojo/public/c/system/types.h" |
| 15 | 15 |
| 16 // |MojoCreateMessagePipeOptions|: Used to specify creation parameters for a | 16 // |MojoCreateMessagePipeOptions|: Used to specify creation parameters for a |
| 17 // message pipe to |MojoCreateMessagePipe()|. | 17 // message pipe to |MojoCreateMessagePipe()|. |
| 18 // |uint32_t struct_size|: Set to the size of the | 18 // |uint32_t struct_size|: Set to the size of the |
| 19 // |MojoCreateMessagePipeOptions| struct. (Used to allow for future | 19 // |MojoCreateMessagePipeOptions| struct. (Used to allow for future |
| 20 // extensions.) | 20 // extensions.) |
| 21 // |MojoCreateMessagePipeOptionsFlags flags|: Reserved for future use. | 21 // |MojoCreateMessagePipeOptionsFlags flags|: Used to specify different modes |
| 22 // of operation. | |
| 22 // |MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE|: No flags; default mode. | 23 // |MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE|: No flags; default mode. |
| 24 // |MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE|: The message pipe | |
| 25 // can be sent over another pipe after it's been read or written. This | |
|
yzshen1
2015/12/03 23:37:51
Is it "read, written or *waited*"?
jam
2015/12/04 05:06:47
Done.
| |
| 26 // mode makes message pipes use more resources (one OS pipe each), so | |
| 27 // only specify if this functionality is required. | |
| 23 | 28 |
| 24 typedef uint32_t MojoCreateMessagePipeOptionsFlags; | 29 typedef uint32_t MojoCreateMessagePipeOptionsFlags; |
| 25 | 30 |
| 26 #ifdef __cplusplus | 31 #ifdef __cplusplus |
| 27 const MojoCreateMessagePipeOptionsFlags | 32 const MojoCreateMessagePipeOptionsFlags |
| 28 MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE = 0; | 33 MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE = 0; |
| 34 const MojoCreateMessagePipeOptionsFlags | |
| 35 MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE = 1; | |
| 29 #else | 36 #else |
| 30 #define MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE \ | 37 #define MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE \ |
| 31 ((MojoCreateMessagePipeOptionsFlags)0) | 38 ((MojoCreateMessagePipeOptionsFlags)0) |
| 39 #define MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE \ | |
| 40 ((MojoCreateMessagePipeOptionsFlags)1) | |
| 32 #endif | 41 #endif |
| 33 | 42 |
| 34 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int64_t) == 8, "int64_t has weird alignment"); | 43 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int64_t) == 8, "int64_t has weird alignment"); |
| 35 struct MOJO_ALIGNAS(8) MojoCreateMessagePipeOptions { | 44 struct MOJO_ALIGNAS(8) MojoCreateMessagePipeOptions { |
| 36 uint32_t struct_size; | 45 uint32_t struct_size; |
| 37 MojoCreateMessagePipeOptionsFlags flags; | 46 MojoCreateMessagePipeOptionsFlags flags; |
| 38 }; | 47 }; |
| 39 MOJO_STATIC_ASSERT(sizeof(MojoCreateMessagePipeOptions) == 8, | 48 MOJO_STATIC_ASSERT(sizeof(MojoCreateMessagePipeOptions) == 8, |
| 40 "MojoCreateMessagePipeOptions has wrong size"); | 49 "MojoCreateMessagePipeOptions has wrong size"); |
| 41 | 50 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 uint32_t* num_bytes, // Optional in/out. | 177 uint32_t* num_bytes, // Optional in/out. |
| 169 MojoHandle* handles, // Optional out. | 178 MojoHandle* handles, // Optional out. |
| 170 uint32_t* num_handles, // Optional in/out. | 179 uint32_t* num_handles, // Optional in/out. |
| 171 MojoReadMessageFlags flags); | 180 MojoReadMessageFlags flags); |
| 172 | 181 |
| 173 #ifdef __cplusplus | 182 #ifdef __cplusplus |
| 174 } // extern "C" | 183 } // extern "C" |
| 175 #endif | 184 #endif |
| 176 | 185 |
| 177 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ | 186 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ |
| OLD | NEW |