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 <stdint.h> | 12 #include <stdint.h> |
13 | 13 |
14 #include "mojo/public/c/system/macros.h" | 14 #include "mojo/public/c/system/macros.h" |
15 #include "mojo/public/c/system/system_export.h" | 15 #include "mojo/public/c/system/system_export.h" |
16 #include "mojo/public/c/system/types.h" | 16 #include "mojo/public/c/system/types.h" |
17 | 17 |
18 // |MojoCreateMessagePipeOptions|: Used to specify creation parameters for a | 18 // |MojoCreateMessagePipeOptions|: Used to specify creation parameters for a |
19 // message pipe to |MojoCreateMessagePipe()|. | 19 // message pipe to |MojoCreateMessagePipe()|. |
20 // |uint32_t struct_size|: Set to the size of the | 20 // |uint32_t struct_size|: Set to the size of the |
21 // |MojoCreateMessagePipeOptions| struct. (Used to allow for future | 21 // |MojoCreateMessagePipeOptions| struct. (Used to allow for future |
22 // extensions.) | 22 // extensions.) |
23 // |MojoCreateMessagePipeOptionsFlags flags|: Used to specify different modes | 23 // |MojoCreateMessagePipeOptionsFlags flags|: Used to specify different modes |
24 // of operation. | 24 // of operation. |
25 // |MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE|: No flags; default mode. | 25 // |MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE|: No flags; default mode. |
26 // |MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE|: The message pipe | |
27 // can be sent over another pipe after it's been read, written or | |
28 // waited. This mode makes message pipes use more resources (one OS | |
29 // pipe each), so only specify if this functionality is required. | |
30 | 26 |
31 typedef uint32_t MojoCreateMessagePipeOptionsFlags; | 27 typedef uint32_t MojoCreateMessagePipeOptionsFlags; |
32 | 28 |
33 #ifdef __cplusplus | 29 #ifdef __cplusplus |
34 const MojoCreateMessagePipeOptionsFlags | 30 const MojoCreateMessagePipeOptionsFlags |
35 MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE = 0; | 31 MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE = 0; |
36 const MojoCreateMessagePipeOptionsFlags | |
37 MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE = 1; | |
38 #else | 32 #else |
39 #define MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE \ | 33 #define MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE \ |
40 ((MojoCreateMessagePipeOptionsFlags)0) | 34 ((MojoCreateMessagePipeOptionsFlags)0) |
41 #define MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE \ | |
42 ((MojoCreateMessagePipeOptionsFlags)1) | |
43 #endif | 35 #endif |
44 | 36 |
45 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int64_t) == 8, "int64_t has weird alignment"); | 37 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int64_t) == 8, "int64_t has weird alignment"); |
46 struct MOJO_ALIGNAS(8) MojoCreateMessagePipeOptions { | 38 struct MOJO_ALIGNAS(8) MojoCreateMessagePipeOptions { |
47 uint32_t struct_size; | 39 uint32_t struct_size; |
48 MojoCreateMessagePipeOptionsFlags flags; | 40 MojoCreateMessagePipeOptionsFlags flags; |
49 }; | 41 }; |
50 MOJO_STATIC_ASSERT(sizeof(MojoCreateMessagePipeOptions) == 8, | 42 MOJO_STATIC_ASSERT(sizeof(MojoCreateMessagePipeOptions) == 8, |
51 "MojoCreateMessagePipeOptions has wrong size"); | 43 "MojoCreateMessagePipeOptions has wrong size"); |
52 | 44 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // handle. | 196 // handle. |
205 MOJO_SYSTEM_EXPORT MojoResult | 197 MOJO_SYSTEM_EXPORT MojoResult |
206 MojoFuseMessagePipes(MojoHandle handle0, MojoHandle handle1); | 198 MojoFuseMessagePipes(MojoHandle handle0, MojoHandle handle1); |
207 | 199 |
208 | 200 |
209 #ifdef __cplusplus | 201 #ifdef __cplusplus |
210 } // extern "C" | 202 } // extern "C" |
211 #endif | 203 #endif |
212 | 204 |
213 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ | 205 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ |
OLD | NEW |