| 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 #ifndef MOJO_PUBLIC_C_SYSTEM_CORE_H_ | 5 #ifndef MOJO_PUBLIC_C_SYSTEM_CORE_H_ |
| 6 #define MOJO_PUBLIC_C_SYSTEM_CORE_H_ | 6 #define MOJO_PUBLIC_C_SYSTEM_CORE_H_ |
| 7 | 7 |
| 8 // Note: This header should be compilable as C. | 8 // Note: This header should be compilable as C. |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 #define MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD \ | 229 #define MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD \ |
| 230 ((MojoCreateDataPipeOptionsFlags) 1 << 0) | 230 ((MojoCreateDataPipeOptionsFlags) 1 << 0) |
| 231 #endif | 231 #endif |
| 232 | 232 |
| 233 struct MojoCreateDataPipeOptions { | 233 struct MojoCreateDataPipeOptions { |
| 234 uint32_t struct_size; | 234 uint32_t struct_size; |
| 235 MojoCreateDataPipeOptionsFlags flags; | 235 MojoCreateDataPipeOptionsFlags flags; |
| 236 uint32_t element_num_bytes; | 236 uint32_t element_num_bytes; |
| 237 uint32_t capacity_num_bytes; | 237 uint32_t capacity_num_bytes; |
| 238 }; | 238 }; |
| 239 // TODO(vtl): Can we make this assertion work in C? | |
| 240 #ifdef __cplusplus | |
| 241 MOJO_COMPILE_ASSERT(sizeof(MojoCreateDataPipeOptions) == 16, | 239 MOJO_COMPILE_ASSERT(sizeof(MojoCreateDataPipeOptions) == 16, |
| 242 MojoCreateDataPipeOptions_has_wrong_size); | 240 MojoCreateDataPipeOptions_has_wrong_size); |
| 243 #endif | |
| 244 | 241 |
| 245 // |MojoWriteDataFlags|: Used to specify different modes to |MojoWriteData()| | 242 // |MojoWriteDataFlags|: Used to specify different modes to |MojoWriteData()| |
| 246 // and |MojoBeginWriteData()|. | 243 // and |MojoBeginWriteData()|. |
| 247 // |MOJO_WRITE_DATA_FLAG_NONE| - No flags; default mode. | 244 // |MOJO_WRITE_DATA_FLAG_NONE| - No flags; default mode. |
| 248 // |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| - Write either all the elements | 245 // |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| - Write either all the elements |
| 249 // requested or none of them. | 246 // requested or none of them. |
| 250 | 247 |
| 251 typedef uint32_t MojoWriteDataFlags; | 248 typedef uint32_t MojoWriteDataFlags; |
| 252 | 249 |
| 253 #ifdef __cplusplus | 250 #ifdef __cplusplus |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE = 0; | 302 MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE = 0; |
| 306 #else | 303 #else |
| 307 #define MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE \ | 304 #define MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE \ |
| 308 ((MojoCreateSharedBufferOptionsFlags) 0) | 305 ((MojoCreateSharedBufferOptionsFlags) 0) |
| 309 #endif | 306 #endif |
| 310 | 307 |
| 311 struct MojoCreateSharedBufferOptions { | 308 struct MojoCreateSharedBufferOptions { |
| 312 uint32_t struct_size; | 309 uint32_t struct_size; |
| 313 MojoCreateSharedBufferOptionsFlags flags; | 310 MojoCreateSharedBufferOptionsFlags flags; |
| 314 }; | 311 }; |
| 315 // TODO(vtl): Can we make this assertion work in C? | |
| 316 #ifdef __cplusplus | |
| 317 MOJO_COMPILE_ASSERT(sizeof(MojoCreateSharedBufferOptions) == 8, | 312 MOJO_COMPILE_ASSERT(sizeof(MojoCreateSharedBufferOptions) == 8, |
| 318 MojoCreateSharedBufferOptions_has_wrong_size); | 313 MojoCreateSharedBufferOptions_has_wrong_size); |
| 319 #endif | |
| 320 | 314 |
| 321 // |MojoDuplicateBufferHandleOptions|: Used to specify parameters in duplicating | 315 // |MojoDuplicateBufferHandleOptions|: Used to specify parameters in duplicating |
| 322 // access to a shared buffer to |MojoDuplicateBufferHandle()|. | 316 // access to a shared buffer to |MojoDuplicateBufferHandle()|. |
| 323 // |uint32_t struct_size|: Set to the size of the | 317 // |uint32_t struct_size|: Set to the size of the |
| 324 // |MojoDuplicateBufferHandleOptions| struct. (Used to allow for future | 318 // |MojoDuplicateBufferHandleOptions| struct. (Used to allow for future |
| 325 // extensions.) | 319 // extensions.) |
| 326 // |MojoDuplicateBufferHandleOptionsFlags flags|: Reserved for future use. | 320 // |MojoDuplicateBufferHandleOptionsFlags flags|: Reserved for future use. |
| 327 // |MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE|: No flags; default | 321 // |MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE|: No flags; default |
| 328 // mode. | 322 // mode. |
| 329 // | 323 // |
| 330 // TODO(vtl): Add flags to remove writability (and executability)? Also, COW? | 324 // TODO(vtl): Add flags to remove writability (and executability)? Also, COW? |
| 331 | 325 |
| 332 typedef uint32_t MojoDuplicateBufferHandleOptionsFlags; | 326 typedef uint32_t MojoDuplicateBufferHandleOptionsFlags; |
| 333 | 327 |
| 334 #ifdef __cplusplus | 328 #ifdef __cplusplus |
| 335 const MojoDuplicateBufferHandleOptionsFlags | 329 const MojoDuplicateBufferHandleOptionsFlags |
| 336 MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE = 0; | 330 MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE = 0; |
| 337 #else | 331 #else |
| 338 #define MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE \ | 332 #define MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE \ |
| 339 ((MojoDuplicateBufferHandleOptionsFlags) 0) | 333 ((MojoDuplicateBufferHandleOptionsFlags) 0) |
| 340 #endif | 334 #endif |
| 341 | 335 |
| 342 struct MojoDuplicateBufferHandleOptions { | 336 struct MojoDuplicateBufferHandleOptions { |
| 343 uint32_t struct_size; | 337 uint32_t struct_size; |
| 344 MojoDuplicateBufferHandleOptionsFlags flags; | 338 MojoDuplicateBufferHandleOptionsFlags flags; |
| 345 }; | 339 }; |
| 346 // TODO(vtl): Can we make this assertion work in C? | |
| 347 #ifdef __cplusplus | |
| 348 MOJO_COMPILE_ASSERT(sizeof(MojoDuplicateBufferHandleOptions) == 8, | 340 MOJO_COMPILE_ASSERT(sizeof(MojoDuplicateBufferHandleOptions) == 8, |
| 349 MojoDuplicateBufferHandleOptions_has_wrong_size); | 341 MojoDuplicateBufferHandleOptions_has_wrong_size); |
| 350 #endif | |
| 351 | 342 |
| 352 // |MojoMapBufferFlags|: Used to specify different modes to |MojoMapBuffer()|. | 343 // |MojoMapBufferFlags|: Used to specify different modes to |MojoMapBuffer()|. |
| 353 // |MOJO_MAP_BUFFER_FLAG_NONE| - No flags; default mode. | 344 // |MOJO_MAP_BUFFER_FLAG_NONE| - No flags; default mode. |
| 354 | 345 |
| 355 typedef uint32_t MojoMapBufferFlags; | 346 typedef uint32_t MojoMapBufferFlags; |
| 356 | 347 |
| 357 #ifdef __cplusplus | 348 #ifdef __cplusplus |
| 358 const MojoMapBufferFlags MOJO_MAP_BUFFER_FLAG_NONE = 0; | 349 const MojoMapBufferFlags MOJO_MAP_BUFFER_FLAG_NONE = 0; |
| 359 #else | 350 #else |
| 360 #define MOJO_MAP_BUFFER_FLAG_NONE ((MojoMapBufferFlags) 0) | 351 #define MOJO_MAP_BUFFER_FLAG_NONE ((MojoMapBufferFlags) 0) |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 | 811 |
| 821 // Unmap a buffer pointer that was mapped by |MojoMapBuffer()|. | 812 // Unmap a buffer pointer that was mapped by |MojoMapBuffer()|. |
| 822 // TODO(vtl): More. | 813 // TODO(vtl): More. |
| 823 MOJO_SYSTEM_EXPORT MojoResult MojoUnmapBuffer(void* buffer); // In. | 814 MOJO_SYSTEM_EXPORT MojoResult MojoUnmapBuffer(void* buffer); // In. |
| 824 | 815 |
| 825 #ifdef __cplusplus | 816 #ifdef __cplusplus |
| 826 } // extern "C" | 817 } // extern "C" |
| 827 #endif | 818 #endif |
| 828 | 819 |
| 829 #endif // MOJO_PUBLIC_C_SYSTEM_CORE_H_ | 820 #endif // MOJO_PUBLIC_C_SYSTEM_CORE_H_ |
| OLD | NEW |