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

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: 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 NULL 61 // Creates or opens a file with the given flags. It is invalid to pass NULL
62 // for the callback. 62 // for the callback.
63 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create 63 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create
64 // a new file at the given |file_path| and calls back with 64 // a new file at the given |file_path| and calls back with
65 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. 65 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists.
66 // Takes ownership of |callback| and will delete it even on failure. 66 // Takes ownership of |callback| and will delete it even on failure.
67 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy, 67 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy,
68 const FilePath& file_path, 68 const FilePath& file_path,
69 int file_flags, 69 int file_flags,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // |offset + bytes_to_read| in the file. The callback can be NULL. 164 // |offset + bytes_to_read| in the file. The callback can be NULL.
165 static bool Read( 165 static bool Read(
166 scoped_refptr<MessageLoopProxy> message_loop_proxy, 166 scoped_refptr<MessageLoopProxy> message_loop_proxy,
167 PlatformFile file, 167 PlatformFile file,
168 int64 offset, 168 int64 offset,
169 int bytes_to_read, 169 int bytes_to_read,
170 const ReadCallback& callback); 170 const ReadCallback& callback);
171 171
172 // Writes to a file. If |offset| is greater than the length of the file, 172 // Writes to a file. If |offset| is greater than the length of the file,
173 // |false| is returned. On success, the file pointer is moved to position 173 // |false| is returned. On success, the file pointer is moved to position
174 // |offset + bytes_to_write| in the file. The callback can be NULL. 174 // |offset + bytes_to_write| in the file. The callback can be NULL.
csilv 2011/10/17 20:53:23 "can be null"
James Hawkins 2011/10/17 20:56:42 Done.
175 // |bytes_to_write| must be greater than zero. 175 // |bytes_to_write| must be greater than zero.
176 static bool Write( 176 static bool Write(
177 scoped_refptr<MessageLoopProxy> message_loop_proxy, 177 scoped_refptr<MessageLoopProxy> message_loop_proxy,
178 PlatformFile file, 178 PlatformFile file,
179 int64 offset, 179 int64 offset,
180 const char* buffer, 180 const char* buffer,
181 int bytes_to_write, 181 int bytes_to_write,
182 WriteCallback* callback); 182 const WriteCallback& callback);
183 183
184 // Touches a file. The callback can be NULL. 184 // Touches a file. The callback can be NULL.
185 static bool Touch( 185 static bool Touch(
186 scoped_refptr<MessageLoopProxy> message_loop_proxy, 186 scoped_refptr<MessageLoopProxy> message_loop_proxy,
187 PlatformFile file, 187 PlatformFile file,
188 const Time& last_access_time, 188 const Time& last_access_time,
189 const Time& last_modified_time, 189 const Time& last_modified_time,
190 StatusCallback* callback); 190 StatusCallback* callback);
191 191
192 // Touches a file. The callback can be NULL. 192 // Touches a file. The callback can be NULL.
(...skipping 28 matching lines...) Expand all
221 PlatformFile file, 221 PlatformFile file,
222 StatusCallback* callback); 222 StatusCallback* callback);
223 223
224 private: 224 private:
225 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); 225 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy);
226 }; 226 };
227 227
228 } // namespace base 228 } // namespace base
229 229
230 #endif // BASE_FILE_UTIL_PROXY_H_ 230 #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