Index: third_party/mojo/src/mojo/edk/system/incoming_endpoint.cc |
diff --git a/third_party/mojo/src/mojo/edk/system/incoming_endpoint.cc b/third_party/mojo/src/mojo/edk/system/incoming_endpoint.cc |
index 14f1a71816287e0a4e41dacece0838aac099b036..cd091b1d2e2fee09a49157593a6ff4ce1279cf2c 100644 |
--- a/third_party/mojo/src/mojo/edk/system/incoming_endpoint.cc |
+++ b/third_party/mojo/src/mojo/edk/system/incoming_endpoint.cc |
@@ -6,8 +6,10 @@ |
#include "base/logging.h" |
#include "mojo/edk/system/channel_endpoint.h" |
+#include "mojo/edk/system/data_pipe.h" |
#include "mojo/edk/system/message_in_transit.h" |
#include "mojo/edk/system/message_pipe.h" |
+#include "mojo/edk/system/remote_producer_data_pipe_impl.h" |
namespace mojo { |
namespace system { |
@@ -30,6 +32,27 @@ scoped_refptr<MessagePipe> IncomingEndpoint::ConvertToMessagePipe() { |
return message_pipe; |
} |
+scoped_refptr<DataPipe> IncomingEndpoint::ConvertToDataPipeProducer( |
+ const MojoCreateDataPipeOptions& validated_options, |
+ size_t consumer_num_bytes) { |
+ base::AutoLock locker(lock_); |
+ scoped_refptr<DataPipe> data_pipe(DataPipe::CreateRemoteConsumerFromExisting( |
+ validated_options, consumer_num_bytes, &message_queue_, endpoint_.get())); |
+ DCHECK(message_queue_.IsEmpty()); |
+ endpoint_ = nullptr; |
+ return data_pipe; |
+} |
+ |
+scoped_refptr<DataPipe> IncomingEndpoint::ConvertToDataPipeConsumer( |
+ const MojoCreateDataPipeOptions& validated_options) { |
+ base::AutoLock locker(lock_); |
+ scoped_refptr<DataPipe> data_pipe(DataPipe::CreateRemoteProducerFromExisting( |
+ validated_options, &message_queue_, endpoint_.get())); |
+ DCHECK(message_queue_.IsEmpty()); |
+ endpoint_ = nullptr; |
+ return data_pipe; |
+} |
+ |
void IncomingEndpoint::Close() { |
base::AutoLock locker(lock_); |
if (endpoint_) { |