| 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 #ifndef MOJO_SHELL_DATA_PIPE_UTILS_H_ | 5 #ifndef MOJO_SHELL_DATA_PIPE_UTILS_H_ |
| 6 #define MOJO_SHELL_DATA_PIPE_UTILS_H_ | 6 #define MOJO_SHELL_DATA_PIPE_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // Asynchronously copies data from source to the destination file. The given | 23 // Asynchronously copies data from source to the destination file. The given |
| 24 // |callback| is run upon completion. File writes will be scheduled to the | 24 // |callback| is run upon completion. File writes will be scheduled to the |
| 25 // given |task_runner|. | 25 // given |task_runner|. |
| 26 void MOJO_COMMON_EXPORT CopyToFile( | 26 void MOJO_COMMON_EXPORT CopyToFile( |
| 27 ScopedDataPipeConsumerHandle source, | 27 ScopedDataPipeConsumerHandle source, |
| 28 const base::FilePath& destination, | 28 const base::FilePath& destination, |
| 29 base::TaskRunner* task_runner, | 29 base::TaskRunner* task_runner, |
| 30 const base::Callback<void(bool /*success*/)>& callback); | 30 const base::Callback<void(bool /*success*/)>& callback); |
| 31 | 31 |
| 32 void MOJO_COMMON_EXPORT |
| 33 CopyFromFile(const base::FilePath& source, |
| 34 ScopedDataPipeProducerHandle destination, |
| 35 uint32_t skip, |
| 36 base::TaskRunner* task_runner, |
| 37 const base::Callback<void(bool /*success*/)>& callback); |
| 38 |
| 32 // Copies the data from |source| into |contents| and returns true on success and | 39 // Copies the data from |source| into |contents| and returns true on success and |
| 33 // false on error. In case of I/O error, |contents| holds the data that could | 40 // false on error. In case of I/O error, |contents| holds the data that could |
| 34 // be read from source before the error occurred. | 41 // be read from source before the error occurred. |
| 35 bool MOJO_COMMON_EXPORT BlockingCopyToString( | 42 bool MOJO_COMMON_EXPORT BlockingCopyToString( |
| 36 ScopedDataPipeConsumerHandle source, | 43 ScopedDataPipeConsumerHandle source, |
| 37 std::string* contents); | 44 std::string* contents); |
| 38 | 45 |
| 39 } // namespace common | 46 } // namespace common |
| 40 } // namespace mojo | 47 } // namespace mojo |
| 41 | 48 |
| 42 #endif // MOJO_SHELL_DATA_PIPE_UTILS_H_ | 49 #endif // MOJO_SHELL_DATA_PIPE_UTILS_H_ |
| OLD | NEW |