OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/fileapi/syncable/canned_syncable_file_system.h" | 5 #include "webkit/fileapi/syncable/canned_syncable_file_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 | 285 |
286 PlatformFileError CannedSyncableFileSystem::TruncateFile( | 286 PlatformFileError CannedSyncableFileSystem::TruncateFile( |
287 const FileSystemURL& url, int64 size) { | 287 const FileSystemURL& url, int64 size) { |
288 return RunOnThread<PlatformFileError>( | 288 return RunOnThread<PlatformFileError>( |
289 io_task_runner_, | 289 io_task_runner_, |
290 FROM_HERE, | 290 FROM_HERE, |
291 base::Bind(&CannedSyncableFileSystem::DoTruncateFile, | 291 base::Bind(&CannedSyncableFileSystem::DoTruncateFile, |
292 base::Unretained(this), url, size)); | 292 base::Unretained(this), url, size)); |
293 } | 293 } |
294 | 294 |
295 PlatformFileError CannedSyncableFileSystem::TouchFile( | |
296 const FileSystemURL& url, | |
297 const base::Time& access_time, | |
298 const base::Time& modified_time) { | |
299 return RunOnThread<PlatformFileError>( | |
300 io_task_runner_, | |
301 FROM_HERE, | |
302 base::Bind(&CannedSyncableFileSystem::DoTouchFile, | |
303 base::Unretained(this), url, access_time, modified_time)); | |
304 } | |
305 | |
295 PlatformFileError CannedSyncableFileSystem::Remove( | 306 PlatformFileError CannedSyncableFileSystem::Remove( |
296 const FileSystemURL& url, bool recursive) { | 307 const FileSystemURL& url, bool recursive) { |
297 return RunOnThread<PlatformFileError>( | 308 return RunOnThread<PlatformFileError>( |
298 io_task_runner_, | 309 io_task_runner_, |
299 FROM_HERE, | 310 FROM_HERE, |
300 base::Bind(&CannedSyncableFileSystem::DoRemove, | 311 base::Bind(&CannedSyncableFileSystem::DoRemove, |
301 base::Unretained(this), url, recursive)); | 312 base::Unretained(this), url, recursive)); |
302 } | 313 } |
303 | 314 |
304 PlatformFileError CannedSyncableFileSystem::FileExists( | 315 PlatformFileError CannedSyncableFileSystem::FileExists( |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 NewOperation()->Move(src_url, dest_url, callback); | 442 NewOperation()->Move(src_url, dest_url, callback); |
432 } | 443 } |
433 | 444 |
434 void CannedSyncableFileSystem::DoTruncateFile( | 445 void CannedSyncableFileSystem::DoTruncateFile( |
435 const FileSystemURL& url, int64 size, | 446 const FileSystemURL& url, int64 size, |
436 const StatusCallback& callback) { | 447 const StatusCallback& callback) { |
437 EXPECT_TRUE(is_filesystem_opened_); | 448 EXPECT_TRUE(is_filesystem_opened_); |
438 NewOperation()->Truncate(url, size, callback); | 449 NewOperation()->Truncate(url, size, callback); |
439 } | 450 } |
440 | 451 |
452 void CannedSyncableFileSystem::DoTouchFile( | |
453 const FileSystemURL& url, | |
454 const base::Time& access_time, const base::Time& modified_time, | |
nhiroki
2012/11/09 07:50:03
nit: please add line break after "access_time,".
kinuko
2012/11/09 07:55:33
Done...
(by the way just to clarify, I don't thin
| |
455 const StatusCallback& callback) { | |
456 EXPECT_TRUE(is_filesystem_opened_); | |
457 NewOperation()->TouchFile(url, access_time, modified_time, callback); | |
458 } | |
459 | |
441 void CannedSyncableFileSystem::DoRemove( | 460 void CannedSyncableFileSystem::DoRemove( |
442 const FileSystemURL& url, bool recursive, | 461 const FileSystemURL& url, bool recursive, |
443 const StatusCallback& callback) { | 462 const StatusCallback& callback) { |
444 EXPECT_TRUE(is_filesystem_opened_); | 463 EXPECT_TRUE(is_filesystem_opened_); |
445 NewOperation()->Remove(url, recursive, callback); | 464 NewOperation()->Remove(url, recursive, callback); |
446 } | 465 } |
447 | 466 |
448 void CannedSyncableFileSystem::DoFileExists( | 467 void CannedSyncableFileSystem::DoFileExists( |
449 const FileSystemURL& url, const StatusCallback& callback) { | 468 const FileSystemURL& url, const StatusCallback& callback) { |
450 EXPECT_TRUE(is_filesystem_opened_); | 469 EXPECT_TRUE(is_filesystem_opened_); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
513 sync_status_ = status; | 532 sync_status_ = status; |
514 MessageLoop::current()->Quit(); | 533 MessageLoop::current()->Quit(); |
515 } | 534 } |
516 | 535 |
517 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 536 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
518 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 537 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
519 file_system_context_->sync_context()->sync_status()->AddObserver(this); | 538 file_system_context_->sync_context()->sync_status()->AddObserver(this); |
520 } | 539 } |
521 | 540 |
522 } // namespace fileapi | 541 } // namespace fileapi |
OLD | NEW |