| 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 data pipes. | 5 // This file contains types/constants and functions specific to data 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_DATA_PIPE_H_ | 9 #ifndef MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ |
| 10 #define MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ | 10 #define MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #define MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE \ | 34 #define MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE \ |
| 35 ((MojoCreateDataPipeOptionsFlags)0) | 35 ((MojoCreateDataPipeOptionsFlags)0) |
| 36 | 36 |
| 37 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"); |
| 38 struct MOJO_ALIGNAS(8) MojoCreateDataPipeOptions { | 38 struct MOJO_ALIGNAS(8) MojoCreateDataPipeOptions { |
| 39 uint32_t struct_size; | 39 uint32_t struct_size; |
| 40 MojoCreateDataPipeOptionsFlags flags; | 40 MojoCreateDataPipeOptionsFlags flags; |
| 41 uint32_t element_num_bytes; | 41 uint32_t element_num_bytes; |
| 42 uint32_t capacity_num_bytes; | 42 uint32_t capacity_num_bytes; |
| 43 }; | 43 }; |
| 44 MOJO_STATIC_ASSERT(sizeof(MojoCreateDataPipeOptions) == 16, | 44 MOJO_STATIC_ASSERT(sizeof(struct MojoCreateDataPipeOptions) == 16, |
| 45 "MojoCreateDataPipeOptions has wrong size"); | 45 "MojoCreateDataPipeOptions has wrong size"); |
| 46 | 46 |
| 47 // |MojoDataPipeProducerOptions|: Used to specify data pipe producer options (to | 47 // |MojoDataPipeProducerOptions|: Used to specify data pipe producer options (to |
| 48 // |MojoSetDataPipeProducerOptions()| and from | 48 // |MojoSetDataPipeProducerOptions()| and from |
| 49 // |MojoGetDataPipeProducerOptions()|). | 49 // |MojoGetDataPipeProducerOptions()|). |
| 50 // |uint32_t struct_size|: Set to the size of the | 50 // |uint32_t struct_size|: Set to the size of the |
| 51 // |MojoDataPipeProducerOptions| struct. (Used to allow for future | 51 // |MojoDataPipeProducerOptions| struct. (Used to allow for future |
| 52 // extensions.) | 52 // extensions.) |
| 53 // |uint32_t write_threshold_num_bytes|: Set to the minimum amount of space | 53 // |uint32_t write_threshold_num_bytes|: Set to the minimum amount of space |
| 54 // required to be available, in number of bytes, for the handle to be | 54 // required to be available, in number of bytes, for the handle to be |
| 55 // signaled with |MOJO_HANDLE_SIGNAL_WRITE_THRESHOLD|; must be a multiple | 55 // signaled with |MOJO_HANDLE_SIGNAL_WRITE_THRESHOLD|; must be a multiple |
| 56 // of the data pipe's element size. Set to zero to opt for the default, | 56 // of the data pipe's element size. Set to zero to opt for the default, |
| 57 // which is the size of a single element. | 57 // which is the size of a single element. |
| 58 | 58 |
| 59 struct MOJO_ALIGNAS(8) MojoDataPipeProducerOptions { | 59 struct MOJO_ALIGNAS(8) MojoDataPipeProducerOptions { |
| 60 uint32_t struct_size; | 60 uint32_t struct_size; |
| 61 uint32_t write_threshold_num_bytes; | 61 uint32_t write_threshold_num_bytes; |
| 62 }; | 62 }; |
| 63 MOJO_STATIC_ASSERT(sizeof(MojoDataPipeProducerOptions) == 8, | 63 MOJO_STATIC_ASSERT(sizeof(struct MojoDataPipeProducerOptions) == 8, |
| 64 "MojoDataPipeProducerOptions has wrong size"); | 64 "MojoDataPipeProducerOptions has wrong size"); |
| 65 | 65 |
| 66 // |MojoWriteDataFlags|: Used to specify different modes to |MojoWriteData()| | 66 // |MojoWriteDataFlags|: Used to specify different modes to |MojoWriteData()| |
| 67 // and |MojoBeginWriteData()|. | 67 // and |MojoBeginWriteData()|. |
| 68 // |MOJO_WRITE_DATA_FLAG_NONE| - No flags; default mode. | 68 // |MOJO_WRITE_DATA_FLAG_NONE| - No flags; default mode. |
| 69 // |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| - Write either all the elements | 69 // |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| - Write either all the elements |
| 70 // requested or none of them. | 70 // requested or none of them. |
| 71 | 71 |
| 72 typedef uint32_t MojoWriteDataFlags; | 72 typedef uint32_t MojoWriteDataFlags; |
| 73 | 73 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 // closed with less than this amount of data in the data pipe, the | 88 // closed with less than this amount of data in the data pipe, the |
| 89 // consumer's |MOJO_HANDLE_SIGNAL_READ_THRESHOLD| will be considered | 89 // consumer's |MOJO_HANDLE_SIGNAL_READ_THRESHOLD| will be considered |
| 90 // unsatisfiable; if there is actually some data remaining in the data | 90 // unsatisfiable; if there is actually some data remaining in the data |
| 91 // pipe, the status of this signal may be changed if this value is | 91 // pipe, the status of this signal may be changed if this value is |
| 92 // modified. | 92 // modified. |
| 93 | 93 |
| 94 struct MOJO_ALIGNAS(8) MojoDataPipeConsumerOptions { | 94 struct MOJO_ALIGNAS(8) MojoDataPipeConsumerOptions { |
| 95 uint32_t struct_size; | 95 uint32_t struct_size; |
| 96 uint32_t read_threshold_num_bytes; | 96 uint32_t read_threshold_num_bytes; |
| 97 }; | 97 }; |
| 98 MOJO_STATIC_ASSERT(sizeof(MojoDataPipeConsumerOptions) == 8, | 98 MOJO_STATIC_ASSERT(sizeof(struct MojoDataPipeConsumerOptions) == 8, |
| 99 "MojoDataPipeConsumerOptions has wrong size"); | 99 "MojoDataPipeConsumerOptions has wrong size"); |
| 100 | 100 |
| 101 // |MojoReadDataFlags|: Used to specify different modes to |MojoReadData()| and | 101 // |MojoReadDataFlags|: Used to specify different modes to |MojoReadData()| and |
| 102 // |MojoBeginReadData()|. | 102 // |MojoBeginReadData()|. |
| 103 // |MOJO_READ_DATA_FLAG_NONE| - No flags; default mode. | 103 // |MOJO_READ_DATA_FLAG_NONE| - No flags; default mode. |
| 104 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| - Read (or discard) either the requested | 104 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| - Read (or discard) either the requested |
| 105 // number of elements or none. | 105 // number of elements or none. |
| 106 // |MOJO_READ_DATA_FLAG_DISCARD| - Discard (up to) the requested number of | 106 // |MOJO_READ_DATA_FLAG_DISCARD| - Discard (up to) the requested number of |
| 107 // elements. | 107 // elements. |
| 108 // |MOJO_READ_DATA_FLAG_QUERY| - Query the number of elements available to | 108 // |MOJO_READ_DATA_FLAG_QUERY| - Query the number of elements available to |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 // |MojoEndReadData()| has already been called). | 502 // |MojoEndReadData()| has already been called). |
| 503 // |MOJO_RESULT_BUSY| if |data_pipe_consumer_handle| is currently in use in | 503 // |MOJO_RESULT_BUSY| if |data_pipe_consumer_handle| is currently in use in |
| 504 // some transaction (that, e.g., may result in it being invalidated, such | 504 // some transaction (that, e.g., may result in it being invalidated, such |
| 505 // as being sent in a message). | 505 // as being sent in a message). |
| 506 MojoResult MojoEndReadData(MojoHandle data_pipe_consumer_handle, // In. | 506 MojoResult MojoEndReadData(MojoHandle data_pipe_consumer_handle, // In. |
| 507 uint32_t num_bytes_read); // In. | 507 uint32_t num_bytes_read); // In. |
| 508 | 508 |
| 509 MOJO_END_EXTERN_C | 509 MOJO_END_EXTERN_C |
| 510 | 510 |
| 511 #endif // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ | 511 #endif // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ |
| OLD | NEW |