Index: mojo/public/cpp/system/data_pipe.h |
diff --git a/mojo/public/cpp/system/data_pipe.h b/mojo/public/cpp/system/data_pipe.h |
index 0dbc3c74e5e62c1d01f48ba68947726d66e899f9..9f58c27c3300a3b28098b876123ed3b33c576ad2 100644 |
--- a/mojo/public/cpp/system/data_pipe.h |
+++ b/mojo/public/cpp/system/data_pipe.h |
@@ -134,6 +134,7 @@ inline MojoResult EndReadDataRaw(DataPipeConsumerHandle data_pipe_consumer, |
class DataPipe { |
public: |
DataPipe(); |
+ explicit DataPipe(uint32_t capacity_num_bytes); |
explicit DataPipe(const MojoCreateDataPipeOptions& options); |
~DataPipe(); |
@@ -148,6 +149,19 @@ inline DataPipe::DataPipe() { |
DCHECK_EQ(MOJO_RESULT_OK, result); |
} |
+inline DataPipe::DataPipe(uint32_t capacity_num_bytes) { |
+ MojoCreateDataPipeOptions options; |
+ options.struct_size = sizeof(MojoCreateDataPipeOptions); |
+ options.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE; |
+ options.element_num_bytes = 1; |
+ options.capacity_num_bytes = capacity_num_bytes; |
+ mojo::DataPipe data_pipe(options); |
+ MojoResult result = |
+ CreateDataPipe(&options, &producer_handle, &consumer_handle); |
+ ALLOW_UNUSED_LOCAL(result); |
+ DCHECK_EQ(MOJO_RESULT_OK, result); |
+} |
+ |
inline DataPipe::DataPipe(const MojoCreateDataPipeOptions& options) { |
MojoResult result = |
CreateDataPipe(&options, &producer_handle, &consumer_handle); |