Index: third_party/mojo/src/mojo/public/cpp/system/data_pipe.h |
diff --git a/third_party/mojo/src/mojo/public/cpp/system/data_pipe.h b/third_party/mojo/src/mojo/public/cpp/system/data_pipe.h |
index 5d3396c035f942a1a69ae75c9d06d9d6a5e526bc..c451cffc75982cd882110ff5ae887a29087830fe 100644 |
--- a/third_party/mojo/src/mojo/public/cpp/system/data_pipe.h |
+++ b/third_party/mojo/src/mojo/public/cpp/system/data_pipe.h |
@@ -2,6 +2,13 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+// This file provides a C++ wrapping around the Mojo C API for data pipes, |
+// replacing the prefix of "Mojo" with a "mojo" namespace, and using more |
+// strongly-typed representations of |MojoHandle|s. |
+// |
+// Please see "mojo/public/c/system/data_pipe.h" for complete documentation of |
+// the API. |
+ |
#ifndef MOJO_PUBLIC_CPP_SYSTEM_DATA_PIPE_H_ |
#define MOJO_PUBLIC_CPP_SYSTEM_DATA_PIPE_H_ |
@@ -13,8 +20,8 @@ |
namespace mojo { |
-// DataPipeProducerHandle and DataPipeConsumerHandle --------------------------- |
- |
+// A strongly-typed representation of a |MojoHandle| to the producer end of a |
+// data pipe. |
class DataPipeProducerHandle : public Handle { |
public: |
DataPipeProducerHandle() {} |
@@ -31,6 +38,8 @@ static_assert(sizeof(ScopedDataPipeProducerHandle) == |
sizeof(DataPipeProducerHandle), |
"Bad size for C++ ScopedDataPipeProducerHandle"); |
+// A strongly-typed representation of a |MojoHandle| to the consumer end of a |
+// data pipe. |
class DataPipeConsumerHandle : public Handle { |
public: |
DataPipeConsumerHandle() {} |
@@ -47,6 +56,8 @@ static_assert(sizeof(ScopedDataPipeConsumerHandle) == |
sizeof(DataPipeConsumerHandle), |
"Bad size for C++ ScopedDataPipeConsumerHandle"); |
+// Creates a new data pipe. See |MojoCreateDataPipe()| for complete |
+// documentation. |
inline MojoResult CreateDataPipe( |
const MojoCreateDataPipeOptions* options, |
ScopedDataPipeProducerHandle* data_pipe_producer, |
@@ -65,6 +76,7 @@ inline MojoResult CreateDataPipe( |
return rv; |
} |
+// Writes to a data pipe. See |MojoWriteData| for complete documentation. |
inline MojoResult WriteDataRaw(DataPipeProducerHandle data_pipe_producer, |
const void* elements, |
uint32_t* num_bytes, |
@@ -72,6 +84,8 @@ inline MojoResult WriteDataRaw(DataPipeProducerHandle data_pipe_producer, |
return MojoWriteData(data_pipe_producer.value(), elements, num_bytes, flags); |
} |
+// Begins a two-phase write to a data pipe. See |MojoBeginWriteData()| for |
+// complete documentation. |
inline MojoResult BeginWriteDataRaw(DataPipeProducerHandle data_pipe_producer, |
void** buffer, |
uint32_t* buffer_num_bytes, |
@@ -80,11 +94,14 @@ inline MojoResult BeginWriteDataRaw(DataPipeProducerHandle data_pipe_producer, |
data_pipe_producer.value(), buffer, buffer_num_bytes, flags); |
} |
+// Completes a two-phase write to a data pipe. See |MojoEndWriteData()| for |
+// complete documentation. |
inline MojoResult EndWriteDataRaw(DataPipeProducerHandle data_pipe_producer, |
uint32_t num_bytes_written) { |
return MojoEndWriteData(data_pipe_producer.value(), num_bytes_written); |
} |
+// Reads from a data pipe. See |MojoReadData()| for complete documentation. |
inline MojoResult ReadDataRaw(DataPipeConsumerHandle data_pipe_consumer, |
void* elements, |
uint32_t* num_bytes, |
@@ -92,6 +109,8 @@ inline MojoResult ReadDataRaw(DataPipeConsumerHandle data_pipe_consumer, |
return MojoReadData(data_pipe_consumer.value(), elements, num_bytes, flags); |
} |
+// Begins a two-phase read from a data pipe. See |MojoBeginReadData()| for |
+// complete documentation. |
inline MojoResult BeginReadDataRaw(DataPipeConsumerHandle data_pipe_consumer, |
const void** buffer, |
uint32_t* buffer_num_bytes, |
@@ -100,6 +119,8 @@ inline MojoResult BeginReadDataRaw(DataPipeConsumerHandle data_pipe_consumer, |
data_pipe_consumer.value(), buffer, buffer_num_bytes, flags); |
} |
+// Completes a two-phase read from a data pipe. See |MojoEndReadData()| for |
+// complete documentation. |
inline MojoResult EndReadDataRaw(DataPipeConsumerHandle data_pipe_consumer, |
uint32_t num_bytes_read) { |
return MojoEndReadData(data_pipe_consumer.value(), num_bytes_read); |