Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: mojo/common/data_pipe_utils.h

Issue 2608173002: Remove unused parts of //mojo/common. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/common/data_pipe_file_utils.cc ('k') | mojo/common/data_pipe_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_COMMON_DATA_PIPE_UTILS_H_
6 #define MOJO_SHELL_DATA_PIPE_UTILS_H_ 6 #define MOJO_COMMON_DATA_PIPE_UTILS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/callback_forward.h"
13 #include "mojo/common/mojo_common_export.h" 12 #include "mojo/common/mojo_common_export.h"
14 #include "mojo/public/cpp/system/core.h" 13 #include "mojo/public/cpp/system/data_pipe.h"
15
16 namespace base {
17 class FilePath;
18 class TaskRunner;
19 }
20 14
21 namespace mojo { 15 namespace mojo {
22 namespace common { 16 namespace common {
23 17
24 // Asynchronously copies data from source to the destination file. The given
25 // |callback| is run upon completion. File writes will be scheduled to the
26 // given |task_runner|.
27 void MOJO_COMMON_EXPORT CopyToFile(
28 ScopedDataPipeConsumerHandle source,
29 const base::FilePath& destination,
30 base::TaskRunner* task_runner,
31 const base::Callback<void(bool /*success*/)>& callback);
32
33 void MOJO_COMMON_EXPORT
34 CopyFromFile(const base::FilePath& source,
35 ScopedDataPipeProducerHandle destination,
36 uint32_t skip,
37 base::TaskRunner* task_runner,
38 const base::Callback<void(bool /*success*/)>& callback);
39
40 // Copies the data from |source| into |contents| and returns true on success and 18 // Copies the data from |source| into |contents| and returns true on success and
41 // false on error. In case of I/O error, |contents| holds the data that could 19 // false on error. In case of I/O error, |contents| holds the data that could
42 // be read from source before the error occurred. 20 // be read from source before the error occurred.
43 bool MOJO_COMMON_EXPORT BlockingCopyToString( 21 bool MOJO_COMMON_EXPORT BlockingCopyToString(
44 ScopedDataPipeConsumerHandle source, 22 ScopedDataPipeConsumerHandle source,
45 std::string* contents); 23 std::string* contents);
46 24
47 bool MOJO_COMMON_EXPORT BlockingCopyFromString( 25 bool MOJO_COMMON_EXPORT BlockingCopyFromString(
48 const std::string& source, 26 const std::string& source,
49 const ScopedDataPipeProducerHandle& destination); 27 const ScopedDataPipeProducerHandle& destination);
50 28
51 // Synchronously copies data from source to the destination file returning true
52 // on success and false on error. In case of an error, |destination| holds the
53 // data that could be read from the source before the error occured.
54 bool MOJO_COMMON_EXPORT BlockingCopyToFile(ScopedDataPipeConsumerHandle source,
55 const base::FilePath& destination);
56
57 } // namespace common 29 } // namespace common
58 } // namespace mojo 30 } // namespace mojo
59 31
60 #endif // MOJO_SHELL_DATA_PIPE_UTILS_H_ 32 #endif // MOJO_COMMON_DATA_PIPE_UTILS_H_
OLDNEW
« no previous file with comments | « mojo/common/data_pipe_file_utils.cc ('k') | mojo/common/data_pipe_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698