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 and constants/macros common to different Mojo system | 5 // This file contains types and constants/macros common to different Mojo system |
6 // APIs. | 6 // APIs. |
7 // | 7 // |
8 // Note: This header should be compilable as C. | 8 // Note: This header should be compilable as C. |
9 | 9 |
10 #ifndef MOJO_PUBLIC_C_SYSTEM_TYPES_H_ | 10 #ifndef MOJO_PUBLIC_C_SYSTEM_TYPES_H_ |
11 #define MOJO_PUBLIC_C_SYSTEM_TYPES_H_ | 11 #define MOJO_PUBLIC_C_SYSTEM_TYPES_H_ |
12 | 12 |
13 #include <stdint.h> | 13 #include <stdint.h> |
14 | 14 |
| 15 #include "mojo/public/c/system/macros.h" |
| 16 |
15 // TODO(vtl): Notes: Use of undefined flags will lead to undefined behavior | 17 // TODO(vtl): Notes: Use of undefined flags will lead to undefined behavior |
16 // (typically they'll be ignored), not necessarily an error. | 18 // (typically they'll be ignored), not necessarily an error. |
17 | 19 |
18 // |MojoTimeTicks|: Used to specify time ticks. Value is in microseconds. | 20 // |MojoTimeTicks|: Used to specify time ticks. Value is in microseconds. |
19 | 21 |
20 typedef int64_t MojoTimeTicks; | 22 typedef int64_t MojoTimeTicks; |
21 | 23 |
22 // |MojoHandle|: Handles to Mojo objects. | 24 // |MojoHandle|: Handles to Mojo objects. |
23 // |MOJO_HANDLE_INVALID| - A value that is never a valid handle. | 25 // |MOJO_HANDLE_INVALID| - A value that is never a valid handle. |
24 | 26 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 const MojoWaitFlags MOJO_WAIT_FLAG_READABLE = 1 << 0; | 157 const MojoWaitFlags MOJO_WAIT_FLAG_READABLE = 1 << 0; |
156 const MojoWaitFlags MOJO_WAIT_FLAG_WRITABLE = 1 << 1; | 158 const MojoWaitFlags MOJO_WAIT_FLAG_WRITABLE = 1 << 1; |
157 const MojoWaitFlags MOJO_WAIT_FLAG_EVERYTHING = ~0; | 159 const MojoWaitFlags MOJO_WAIT_FLAG_EVERYTHING = ~0; |
158 #else | 160 #else |
159 #define MOJO_WAIT_FLAG_NONE ((MojoWaitFlags) 0) | 161 #define MOJO_WAIT_FLAG_NONE ((MojoWaitFlags) 0) |
160 #define MOJO_WAIT_FLAG_READABLE ((MojoWaitFlags) 1 << 0) | 162 #define MOJO_WAIT_FLAG_READABLE ((MojoWaitFlags) 1 << 0) |
161 #define MOJO_WAIT_FLAG_WRITABLE ((MojoWaitFlags) 1 << 1) | 163 #define MOJO_WAIT_FLAG_WRITABLE ((MojoWaitFlags) 1 << 1) |
162 #define MOJO_WAIT_FLAG_EVERYTHING (~((MojoWaitFlags) 0)) | 164 #define MOJO_WAIT_FLAG_EVERYTHING (~((MojoWaitFlags) 0)) |
163 #endif | 165 #endif |
164 | 166 |
| 167 // TODO(vtl): Add out parameters with this to MojoWait/MojoWaitMany. |
| 168 // Note: This struct is not extensible (and only has 32-bit quantities), so it's |
| 169 // 32-bit-aligned. |
| 170 MOJO_COMPILE_ASSERT(MOJO_ALIGNOF(int32_t) == 4, int32_t_has_weird_alignment); |
| 171 struct MOJO_ALIGNAS(4) MojoWaitFlagsState { |
| 172 MojoWaitFlags satisfied_flags; |
| 173 MojoWaitFlags satisfiable_flags; |
| 174 }; |
| 175 MOJO_COMPILE_ASSERT(sizeof(MojoWaitFlagsState) == 8, |
| 176 MojoWaitFlagsState_has_wrong_size); |
| 177 |
165 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_ | 178 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_ |
OLD | NEW |