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

Side by Side Diff: base/file_util_proxy.h

Issue 8321014: base::Bind: Convert FileUtilProxy::WriteCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fixes. Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_util_proxy.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 (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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 typedef base::Callback<void(PlatformFileError /* error code */, 48 typedef base::Callback<void(PlatformFileError /* error code */,
49 bool /* created */)> EnsureFileExistsCallback; 49 bool /* created */)> EnsureFileExistsCallback;
50 typedef base::Callback<void(PlatformFileError /* error code */, 50 typedef base::Callback<void(PlatformFileError /* error code */,
51 const PlatformFileInfo& /* file_info */)> 51 const PlatformFileInfo& /* file_info */)>
52 GetFileInfoCallback; 52 GetFileInfoCallback;
53 typedef base::Callback<void(PlatformFileError /* error code */, 53 typedef base::Callback<void(PlatformFileError /* error code */,
54 const std::vector<Entry>&)> ReadDirectoryCallback; 54 const std::vector<Entry>&)> ReadDirectoryCallback;
55 typedef base::Callback<void(PlatformFileError /* error code */, 55 typedef base::Callback<void(PlatformFileError /* error code */,
56 const char* /* data */, 56 const char* /* data */,
57 int /* bytes read/written */)> ReadCallback; 57 int /* bytes read/written */)> ReadCallback;
58 typedef Callback2<PlatformFileError /* error code */, 58 typedef base::Callback<void(PlatformFileError /* error code */,
59 int /* bytes written */>::Type WriteCallback; 59 int /* bytes written */)> WriteCallback;
60 60
61 // Creates or opens a file with the given flags. It is invalid to pass a null 61 // Creates or opens a file with the given flags. It is invalid to pass a null
62 // callback. If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to 62 // callback. If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to
63 // create a new file at the given |file_path| and calls back with 63 // create a new file at the given |file_path| and calls back with
64 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. Takes 64 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. Takes
65 // ownership of |callback| and will delete it even on failure. 65 // ownership of |callback| and will delete it even on failure.
66 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy, 66 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy,
67 const FilePath& file_path, 67 const FilePath& file_path,
68 int file_flags, 68 int file_flags,
69 const CreateOrOpenCallback& callback); 69 const CreateOrOpenCallback& callback);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // |offset + bytes_to_read| in the file. The callback can be null. 162 // |offset + bytes_to_read| in the file. The callback can be null.
163 static bool Read( 163 static bool Read(
164 scoped_refptr<MessageLoopProxy> message_loop_proxy, 164 scoped_refptr<MessageLoopProxy> message_loop_proxy,
165 PlatformFile file, 165 PlatformFile file,
166 int64 offset, 166 int64 offset,
167 int bytes_to_read, 167 int bytes_to_read,
168 const ReadCallback& callback); 168 const ReadCallback& callback);
169 169
170 // Writes to a file. If |offset| is greater than the length of the file, 170 // Writes to a file. If |offset| is greater than the length of the file,
171 // |false| is returned. On success, the file pointer is moved to position 171 // |false| is returned. On success, the file pointer is moved to position
172 // |offset + bytes_to_write| in the file. The callback can be NULL. 172 // |offset + bytes_to_write| in the file. The callback can be null.
173 // |bytes_to_write| must be greater than zero. 173 // |bytes_to_write| must be greater than zero.
174 static bool Write( 174 static bool Write(
175 scoped_refptr<MessageLoopProxy> message_loop_proxy, 175 scoped_refptr<MessageLoopProxy> message_loop_proxy,
176 PlatformFile file, 176 PlatformFile file,
177 int64 offset, 177 int64 offset,
178 const char* buffer, 178 const char* buffer,
179 int bytes_to_write, 179 int bytes_to_write,
180 WriteCallback* callback); 180 const WriteCallback& callback);
181 181
182 // Touches a file. The callback can be NULL. 182 // Touches a file. The callback can be null.
183 static bool Touch( 183 static bool Touch(
184 scoped_refptr<MessageLoopProxy> message_loop_proxy, 184 scoped_refptr<MessageLoopProxy> message_loop_proxy,
185 PlatformFile file, 185 PlatformFile file,
186 const Time& last_access_time, 186 const Time& last_access_time,
187 const Time& last_modified_time, 187 const Time& last_modified_time,
188 StatusCallback* callback); 188 StatusCallback* callback);
189 189
190 // Touches a file. The callback can be NULL. 190 // Touches a file. The callback can be null.
191 static bool Touch( 191 static bool Touch(
192 scoped_refptr<MessageLoopProxy> message_loop_proxy, 192 scoped_refptr<MessageLoopProxy> message_loop_proxy,
193 const FilePath& file_path, 193 const FilePath& file_path,
194 const Time& last_access_time, 194 const Time& last_access_time,
195 const Time& last_modified_time, 195 const Time& last_modified_time,
196 StatusCallback* callback); 196 StatusCallback* callback);
197 197
198 // Truncates a file to the given length. If |length| is greater than the 198 // Truncates a file to the given length. If |length| is greater than the
199 // current length of the file, the file will be extended with zeroes. 199 // current length of the file, the file will be extended with zeroes.
200 // The callback can be NULL. 200 // The callback can be null.
201 static bool Truncate( 201 static bool Truncate(
202 scoped_refptr<MessageLoopProxy> message_loop_proxy, 202 scoped_refptr<MessageLoopProxy> message_loop_proxy,
203 PlatformFile file, 203 PlatformFile file,
204 int64 length, 204 int64 length,
205 StatusCallback* callback); 205 StatusCallback* callback);
206 206
207 // Truncates a file to the given length. If |length| is greater than the 207 // Truncates a file to the given length. If |length| is greater than the
208 // current length of the file, the file will be extended with zeroes. 208 // current length of the file, the file will be extended with zeroes.
209 // The callback can be NULL. 209 // The callback can be null.
210 static bool Truncate( 210 static bool Truncate(
211 scoped_refptr<MessageLoopProxy> message_loop_proxy, 211 scoped_refptr<MessageLoopProxy> message_loop_proxy,
212 const FilePath& path, 212 const FilePath& path,
213 int64 length, 213 int64 length,
214 StatusCallback* callback); 214 StatusCallback* callback);
215 215
216 // Flushes a file. The callback can be NULL. 216 // Flushes a file. The callback can be null.
217 static bool Flush( 217 static bool Flush(
218 scoped_refptr<MessageLoopProxy> message_loop_proxy, 218 scoped_refptr<MessageLoopProxy> message_loop_proxy,
219 PlatformFile file, 219 PlatformFile file,
220 StatusCallback* callback); 220 StatusCallback* callback);
221 221
222 private: 222 private:
223 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); 223 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy);
224 }; 224 };
225 225
226 } // namespace base 226 } // namespace base
227 227
228 #endif // BASE_FILE_UTIL_PROXY_H_ 228 #endif // BASE_FILE_UTIL_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698