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

Side by Side Diff: base/file_util_proxy.h

Issue 8424006: Bind: Merge FileUtilProxy and FileSystemFileUtilProxy: CreateOrOpen/Close (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | base/file_util_proxy.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 BASE_FILE_UTIL_PROXY_H_ 5 #ifndef BASE_FILE_UTIL_PROXY_H_
6 #define BASE_FILE_UTIL_PROXY_H_ 6 #define BASE_FILE_UTIL_PROXY_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 14 matching lines...) Expand all
25 public: 25 public:
26 // Holds metadata for file or directory entry. 26 // Holds metadata for file or directory entry.
27 struct Entry { 27 struct Entry {
28 FilePath::StringType name; 28 FilePath::StringType name;
29 bool is_directory; 29 bool is_directory;
30 int64 size; 30 int64 size;
31 base::Time last_modified_time; 31 base::Time last_modified_time;
32 }; 32 };
33 33
34 // This callback is used by methods that report only an error code. It is 34 // This callback is used by methods that report only an error code. It is
35 // valid to pass StatusCallback() to any function that takes a StatusCallback, 35 // valid to pass a null callback to any function that takes a StatusCallback,
36 // in which case the operation will complete silently. 36 // in which case the operation will complete silently.
37 typedef Callback<void(PlatformFileError)> StatusCallback; 37 typedef Callback<void(PlatformFileError)> StatusCallback;
38 38
39 typedef Callback<void(PlatformFileError, 39 typedef Callback<void(PlatformFileError,
40 PassPlatformFile, 40 PassPlatformFile,
41 bool /* created */)> CreateOrOpenCallback; 41 bool /* created */)> CreateOrOpenCallback;
42 typedef Callback<void(PlatformFileError, 42 typedef Callback<void(PlatformFileError,
43 PassPlatformFile, 43 PassPlatformFile,
44 FilePath)> CreateTemporaryCallback; 44 FilePath)> CreateTemporaryCallback;
45 typedef Callback<void(PlatformFileError, 45 typedef Callback<void(PlatformFileError,
46 const PlatformFileInfo& 46 const PlatformFileInfo&
47 )> GetFileInfoCallback; 47 )> GetFileInfoCallback;
48 typedef Callback<void(PlatformFileError, 48 typedef Callback<void(PlatformFileError,
49 const char* /* data */, 49 const char* /* data */,
50 int /* bytes read */)> ReadCallback; 50 int /* bytes read */)> ReadCallback;
51 typedef Callback<void(PlatformFileError, 51 typedef Callback<void(PlatformFileError,
52 int /* bytes written */)> WriteCallback; 52 int /* bytes written */)> WriteCallback;
53 53
54 typedef Callback<PlatformFileError(PlatformFile*, bool*)> CreateOrOpenTask;
55 typedef Callback<PlatformFileError(PlatformFile)> CloseTask;
56
54 // Creates or opens a file with the given flags. It is invalid to pass a null 57 // Creates or opens a file with the given flags. It is invalid to pass a null
55 // callback. If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to 58 // callback. If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to
56 // create a new file at the given |file_path| and calls back with 59 // create a new file at the given |file_path| and calls back with
57 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. 60 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists.
58 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy, 61 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy,
59 const FilePath& file_path, 62 const FilePath& file_path,
60 int file_flags, 63 int file_flags,
61 const CreateOrOpenCallback& callback); 64 const CreateOrOpenCallback& callback);
62 65
63 // Creates a temporary file for writing. The path and an open file handle are 66 // Creates a temporary file for writing. The path and an open file handle are
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 const FilePath& path, 160 const FilePath& path,
158 int64 length, 161 int64 length,
159 const StatusCallback& callback); 162 const StatusCallback& callback);
160 163
161 // Flushes a file. The callback can be null. 164 // Flushes a file. The callback can be null.
162 static bool Flush( 165 static bool Flush(
163 scoped_refptr<MessageLoopProxy> message_loop_proxy, 166 scoped_refptr<MessageLoopProxy> message_loop_proxy,
164 PlatformFile file, 167 PlatformFile file,
165 const StatusCallback& callback); 168 const StatusCallback& callback);
166 169
170 // Relay helpers.
171 static bool RelayCreateOrOpen(
172 scoped_refptr<MessageLoopProxy> message_loop_proxy,
173 const CreateOrOpenTask& open_task,
174 const CloseTask& close_task,
175 const CreateOrOpenCallback& callback);
176
177 static bool RelayClose(
178 scoped_refptr<MessageLoopProxy> message_loop_proxy,
179 const CloseTask& close_task,
180 PlatformFile,
181 const StatusCallback& callback);
182
167 private: 183 private:
168 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); 184 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy);
169 }; 185 };
170 186
171 } // namespace base 187 } // namespace base
172 188
173 #endif // BASE_FILE_UTIL_PROXY_H_ 189 #endif // BASE_FILE_UTIL_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | base/file_util_proxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698