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_ |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Note: This struct is not extensible (and only has 32-bit quantities), so it's | 182 // Note: This struct is not extensible (and only has 32-bit quantities), so it's |
183 // 32-bit-aligned. | 183 // 32-bit-aligned. |
184 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int32_t) == 4, "int32_t has weird alignment"); | 184 MOJO_STATIC_ASSERT(MOJO_ALIGNOF(int32_t) == 4, "int32_t has weird alignment"); |
185 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { | 185 struct MOJO_ALIGNAS(4) MojoHandleSignalsState { |
186 MojoHandleSignals satisfied_signals; | 186 MojoHandleSignals satisfied_signals; |
187 MojoHandleSignals satisfiable_signals; | 187 MojoHandleSignals satisfiable_signals; |
188 }; | 188 }; |
189 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, | 189 MOJO_STATIC_ASSERT(sizeof(MojoHandleSignalsState) == 8, |
190 "MojoHandleSignalsState has wrong size"); | 190 "MojoHandleSignalsState has wrong size"); |
191 | 191 |
192 // |MojoWatcherNotificationFlags|: Passed to a callback invoked by a watcher | 192 // |MojoWatchNotificationFlags|: Passed to a callback invoked as a result of |
193 // when some observed signals are raised or a watched handle is closed. May take | 193 // signals being raised on a handle watched by |MojoWatch()|. May take the |
194 // on any combination of the following values: | 194 // following values: |
195 // | 195 // |MOJO_WATCH_NOTIFICATION_FLAG_FROM_SYSTEM| - The callback is being invoked |
196 // |MOJO_WATCHER_NOTIFICATION_FLAG_FROM_SYSTEM| - The callback is being | 196 // as a result of a system-level event rather than a direct API call from |
197 // invoked as a result of a system-level event rather than a direct API | 197 // user code. This may be used as an indication that user code is safe to |
198 // call from user code. This may be used as an indication that user code | 198 // call without fear of reentry. |
199 // is safe to call without fear of reentry. | |
200 | 199 |
201 typedef uint32_t MojoWatcherNotificationFlags; | 200 typedef uint32_t MojoWatchNotificationFlags; |
202 | 201 |
203 #ifdef __cplusplus | 202 #ifdef __cplusplus |
204 const MojoWatcherNotificationFlags MOJO_WATCHER_NOTIFICATION_FLAG_NONE = 0; | 203 const MojoWatchNotificationFlags MOJO_WATCH_NOTIFICATION_FLAG_NONE = 0; |
205 const MojoWatcherNotificationFlags MOJO_WATCHER_NOTIFICATION_FLAG_FROM_SYSTEM = | 204 const MojoWatchNotificationFlags MOJO_WATCH_NOTIFICATION_FLAG_FROM_SYSTEM = |
206 1 << 0; | 205 1 << 0; |
207 #else | 206 #else |
208 #define MOJO_WATCHER_NOTIFICATION_FLAG_NONE ((MojoWatcherNotificationFlags)0) | 207 #define MOJO_WATCH_NOTIFICATION_FLAG_NONE ((MojoWatchNotificationFlags)0) |
209 #define MOJO_WATCHER_NOTIFICATION_FLAG_FROM_SYSTEM \ | 208 #define MOJO_WATCH_NOTIFICATION_FLAG_FROM_SYSTEM \ |
210 ((MojoWatcherNotificationFlags)1 << 0); | 209 ((MojoWatchNotificationFlags)1 << 0); |
211 #endif | 210 #endif |
212 | 211 |
213 // |MojoPropertyType|: Property types that can be passed to |MojoGetProperty()| | 212 // |MojoPropertyType|: Property types that can be passed to |MojoGetProperty()| |
214 // to retrieve system properties. May take the following values: | 213 // to retrieve system properties. May take the following values: |
215 // |MOJO_PROPERTY_TYPE_SYNC_CALL_ALLOWED| - Whether making synchronous calls | 214 // |MOJO_PROPERTY_TYPE_SYNC_CALL_ALLOWED| - Whether making synchronous calls |
216 // (i.e., blocking to wait for a response to an outbound message) is | 215 // (i.e., blocking to wait for a response to an outbound message) is |
217 // allowed. The property value is of boolean type. If the value is true, | 216 // allowed. The property value is of boolean type. If the value is true, |
218 // users should refrain from making sync calls. | 217 // users should refrain from making sync calls. |
219 typedef uint32_t MojoPropertyType; | 218 typedef uint32_t MojoPropertyType; |
220 | 219 |
221 #ifdef __cplusplus | 220 #ifdef __cplusplus |
222 const MojoPropertyType MOJO_PROPERTY_TYPE_SYNC_CALL_ALLOWED = 0; | 221 const MojoPropertyType MOJO_PROPERTY_TYPE_SYNC_CALL_ALLOWED = 0; |
223 #else | 222 #else |
224 #define MOJO_PROPERTY_TYPE_SYNC_CALL_ALLOWED ((MojoPropertyType)0) | 223 #define MOJO_PROPERTY_TYPE_SYNC_CALL_ALLOWED ((MojoPropertyType)0) |
225 #endif | 224 #endif |
226 | 225 |
227 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_ | 226 #endif // MOJO_PUBLIC_C_SYSTEM_TYPES_H_ |
OLD | NEW |