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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 // |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set, then the output value | 180 // |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set, then the output value |
181 // |*buffer_num_bytes| will be at least as large as its input value, which must | 181 // |*buffer_num_bytes| will be at least as large as its input value, which must |
182 // also be a multiple of the element size (if |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| | 182 // also be a multiple of the element size (if |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| |
183 // is not set, the input value of |*buffer_num_bytes| is ignored). | 183 // is not set, the input value of |*buffer_num_bytes| is ignored). |
184 // | 184 // |
185 // During a two-phase write, |data_pipe_producer_handle| is *not* writable. | 185 // During a two-phase write, |data_pipe_producer_handle| is *not* writable. |
186 // E.g., if another thread tries to write to it, it will get |MOJO_RESULT_BUSY|; | 186 // E.g., if another thread tries to write to it, it will get |MOJO_RESULT_BUSY|; |
187 // that thread can then wait for |data_pipe_producer_handle| to become writable | 187 // that thread can then wait for |data_pipe_producer_handle| to become writable |
188 // again. | 188 // again. |
189 // | 189 // |
190 // Once the caller has finished writing data to |*buffer|, it should call | 190 // When |MojoBeginWriteData)_| returtns MOJO_RESULT_OK, and the caller has |
yzshen1
2014/10/10 21:18:59
nit: MojoBeginWriteData)_ -> MojoBeginWriteData()
| |
191 // |MojoEndWriteData()| to specify the amount written and to complete the | 191 // finished writing data to |*buffer|, it should call |MojoEndWriteData()| to |
192 // two-phase write. | 192 // specify the amount written and to complete the two-phase write. |
193 // |MojoEndWriteData()| need not be called for other return values. | |
yzshen1
2014/10/10 21:18:59
need->needs
brettw
2014/10/10 22:36:59
It seems correct to me.
| |
193 // | 194 // |
194 // Note: If the data pipe has the "may discard" option flag (specified on | 195 // Note: If the data pipe has the "may discard" option flag (specified on |
195 // creation) and |flags| has |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set, this may | 196 // creation) and |flags| has |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set, this may |
196 // discard some data. | 197 // discard some data. |
197 // | 198 // |
198 // Returns: | 199 // Returns: |
199 // |MOJO_RESULT_OK| on success. | 200 // |MOJO_RESULT_OK| on success. |
200 // |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g., | 201 // |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g., |
201 // |data_pipe_producer_handle| is not a handle to a data pipe producer or | 202 // |data_pipe_producer_handle| is not a handle to a data pipe producer or |
202 // flags has |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set and | 203 // flags has |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set and |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 // |MojoEndReadData()| has already been called). | 356 // |MojoEndReadData()| has already been called). |
356 MOJO_SYSTEM_EXPORT MojoResult | 357 MOJO_SYSTEM_EXPORT MojoResult |
357 MojoEndReadData(MojoHandle data_pipe_consumer_handle, | 358 MojoEndReadData(MojoHandle data_pipe_consumer_handle, |
358 uint32_t num_bytes_read); | 359 uint32_t num_bytes_read); |
359 | 360 |
360 #ifdef __cplusplus | 361 #ifdef __cplusplus |
361 } // extern "C" | 362 } // extern "C" |
362 #endif | 363 #endif |
363 | 364 |
364 #endif // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ | 365 #endif // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ |
OLD | NEW |