Index: mojo/common/data_pipe_utils.h |
diff --git a/mojo/common/data_pipe_utils.h b/mojo/common/data_pipe_utils.h |
index dc2f66a005955cf8f1a0c58d6b4352004dc93193..dc2197b6e07fd14a7d1f08ec4da610e852367a5c 100644 |
--- a/mojo/common/data_pipe_utils.h |
+++ b/mojo/common/data_pipe_utils.h |
@@ -5,6 +5,8 @@ |
#ifndef MOJO_SHELL_DATA_PIPE_UTILS_H_ |
#define MOJO_SHELL_DATA_PIPE_UTILS_H_ |
+#include <string> |
+ |
#include "base/callback_forward.h" |
#include "mojo/common/mojo_common_export.h" |
#include "mojo/public/cpp/system/core.h" |
@@ -26,6 +28,13 @@ void MOJO_COMMON_EXPORT CopyToFile( |
base::TaskRunner* task_runner, |
const base::Callback<void(bool /*success*/)>& callback); |
+// Copies the data from |source| into |contents| and returns true on success and |
+// false on error. In case of I/O error, |contents| holds the data that could |
+// be read from source before the error occurred. |
+bool MOJO_COMMON_EXPORT BlockingCopyToString( |
+ ScopedDataPipeConsumerHandle source, |
+ std::string* contents); |
+ |
} // namespace common |
} // namespace mojo |