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

Side by Side Diff: base/file_util_proxy.cc

Issue 8231004: Remaining cleanup (base::Bind): Replacing FileUtilProxy calls with new callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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
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 #include "base/file_util_proxy.h" 5 #include "base/file_util_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 9
10 // TODO(jianli): Move the code from anonymous namespace to base namespace so 10 namespace base {
11 // that all of the base:: prefixes would be unnecessary.
12 namespace {
13 11
14 namespace { 12 namespace {
15 13
16 // Performs common checks for move and copy.
17 // This also removes the destination directory if it's non-empty and all other
18 // checks are passed (so that the copy/move correctly overwrites the
19 // destination).
20 static base::PlatformFileError PerformCommonCheckAndPreparationForMoveAndCopy(
21 const FilePath& src_file_path,
22 const FilePath& dest_file_path) {
23 // Exits earlier if the source path does not exist.
24 if (!file_util::PathExists(src_file_path))
25 return base::PLATFORM_FILE_ERROR_NOT_FOUND;
26
27 // The parent of the |dest_file_path| does not exist.
28 if (!file_util::DirectoryExists(dest_file_path.DirName()))
29 return base::PLATFORM_FILE_ERROR_NOT_FOUND;
30
31 // It is an error to try to copy/move an entry into its child.
32 if (src_file_path.IsParent(dest_file_path))
33 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
34
35 // Now it is ok to return if the |dest_file_path| does not exist.
36 if (!file_util::PathExists(dest_file_path))
37 return base::PLATFORM_FILE_OK;
38
39 // |src_file_path| exists and is a directory.
40 // |dest_file_path| exists and is a file.
41 bool src_is_directory = file_util::DirectoryExists(src_file_path);
42 bool dest_is_directory = file_util::DirectoryExists(dest_file_path);
43 if (src_is_directory && !dest_is_directory)
44 return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
45
46 // |src_file_path| exists and is a file.
47 // |dest_file_path| exists and is a directory.
48 if (!src_is_directory && dest_is_directory)
49 return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
50
51 // It is an error to copy/move an entry into the same path.
52 if (src_file_path.value() == dest_file_path.value())
53 return base::PLATFORM_FILE_ERROR_EXISTS;
54
55 if (dest_is_directory) {
56 // It is an error to copy/move an entry to a non-empty directory.
57 // Otherwise the copy/move attempt must overwrite the destination, but
58 // the file_util's Copy or Move method doesn't perform overwrite
59 // on all platforms, so we delete the destination directory here.
60 // TODO(kinuko): may be better to change the file_util::{Copy,Move}.
61 if (!file_util::Delete(dest_file_path, false /* recursive */)) {
62 if (!file_util::IsDirectoryEmpty(dest_file_path))
63 return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
64 return base::PLATFORM_FILE_ERROR_FAILED;
65 }
66 }
67 return base::PLATFORM_FILE_OK;
68 }
69
70 } // anonymous namespace
71
72 class MessageLoopRelay 14 class MessageLoopRelay
73 : public base::RefCountedThreadSafe<MessageLoopRelay> { 15 : public RefCountedThreadSafe<MessageLoopRelay> {
74 public: 16 public:
75 MessageLoopRelay() 17 MessageLoopRelay()
76 : origin_message_loop_proxy_( 18 : origin_message_loop_proxy_(
77 base::MessageLoopProxy::current()), 19 MessageLoopProxy::current()),
78 error_code_(base::PLATFORM_FILE_OK) { 20 error_code_(PLATFORM_FILE_OK) {
79 } 21 }
80 22
81 bool Start(scoped_refptr<base::MessageLoopProxy> message_loop_proxy, 23 bool Start(scoped_refptr<MessageLoopProxy> message_loop_proxy,
82 const tracked_objects::Location& from_here) { 24 const tracked_objects::Location& from_here) {
83 return message_loop_proxy->PostTask( 25 return message_loop_proxy->PostTask(
84 from_here, base::Bind(&MessageLoopRelay::ProcessOnTargetThread, this)); 26 from_here, Bind(&MessageLoopRelay::ProcessOnTargetThread, this));
85 } 27 }
86 28
87 protected: 29 protected:
88 friend class base::RefCountedThreadSafe<MessageLoopRelay>; 30 friend class RefCountedThreadSafe<MessageLoopRelay>;
89 virtual ~MessageLoopRelay() {} 31 virtual ~MessageLoopRelay() {}
90 32
91 // Called to perform work on the FILE thread. 33 // Called to perform work on the FILE thread.
92 virtual void RunWork() = 0; 34 virtual void RunWork() = 0;
93 35
94 // Called to notify the callback on the origin thread. 36 // Called to notify the callback on the origin thread.
95 virtual void RunCallback() = 0; 37 virtual void RunCallback() = 0;
96 38
97 void set_error_code(base::PlatformFileError error_code) { 39 void set_error_code(PlatformFileError error_code) {
98 error_code_ = error_code; 40 error_code_ = error_code;
99 } 41 }
100 42
101 base::PlatformFileError error_code() const { 43 PlatformFileError error_code() const {
102 return error_code_; 44 return error_code_;
103 } 45 }
104 46
105 private: 47 private:
106 void ProcessOnTargetThread() { 48 void ProcessOnTargetThread() {
107 RunWork(); 49 RunWork();
108 origin_message_loop_proxy_->PostTask( 50 origin_message_loop_proxy_->PostTask(
109 FROM_HERE, base::Bind(&MessageLoopRelay::RunCallback, this)); 51 FROM_HERE, Bind(&MessageLoopRelay::RunCallback, this));
110 } 52 }
111 53
112 scoped_refptr<base::MessageLoopProxy> origin_message_loop_proxy_; 54 scoped_refptr<MessageLoopProxy> origin_message_loop_proxy_;
113 base::PlatformFileError error_code_; 55 PlatformFileError error_code_;
114 }; 56 };
115 57
116 class RelayCreateOrOpen : public MessageLoopRelay { 58 class RelayCreateOrOpen : public MessageLoopRelay {
117 public: 59 public:
118 RelayCreateOrOpen( 60 RelayCreateOrOpen(
119 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, 61 scoped_refptr<MessageLoopProxy> message_loop_proxy,
120 const FilePath& file_path, 62 const FilePath& file_path,
121 int file_flags, 63 int file_flags,
122 const base::FileUtilProxy::CreateOrOpenCallback& callback) 64 const FileUtilProxy::CreateOrOpenCallback& callback)
123 : message_loop_proxy_(message_loop_proxy), 65 : message_loop_proxy_(message_loop_proxy),
124 file_path_(file_path), 66 file_path_(file_path),
125 file_flags_(file_flags), 67 file_flags_(file_flags),
126 callback_(callback), 68 callback_(callback),
127 file_handle_(base::kInvalidPlatformFileValue), 69 file_handle_(kInvalidPlatformFileValue),
128 created_(false) { 70 created_(false) {
129 DCHECK_EQ(false, callback.is_null()); 71 DCHECK_EQ(false, callback.is_null());
130 } 72 }
131 73
132 protected: 74 protected:
133 virtual ~RelayCreateOrOpen() { 75 virtual ~RelayCreateOrOpen() {
134 if (file_handle_ != base::kInvalidPlatformFileValue) 76 if (file_handle_ != kInvalidPlatformFileValue)
135 base::FileUtilProxy::Close(message_loop_proxy_, file_handle_, 77 FileUtilProxy::Close(message_loop_proxy_, file_handle_,
136 base::FileUtilProxy::StatusCallback()); 78 FileUtilProxy::StatusCallback());
137 } 79 }
138 80
139 virtual void RunWork() { 81 virtual void RunWork() {
140 if (!file_util::DirectoryExists(file_path_.DirName())) { 82 if (!file_util::DirectoryExists(file_path_.DirName())) {
141 // If its parent does not exist, should return NOT_FOUND error. 83 // If its parent does not exist, should return NOT_FOUND error.
142 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND); 84 set_error_code(PLATFORM_FILE_ERROR_NOT_FOUND);
143 return; 85 return;
144 } 86 }
145 base::PlatformFileError error_code = base::PLATFORM_FILE_OK; 87 PlatformFileError error_code = PLATFORM_FILE_OK;
146 file_handle_ = base::CreatePlatformFile(file_path_, file_flags_, 88 file_handle_ = CreatePlatformFile(file_path_, file_flags_,
147 &created_, &error_code); 89 &created_, &error_code);
akalin 2011/10/18 19:05:11 indent
148 set_error_code(error_code); 90 set_error_code(error_code);
149 } 91 }
150 92
151 virtual void RunCallback() { 93 virtual void RunCallback() {
152 callback_.Run(error_code(), base::PassPlatformFile(&file_handle_), 94 callback_.Run(error_code(), PassPlatformFile(&file_handle_),
153 created_); 95 created_);
154 } 96 }
155 97
156 private: 98 private:
157 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 99 scoped_refptr<MessageLoopProxy> message_loop_proxy_;
158 FilePath file_path_; 100 FilePath file_path_;
159 int file_flags_; 101 int file_flags_;
160 base::FileUtilProxy::CreateOrOpenCallback callback_; 102 FileUtilProxy::CreateOrOpenCallback callback_;
161 base::PlatformFile file_handle_; 103 PlatformFile file_handle_;
162 bool created_; 104 bool created_;
163 }; 105 };
164 106
165 class RelayCreateTemporary : public MessageLoopRelay { 107 class RelayCreateTemporary : public MessageLoopRelay {
166 public: 108 public:
167 RelayCreateTemporary( 109 RelayCreateTemporary(
168 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, 110 scoped_refptr<MessageLoopProxy> message_loop_proxy,
169 int additional_file_flags, 111 int additional_file_flags,
170 const base::FileUtilProxy::CreateTemporaryCallback& callback) 112 const FileUtilProxy::CreateTemporaryCallback& callback)
171 : message_loop_proxy_(message_loop_proxy), 113 : message_loop_proxy_(message_loop_proxy),
172 additional_file_flags_(additional_file_flags), 114 additional_file_flags_(additional_file_flags),
173 callback_(callback), 115 callback_(callback),
174 file_handle_(base::kInvalidPlatformFileValue) { 116 file_handle_(kInvalidPlatformFileValue) {
175 DCHECK_EQ(false, callback.is_null()); 117 DCHECK_EQ(false, callback.is_null());
176 } 118 }
177 119
178 protected: 120 protected:
179 virtual ~RelayCreateTemporary() { 121 virtual ~RelayCreateTemporary() {
180 if (file_handle_ != base::kInvalidPlatformFileValue) 122 if (file_handle_ != kInvalidPlatformFileValue)
181 base::FileUtilProxy::Close(message_loop_proxy_, file_handle_, 123 FileUtilProxy::Close(message_loop_proxy_, file_handle_,
182 base::FileUtilProxy::StatusCallback()); 124 FileUtilProxy::StatusCallback());
183 } 125 }
184 126
185 virtual void RunWork() { 127 virtual void RunWork() {
186 // TODO(darin): file_util should have a variant of CreateTemporaryFile 128 // TODO(darin): file_util should have a variant of CreateTemporaryFile
187 // that returns a FilePath and a PlatformFile. 129 // that returns a FilePath and a PlatformFile.
188 file_util::CreateTemporaryFile(&file_path_); 130 file_util::CreateTemporaryFile(&file_path_);
189 131
190 int file_flags = 132 int file_flags =
191 base::PLATFORM_FILE_WRITE | 133 PLATFORM_FILE_WRITE |
192 base::PLATFORM_FILE_TEMPORARY | 134 PLATFORM_FILE_TEMPORARY |
193 base::PLATFORM_FILE_CREATE_ALWAYS | 135 PLATFORM_FILE_CREATE_ALWAYS |
194 additional_file_flags_; 136 additional_file_flags_;
195 137
196 base::PlatformFileError error_code = base::PLATFORM_FILE_OK; 138 PlatformFileError error_code = PLATFORM_FILE_OK;
197 file_handle_ = base::CreatePlatformFile(file_path_, file_flags, 139 file_handle_ = CreatePlatformFile(file_path_, file_flags,
198 NULL, &error_code); 140 NULL, &error_code);
199 set_error_code(error_code); 141 set_error_code(error_code);
200 } 142 }
201 143
202 virtual void RunCallback() { 144 virtual void RunCallback() {
203 callback_.Run(error_code(), base::PassPlatformFile(&file_handle_), 145 callback_.Run(error_code(), PassPlatformFile(&file_handle_),
204 file_path_); 146 file_path_);
205 } 147 }
206 148
207 private: 149 private:
208 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 150 scoped_refptr<MessageLoopProxy> message_loop_proxy_;
209 int additional_file_flags_; 151 int additional_file_flags_;
210 base::FileUtilProxy::CreateTemporaryCallback callback_; 152 FileUtilProxy::CreateTemporaryCallback callback_;
211 base::PlatformFile file_handle_; 153 PlatformFile file_handle_;
212 FilePath file_path_; 154 FilePath file_path_;
213 }; 155 };
214 156
215 class RelayWithStatusCallback : public MessageLoopRelay { 157 class RelayWithStatusCallback : public MessageLoopRelay {
216 public: 158 public:
217 explicit RelayWithStatusCallback( 159 explicit RelayWithStatusCallback(
218 const base::FileUtilProxy::StatusCallback& callback) 160 const FileUtilProxy::StatusCallback& callback)
219 : callback_(callback) { 161 : callback_(callback) {
220 // It is OK for callback to be NULL. 162 // It is OK for callback to be NULL.
221 } 163 }
222 164
223 protected: 165 protected:
224 virtual void RunCallback() { 166 virtual void RunCallback() {
225 // The caller may not have been interested in the result. 167 // The caller may not have been interested in the result.
226 if (!callback_.is_null()) 168 if (!callback_.is_null())
227 callback_.Run(error_code()); 169 callback_.Run(error_code());
228 } 170 }
229 171
230 private: 172 private:
231 base::FileUtilProxy::StatusCallback callback_; 173 FileUtilProxy::StatusCallback callback_;
232 }; 174 };
233 175
234 class RelayClose : public RelayWithStatusCallback { 176 class RelayClose : public RelayWithStatusCallback {
235 public: 177 public:
236 RelayClose(base::PlatformFile file_handle, 178 RelayClose(PlatformFile file_handle,
237 const base::FileUtilProxy::StatusCallback& callback) 179 const FileUtilProxy::StatusCallback& callback)
238 : RelayWithStatusCallback(callback), 180 : RelayWithStatusCallback(callback),
239 file_handle_(file_handle) { 181 file_handle_(file_handle) {
240 } 182 }
241 183
242 protected: 184 protected:
243 virtual void RunWork() { 185 virtual void RunWork() {
244 if (!base::ClosePlatformFile(file_handle_)) 186 if (!ClosePlatformFile(file_handle_))
245 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 187 set_error_code(PLATFORM_FILE_ERROR_FAILED);
246 } 188 }
247 189
248 private: 190 private:
249 base::PlatformFile file_handle_; 191 PlatformFile file_handle_;
250 };
251
252 class RelayEnsureFileExists : public MessageLoopRelay {
253 public:
254 RelayEnsureFileExists(
255 scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
256 const FilePath& file_path,
257 const base::FileUtilProxy::EnsureFileExistsCallback& callback)
258 : message_loop_proxy_(message_loop_proxy),
259 file_path_(file_path),
260 callback_(callback),
261 created_(false) {
262 DCHECK_EQ(false, callback.is_null());
263 }
264
265 protected:
266 virtual void RunWork() {
267 if (!file_util::DirectoryExists(file_path_.DirName())) {
268 // If its parent does not exist, should return NOT_FOUND error.
269 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND);
270 return;
271 }
272 base::PlatformFileError error_code = base::PLATFORM_FILE_OK;
273 // Tries to create the |file_path_| exclusively. This should fail
274 // with PLATFORM_FILE_ERROR_EXISTS if the path already exists.
275 base::PlatformFile handle = base::CreatePlatformFile(
276 file_path_,
277 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_READ,
278 &created_, &error_code);
279 if (error_code == base::PLATFORM_FILE_ERROR_EXISTS) {
280 // Make sure created_ is false.
281 created_ = false;
282 error_code = base::PLATFORM_FILE_OK;
283 }
284 if (handle != base::kInvalidPlatformFileValue)
285 base::ClosePlatformFile(handle);
286 set_error_code(error_code);
287 }
288
289 virtual void RunCallback() {
290 callback_.Run(error_code(), created_);
291 }
292
293 private:
294 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
295 FilePath file_path_;
296 base::FileUtilProxy::EnsureFileExistsCallback callback_;
297 bool created_;
298 }; 192 };
299 193
300 class RelayDelete : public RelayWithStatusCallback { 194 class RelayDelete : public RelayWithStatusCallback {
301 public: 195 public:
302 RelayDelete(const FilePath& file_path, 196 RelayDelete(const FilePath& file_path,
303 bool recursive, 197 bool recursive,
304 const base::FileUtilProxy::StatusCallback& callback) 198 const FileUtilProxy::StatusCallback& callback)
305 : RelayWithStatusCallback(callback), 199 : RelayWithStatusCallback(callback),
306 file_path_(file_path), 200 file_path_(file_path),
307 recursive_(recursive) { 201 recursive_(recursive) {
308 } 202 }
309 203
310 protected: 204 protected:
311 virtual void RunWork() { 205 virtual void RunWork() {
312 if (!file_util::PathExists(file_path_)) { 206 if (!file_util::PathExists(file_path_)) {
313 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND); 207 set_error_code(PLATFORM_FILE_ERROR_NOT_FOUND);
314 return; 208 return;
315 } 209 }
316 if (!file_util::Delete(file_path_, recursive_)) { 210 if (!file_util::Delete(file_path_, recursive_)) {
317 if (!recursive_ && !file_util::IsDirectoryEmpty(file_path_)) { 211 if (!recursive_ && !file_util::IsDirectoryEmpty(file_path_)) {
318 set_error_code(base::PLATFORM_FILE_ERROR_NOT_EMPTY); 212 set_error_code(PLATFORM_FILE_ERROR_NOT_EMPTY);
319 return; 213 return;
320 } 214 }
321 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 215 set_error_code(PLATFORM_FILE_ERROR_FAILED);
322 } 216 }
323 } 217 }
324 218
325 private: 219 private:
326 FilePath file_path_; 220 FilePath file_path_;
327 bool recursive_; 221 bool recursive_;
328 }; 222 };
329 223
330 class RelayCopy : public RelayWithStatusCallback {
331 public:
332 RelayCopy(const FilePath& src_file_path,
333 const FilePath& dest_file_path,
334 const base::FileUtilProxy::StatusCallback& callback)
335 : RelayWithStatusCallback(callback),
336 src_file_path_(src_file_path),
337 dest_file_path_(dest_file_path) {
338 }
339
340 protected:
341 virtual void RunWork() {
342 set_error_code(PerformCommonCheckAndPreparationForMoveAndCopy(
343 src_file_path_, dest_file_path_));
344 if (error_code() != base::PLATFORM_FILE_OK)
345 return;
346 if (!file_util::CopyDirectory(src_file_path_, dest_file_path_,
347 true /* recursive */))
348 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
349 }
350
351 private:
352 FilePath src_file_path_;
353 FilePath dest_file_path_;
354 };
355
356 class RelayMove : public RelayWithStatusCallback {
357 public:
358 RelayMove(const FilePath& src_file_path,
359 const FilePath& dest_file_path,
360 const base::FileUtilProxy::StatusCallback& callback)
361 : RelayWithStatusCallback(callback),
362 src_file_path_(src_file_path),
363 dest_file_path_(dest_file_path) {
364 }
365
366 protected:
367 virtual void RunWork() {
368 set_error_code(PerformCommonCheckAndPreparationForMoveAndCopy(
369 src_file_path_, dest_file_path_));
370 if (error_code() != base::PLATFORM_FILE_OK)
371 return;
372 if (!file_util::Move(src_file_path_, dest_file_path_))
373 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
374 }
375
376 private:
377 FilePath src_file_path_;
378 FilePath dest_file_path_;
379 };
380
381 class RelayCreateDirectory : public RelayWithStatusCallback {
382 public:
383 RelayCreateDirectory(
384 const FilePath& file_path,
385 bool exclusive,
386 bool recursive,
387 const base::FileUtilProxy::StatusCallback& callback)
388 : RelayWithStatusCallback(callback),
389 file_path_(file_path),
390 exclusive_(exclusive),
391 recursive_(recursive) {
392 }
393
394 protected:
395 virtual void RunWork() {
396 bool path_exists = file_util::PathExists(file_path_);
397 // If parent dir of file doesn't exist.
398 if (!recursive_ && !file_util::PathExists(file_path_.DirName())) {
399 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND);
400 return;
401 }
402 if (exclusive_ && path_exists) {
403 set_error_code(base::PLATFORM_FILE_ERROR_EXISTS);
404 return;
405 }
406 // If file exists at the path.
407 if (path_exists && !file_util::DirectoryExists(file_path_)) {
408 set_error_code(base::PLATFORM_FILE_ERROR_EXISTS);
409 return;
410 }
411 if (!file_util::CreateDirectory(file_path_))
412 set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
413 }
414
415 private:
416 FilePath file_path_;
417 bool exclusive_;
418 bool recursive_;
419 };
420
421 class RelayReadDirectory : public MessageLoopRelay {
422 public:
423 RelayReadDirectory(
424 const FilePath& file_path,
425 const base::FileUtilProxy::ReadDirectoryCallback& callback)
426 : callback_(callback),
427 file_path_(file_path) {
428 DCHECK_EQ(false, callback.is_null());
429 }
430
431 protected:
432 virtual void RunWork() {
433 // TODO(kkanetkar): Implement directory read in multiple chunks.
434 if (!file_util::DirectoryExists(file_path_)) {
435 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND);
436 return;
437 }
438
439 file_util::FileEnumerator file_enum(
440 file_path_, false, static_cast<file_util::FileEnumerator::FileType>(
441 file_util::FileEnumerator::FILES |
442 file_util::FileEnumerator::DIRECTORIES));
443 FilePath current;
444 while (!(current = file_enum.Next()).empty()) {
445 base::FileUtilProxy::Entry entry;
446 file_util::FileEnumerator::FindInfo info;
447 file_enum.GetFindInfo(&info);
448 entry.is_directory = file_enum.IsDirectory(info);
449 // This will just give the entry's name instead of entire path
450 // if we use current.value().
451 entry.name = file_util::FileEnumerator::GetFilename(info).value();
452 entry.size = file_util::FileEnumerator::GetFilesize(info);
453 entry.last_modified_time =
454 file_util::FileEnumerator::GetLastModifiedTime(info);
455 entries_.push_back(entry);
456 }
457 }
458
459 virtual void RunCallback() {
460 callback_.Run(error_code(), entries_);
461 }
462
463 private:
464 base::FileUtilProxy::ReadDirectoryCallback callback_;
465 FilePath file_path_;
466 std::vector<base::FileUtilProxy::Entry> entries_;
467 };
468
469 class RelayGetFileInfo : public MessageLoopRelay { 224 class RelayGetFileInfo : public MessageLoopRelay {
470 public: 225 public:
471 RelayGetFileInfo(const FilePath& file_path, 226 RelayGetFileInfo(const FilePath& file_path,
472 const base::FileUtilProxy::GetFileInfoCallback& callback) 227 const FileUtilProxy::GetFileInfoCallback& callback)
473 : callback_(callback), 228 : callback_(callback),
474 file_path_(file_path) { 229 file_path_(file_path) {
475 DCHECK_EQ(false, callback.is_null()); 230 DCHECK_EQ(false, callback.is_null());
476 } 231 }
477 232
478 protected: 233 protected:
479 virtual void RunWork() { 234 virtual void RunWork() {
480 if (!file_util::PathExists(file_path_)) { 235 if (!file_util::PathExists(file_path_)) {
481 set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND); 236 set_error_code(PLATFORM_FILE_ERROR_NOT_FOUND);
482 return; 237 return;
483 } 238 }
484 if (!file_util::GetFileInfo(file_path_, &file_info_)) 239 if (!file_util::GetFileInfo(file_path_, &file_info_))
485 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 240 set_error_code(PLATFORM_FILE_ERROR_FAILED);
486 } 241 }
487 242
488 virtual void RunCallback() { 243 virtual void RunCallback() {
489 callback_.Run(error_code(), file_info_); 244 callback_.Run(error_code(), file_info_);
490 } 245 }
491 246
492 private: 247 private:
493 base::FileUtilProxy::GetFileInfoCallback callback_; 248 FileUtilProxy::GetFileInfoCallback callback_;
494 FilePath file_path_; 249 FilePath file_path_;
495 base::PlatformFileInfo file_info_; 250 PlatformFileInfo file_info_;
496 }; 251 };
497 252
498 class RelayGetFileInfoFromPlatformFile : public MessageLoopRelay { 253 class RelayGetFileInfoFromPlatformFile : public MessageLoopRelay {
499 public: 254 public:
500 RelayGetFileInfoFromPlatformFile( 255 RelayGetFileInfoFromPlatformFile(
501 base::PlatformFile file, 256 PlatformFile file,
502 const base::FileUtilProxy::GetFileInfoCallback& callback) 257 const FileUtilProxy::GetFileInfoCallback& callback)
503 : callback_(callback), 258 : callback_(callback),
504 file_(file) { 259 file_(file) {
505 DCHECK_EQ(false, callback.is_null()); 260 DCHECK_EQ(false, callback.is_null());
506 } 261 }
507 262
508 protected: 263 protected:
509 virtual void RunWork() { 264 virtual void RunWork() {
510 if (!base::GetPlatformFileInfo(file_, &file_info_)) 265 if (!GetPlatformFileInfo(file_, &file_info_))
511 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 266 set_error_code(PLATFORM_FILE_ERROR_FAILED);
512 } 267 }
513 268
514 virtual void RunCallback() { 269 virtual void RunCallback() {
515 callback_.Run(error_code(), file_info_); 270 callback_.Run(error_code(), file_info_);
516 } 271 }
517 272
518 private: 273 private:
519 base::FileUtilProxy::GetFileInfoCallback callback_; 274 FileUtilProxy::GetFileInfoCallback callback_;
520 base::PlatformFile file_; 275 PlatformFile file_;
521 base::PlatformFileInfo file_info_; 276 PlatformFileInfo file_info_;
522 }; 277 };
523 278
524 class RelayRead : public MessageLoopRelay { 279 class RelayRead : public MessageLoopRelay {
525 public: 280 public:
526 RelayRead(base::PlatformFile file, 281 RelayRead(PlatformFile file,
527 int64 offset, 282 int64 offset,
528 int bytes_to_read, 283 int bytes_to_read,
529 const base::FileUtilProxy::ReadCallback& callback) 284 const FileUtilProxy::ReadCallback& callback)
530 : file_(file), 285 : file_(file),
531 offset_(offset), 286 offset_(offset),
532 buffer_(new char[bytes_to_read]), 287 buffer_(new char[bytes_to_read]),
533 bytes_to_read_(bytes_to_read), 288 bytes_to_read_(bytes_to_read),
534 callback_(callback), 289 callback_(callback),
535 bytes_read_(0) { 290 bytes_read_(0) {
536 } 291 }
537 292
538 protected: 293 protected:
539 virtual void RunWork() { 294 virtual void RunWork() {
540 bytes_read_ = base::ReadPlatformFile(file_, offset_, buffer_.get(), 295 bytes_read_ = ReadPlatformFile(file_, offset_, buffer_.get(),
541 bytes_to_read_); 296 bytes_to_read_);
542 if (bytes_read_ < 0) 297 if (bytes_read_ < 0)
543 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 298 set_error_code(PLATFORM_FILE_ERROR_FAILED);
544 } 299 }
545 300
546 virtual void RunCallback() { 301 virtual void RunCallback() {
547 if (!callback_.is_null()) 302 if (!callback_.is_null())
548 callback_.Run(error_code(), buffer_.get(), bytes_read_); 303 callback_.Run(error_code(), buffer_.get(), bytes_read_);
549 } 304 }
550 305
551 private: 306 private:
552 base::PlatformFile file_; 307 PlatformFile file_;
553 int64 offset_; 308 int64 offset_;
554 scoped_array<char> buffer_; 309 scoped_array<char> buffer_;
555 int bytes_to_read_; 310 int bytes_to_read_;
556 base::FileUtilProxy::ReadCallback callback_; 311 FileUtilProxy::ReadCallback callback_;
557 int bytes_read_; 312 int bytes_read_;
558 }; 313 };
559 314
560 class RelayWrite : public MessageLoopRelay { 315 class RelayWrite : public MessageLoopRelay {
561 public: 316 public:
562 RelayWrite(base::PlatformFile file, 317 RelayWrite(PlatformFile file,
563 int64 offset, 318 int64 offset,
564 const char* buffer, 319 const char* buffer,
565 int bytes_to_write, 320 int bytes_to_write,
566 const base::FileUtilProxy::WriteCallback& callback) 321 const FileUtilProxy::WriteCallback& callback)
567 : file_(file), 322 : file_(file),
568 offset_(offset), 323 offset_(offset),
569 buffer_(new char[bytes_to_write]), 324 buffer_(new char[bytes_to_write]),
570 bytes_to_write_(bytes_to_write), 325 bytes_to_write_(bytes_to_write),
571 callback_(callback), 326 callback_(callback),
572 bytes_written_(0) { 327 bytes_written_(0) {
573 memcpy(buffer_.get(), buffer, bytes_to_write); 328 memcpy(buffer_.get(), buffer, bytes_to_write);
574 } 329 }
575 330
576 protected: 331 protected:
577 virtual void RunWork() { 332 virtual void RunWork() {
578 bytes_written_ = base::WritePlatformFile(file_, offset_, buffer_.get(), 333 bytes_written_ = WritePlatformFile(file_, offset_, buffer_.get(),
579 bytes_to_write_); 334 bytes_to_write_);
580 if (bytes_written_ < 0) 335 if (bytes_written_ < 0)
581 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 336 set_error_code(PLATFORM_FILE_ERROR_FAILED);
582 } 337 }
583 338
584 virtual void RunCallback() { 339 virtual void RunCallback() {
585 if (!callback_.is_null()) 340 if (!callback_.is_null())
586 callback_.Run(error_code(), bytes_written_); 341 callback_.Run(error_code(), bytes_written_);
587 } 342 }
588 343
589 private: 344 private:
590 base::PlatformFile file_; 345 PlatformFile file_;
591 int64 offset_; 346 int64 offset_;
592 scoped_array<char> buffer_; 347 scoped_array<char> buffer_;
593 int bytes_to_write_; 348 int bytes_to_write_;
594 base::FileUtilProxy::WriteCallback callback_; 349 FileUtilProxy::WriteCallback callback_;
595 int bytes_written_; 350 int bytes_written_;
596 }; 351 };
597 352
598 class RelayTouch : public RelayWithStatusCallback { 353 class RelayTouch : public RelayWithStatusCallback {
599 public: 354 public:
600 RelayTouch(base::PlatformFile file, 355 RelayTouch(PlatformFile file,
601 const base::Time& last_access_time, 356 const Time& last_access_time,
602 const base::Time& last_modified_time, 357 const Time& last_modified_time,
603 const base::FileUtilProxy::StatusCallback& callback) 358 const FileUtilProxy::StatusCallback& callback)
604 : RelayWithStatusCallback(callback), 359 : RelayWithStatusCallback(callback),
605 file_(file), 360 file_(file),
606 last_access_time_(last_access_time), 361 last_access_time_(last_access_time),
607 last_modified_time_(last_modified_time) { 362 last_modified_time_(last_modified_time) {
608 } 363 }
609 364
610 protected: 365 protected:
611 virtual void RunWork() { 366 virtual void RunWork() {
612 if (!base::TouchPlatformFile(file_, last_access_time_, last_modified_time_)) 367 if (!TouchPlatformFile(file_, last_access_time_, last_modified_time_))
613 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 368 set_error_code(PLATFORM_FILE_ERROR_FAILED);
614 } 369 }
615 370
616 private: 371 private:
617 base::PlatformFile file_; 372 PlatformFile file_;
618 base::Time last_access_time_; 373 Time last_access_time_;
619 base::Time last_modified_time_; 374 Time last_modified_time_;
620 }; 375 };
621 376
622 class RelayTouchFilePath : public RelayWithStatusCallback { 377 class RelayTouchFilePath : public RelayWithStatusCallback {
623 public: 378 public:
624 RelayTouchFilePath(const FilePath& file_path, 379 RelayTouchFilePath(const FilePath& file_path,
625 const base::Time& last_access_time, 380 const Time& last_access_time,
626 const base::Time& last_modified_time, 381 const Time& last_modified_time,
627 const base::FileUtilProxy::StatusCallback& callback) 382 const FileUtilProxy::StatusCallback& callback)
628 : RelayWithStatusCallback(callback), 383 : RelayWithStatusCallback(callback),
629 file_path_(file_path), 384 file_path_(file_path),
630 last_access_time_(last_access_time), 385 last_access_time_(last_access_time),
631 last_modified_time_(last_modified_time) { 386 last_modified_time_(last_modified_time) {
632 } 387 }
633 388
634 protected: 389 protected:
635 virtual void RunWork() { 390 virtual void RunWork() {
636 if (!file_util::TouchFile( 391 if (!file_util::TouchFile(
637 file_path_, last_access_time_, last_modified_time_)) 392 file_path_, last_access_time_, last_modified_time_))
638 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 393 set_error_code(PLATFORM_FILE_ERROR_FAILED);
639 } 394 }
640 395
641 private: 396 private:
642 FilePath file_path_; 397 FilePath file_path_;
643 base::Time last_access_time_; 398 Time last_access_time_;
644 base::Time last_modified_time_; 399 Time last_modified_time_;
645 }; 400 };
646 401
647 class RelayTruncatePlatformFile : public RelayWithStatusCallback { 402 class RelayTruncatePlatformFile : public RelayWithStatusCallback {
648 public: 403 public:
649 RelayTruncatePlatformFile(base::PlatformFile file, 404 RelayTruncatePlatformFile(PlatformFile file,
650 int64 length, 405 int64 length,
651 const base::FileUtilProxy::StatusCallback& callback) 406 const FileUtilProxy::StatusCallback& callback)
652 : RelayWithStatusCallback(callback), 407 : RelayWithStatusCallback(callback),
653 file_(file), 408 file_(file),
654 length_(length) { 409 length_(length) {
655 } 410 }
656 411
657 protected: 412 protected:
658 virtual void RunWork() { 413 virtual void RunWork() {
659 if (!base::TruncatePlatformFile(file_, length_)) 414 if (!TruncatePlatformFile(file_, length_))
660 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 415 set_error_code(PLATFORM_FILE_ERROR_FAILED);
661 } 416 }
662 417
663 private: 418 private:
664 base::PlatformFile file_; 419 PlatformFile file_;
665 int64 length_; 420 int64 length_;
666 }; 421 };
667 422
668 class RelayTruncate : public RelayWithStatusCallback { 423 class RelayTruncate : public RelayWithStatusCallback {
669 public: 424 public:
670 RelayTruncate(const FilePath& path, 425 RelayTruncate(const FilePath& path,
671 int64 length, 426 int64 length,
672 const base::FileUtilProxy::StatusCallback& callback) 427 const FileUtilProxy::StatusCallback& callback)
673 : RelayWithStatusCallback(callback), 428 : RelayWithStatusCallback(callback),
674 path_(path), 429 path_(path),
675 length_(length) { 430 length_(length) {
676 } 431 }
677 432
678 protected: 433 protected:
679 virtual void RunWork() { 434 virtual void RunWork() {
680 base::PlatformFileError error_code(base::PLATFORM_FILE_ERROR_FAILED); 435 PlatformFileError error_code(PLATFORM_FILE_ERROR_FAILED);
681 base::PlatformFile file = 436 PlatformFile file =
682 base::CreatePlatformFile( 437 CreatePlatformFile(
683 path_, 438 path_,
684 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE, 439 PLATFORM_FILE_OPEN | PLATFORM_FILE_WRITE,
685 NULL, 440 NULL,
686 &error_code); 441 &error_code);
687 if (error_code != base::PLATFORM_FILE_OK) { 442 if (error_code != PLATFORM_FILE_OK) {
688 set_error_code(error_code); 443 set_error_code(error_code);
689 return; 444 return;
690 } 445 }
691 if (!base::TruncatePlatformFile(file, length_)) 446 if (!TruncatePlatformFile(file, length_))
692 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 447 set_error_code(PLATFORM_FILE_ERROR_FAILED);
693 base::ClosePlatformFile(file); 448 ClosePlatformFile(file);
694 } 449 }
695 450
696 private: 451 private:
697 FilePath path_; 452 FilePath path_;
698 int64 length_; 453 int64 length_;
699 }; 454 };
700 455
701 class RelayFlush : public RelayWithStatusCallback { 456 class RelayFlush : public RelayWithStatusCallback {
702 public: 457 public:
703 RelayFlush(base::PlatformFile file, 458 RelayFlush(PlatformFile file,
704 const base::FileUtilProxy::StatusCallback& callback) 459 const FileUtilProxy::StatusCallback& callback)
705 : RelayWithStatusCallback(callback), 460 : RelayWithStatusCallback(callback),
706 file_(file) { 461 file_(file) {
707 } 462 }
708 463
709 protected: 464 protected:
710 virtual void RunWork() { 465 virtual void RunWork() {
711 if (!base::FlushPlatformFile(file_)) 466 if (!FlushPlatformFile(file_))
712 set_error_code(base::PLATFORM_FILE_ERROR_FAILED); 467 set_error_code(PLATFORM_FILE_ERROR_FAILED);
713 } 468 }
714 469
715 private: 470 private:
716 base::PlatformFile file_; 471 PlatformFile file_;
717 }; 472 };
718 473
719 bool Start(const tracked_objects::Location& from_here, 474 bool Start(const tracked_objects::Location& from_here,
720 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, 475 scoped_refptr<MessageLoopProxy> message_loop_proxy,
721 scoped_refptr<MessageLoopRelay> relay) { 476 scoped_refptr<MessageLoopRelay> relay) {
722 return relay->Start(message_loop_proxy, from_here); 477 return relay->Start(message_loop_proxy, from_here);
723 } 478 }
724 479
725 } // namespace 480 } // namespace
726 481
727 namespace base {
728
729 // static 482 // static
730 bool FileUtilProxy::CreateOrOpen( 483 bool FileUtilProxy::CreateOrOpen(
731 scoped_refptr<MessageLoopProxy> message_loop_proxy, 484 scoped_refptr<MessageLoopProxy> message_loop_proxy,
732 const FilePath& file_path, int file_flags, 485 const FilePath& file_path, int file_flags,
733 const CreateOrOpenCallback& callback) { 486 const CreateOrOpenCallback& callback) {
734 return Start(FROM_HERE, message_loop_proxy, new RelayCreateOrOpen( 487 return Start(FROM_HERE, message_loop_proxy, new RelayCreateOrOpen(
735 message_loop_proxy, file_path, file_flags, callback)); 488 message_loop_proxy, file_path, file_flags, callback));
736 } 489 }
737 490
738 // static 491 // static
739 bool FileUtilProxy::CreateTemporary( 492 bool FileUtilProxy::CreateTemporary(
740 scoped_refptr<MessageLoopProxy> message_loop_proxy, 493 scoped_refptr<MessageLoopProxy> message_loop_proxy,
741 int additional_file_flags, 494 int additional_file_flags,
742 const CreateTemporaryCallback& callback) { 495 const CreateTemporaryCallback& callback) {
743 return Start(FROM_HERE, message_loop_proxy, 496 return Start(FROM_HERE, message_loop_proxy,
744 new RelayCreateTemporary(message_loop_proxy, 497 new RelayCreateTemporary(message_loop_proxy,
745 additional_file_flags, 498 additional_file_flags,
746 callback)); 499 callback));
747 } 500 }
748 501
749 // static 502 // static
750 bool FileUtilProxy::Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, 503 bool FileUtilProxy::Close(scoped_refptr<MessageLoopProxy> message_loop_proxy,
751 base::PlatformFile file_handle, 504 PlatformFile file_handle,
752 const StatusCallback& callback) { 505 const StatusCallback& callback) {
753 return Start(FROM_HERE, message_loop_proxy, 506 return Start(FROM_HERE, message_loop_proxy,
754 new RelayClose(file_handle, callback)); 507 new RelayClose(file_handle, callback));
755 } 508 }
756 509
757 // static
758 bool FileUtilProxy::EnsureFileExists(
759 scoped_refptr<MessageLoopProxy> message_loop_proxy,
760 const FilePath& file_path,
761 const EnsureFileExistsCallback& callback) {
762 return Start(FROM_HERE, message_loop_proxy, new RelayEnsureFileExists(
763 message_loop_proxy, file_path, callback));
764 }
765
766 // Retrieves the information about a file. It is invalid to pass NULL for the 510 // Retrieves the information about a file. It is invalid to pass NULL for the
767 // callback. 511 // callback.
768 bool FileUtilProxy::GetFileInfo( 512 bool FileUtilProxy::GetFileInfo(
769 scoped_refptr<MessageLoopProxy> message_loop_proxy, 513 scoped_refptr<MessageLoopProxy> message_loop_proxy,
770 const FilePath& file_path, 514 const FilePath& file_path,
771 const GetFileInfoCallback& callback) { 515 const GetFileInfoCallback& callback) {
772 return Start(FROM_HERE, message_loop_proxy, new RelayGetFileInfo( 516 return Start(FROM_HERE, message_loop_proxy, new RelayGetFileInfo(
773 file_path, callback)); 517 file_path, callback));
774 } 518 }
775 519
776 // static 520 // static
777 bool FileUtilProxy::GetFileInfoFromPlatformFile( 521 bool FileUtilProxy::GetFileInfoFromPlatformFile(
778 scoped_refptr<MessageLoopProxy> message_loop_proxy, 522 scoped_refptr<MessageLoopProxy> message_loop_proxy,
779 PlatformFile file, 523 PlatformFile file,
780 const GetFileInfoCallback& callback) { 524 const GetFileInfoCallback& callback) {
781 return Start(FROM_HERE, message_loop_proxy, 525 return Start(FROM_HERE, message_loop_proxy,
782 new RelayGetFileInfoFromPlatformFile(file, callback)); 526 new RelayGetFileInfoFromPlatformFile(file, callback));
783 } 527 }
784 528
785 // static 529 // static
786 bool FileUtilProxy::ReadDirectory(
787 scoped_refptr<MessageLoopProxy> message_loop_proxy,
788 const FilePath& file_path,
789 const ReadDirectoryCallback& callback) {
790 return Start(FROM_HERE, message_loop_proxy, new RelayReadDirectory(
791 file_path, callback));
792 }
793
794 // static
795 bool FileUtilProxy::CreateDirectory(
796 scoped_refptr<MessageLoopProxy> message_loop_proxy,
797 const FilePath& file_path,
798 bool exclusive,
799 bool recursive,
800 const StatusCallback& callback) {
801 return Start(FROM_HERE, message_loop_proxy, new RelayCreateDirectory(
802 file_path, exclusive, recursive, callback));
803 }
804
805 // static
806 bool FileUtilProxy::Copy(scoped_refptr<MessageLoopProxy> message_loop_proxy,
807 const FilePath& src_file_path,
808 const FilePath& dest_file_path,
809 const StatusCallback& callback) {
810 return Start(FROM_HERE, message_loop_proxy,
811 new RelayCopy(src_file_path, dest_file_path, callback));
812 }
813
814 // static
815 bool FileUtilProxy::Move(scoped_refptr<MessageLoopProxy> message_loop_proxy,
816 const FilePath& src_file_path,
817 const FilePath& dest_file_path,
818 const StatusCallback& callback) {
819 return Start(FROM_HERE, message_loop_proxy,
820 new RelayMove(src_file_path, dest_file_path, callback));
821 }
822
823 // static
824 bool FileUtilProxy::Delete(scoped_refptr<MessageLoopProxy> message_loop_proxy, 530 bool FileUtilProxy::Delete(scoped_refptr<MessageLoopProxy> message_loop_proxy,
825 const FilePath& file_path, 531 const FilePath& file_path,
826 bool recursive, 532 bool recursive,
827 const StatusCallback& callback) { 533 const StatusCallback& callback) {
828 return Start(FROM_HERE, message_loop_proxy, 534 return Start(FROM_HERE, message_loop_proxy,
829 new RelayDelete(file_path, recursive, callback)); 535 new RelayDelete(file_path, recursive, callback));
830 } 536 }
831 537
832 // static 538 // static
833 bool FileUtilProxy::RecursiveDelete( 539 bool FileUtilProxy::RecursiveDelete(
(...skipping 30 matching lines...) Expand all
864 return false; 570 return false;
865 571
866 return Start(FROM_HERE, message_loop_proxy, 572 return Start(FROM_HERE, message_loop_proxy,
867 new RelayWrite(file, offset, buffer, bytes_to_write, callback)); 573 new RelayWrite(file, offset, buffer, bytes_to_write, callback));
868 } 574 }
869 575
870 // static 576 // static
871 bool FileUtilProxy::Touch( 577 bool FileUtilProxy::Touch(
872 scoped_refptr<MessageLoopProxy> message_loop_proxy, 578 scoped_refptr<MessageLoopProxy> message_loop_proxy,
873 PlatformFile file, 579 PlatformFile file,
874 const base::Time& last_access_time, 580 const Time& last_access_time,
875 const base::Time& last_modified_time, 581 const Time& last_modified_time,
876 const StatusCallback& callback) { 582 const StatusCallback& callback) {
877 return Start(FROM_HERE, message_loop_proxy, 583 return Start(FROM_HERE, message_loop_proxy,
878 new RelayTouch(file, last_access_time, last_modified_time, 584 new RelayTouch(file, last_access_time, last_modified_time,
879 callback)); 585 callback));
880 } 586 }
881 587
882 // static 588 // static
883 bool FileUtilProxy::Touch( 589 bool FileUtilProxy::Touch(
884 scoped_refptr<MessageLoopProxy> message_loop_proxy, 590 scoped_refptr<MessageLoopProxy> message_loop_proxy,
885 const FilePath& file_path, 591 const FilePath& file_path,
886 const base::Time& last_access_time, 592 const Time& last_access_time,
887 const base::Time& last_modified_time, 593 const Time& last_modified_time,
888 const StatusCallback& callback) { 594 const StatusCallback& callback) {
889 return Start(FROM_HERE, message_loop_proxy, 595 return Start(FROM_HERE, message_loop_proxy,
890 new RelayTouchFilePath(file_path, last_access_time, 596 new RelayTouchFilePath(file_path, last_access_time,
891 last_modified_time, callback)); 597 last_modified_time, callback));
892 } 598 }
893 599
894 // static 600 // static
895 bool FileUtilProxy::Truncate( 601 bool FileUtilProxy::Truncate(
896 scoped_refptr<MessageLoopProxy> message_loop_proxy, 602 scoped_refptr<MessageLoopProxy> message_loop_proxy,
897 PlatformFile file, 603 PlatformFile file,
(...skipping 15 matching lines...) Expand all
913 619
914 // static 620 // static
915 bool FileUtilProxy::Flush( 621 bool FileUtilProxy::Flush(
916 scoped_refptr<MessageLoopProxy> message_loop_proxy, 622 scoped_refptr<MessageLoopProxy> message_loop_proxy,
917 PlatformFile file, 623 PlatformFile file,
918 const StatusCallback& callback) { 624 const StatusCallback& callback) {
919 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback)); 625 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback));
920 } 626 }
921 627
922 } // namespace base 628 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698