OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync_file_system/local/syncable_file_system_operation.h
" | 5 #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h
" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 8 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
9 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 9 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
10 #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h
" | 10 #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h
" |
(...skipping 26 matching lines...) Expand all Loading... |
37 QueueableTask(base::WeakPtr<SyncableFileSystemOperation> operation, | 37 QueueableTask(base::WeakPtr<SyncableFileSystemOperation> operation, |
38 const base::Closure& task) | 38 const base::Closure& task) |
39 : operation_(operation), | 39 : operation_(operation), |
40 task_(task), | 40 task_(task), |
41 target_paths_(operation->target_paths_) {} | 41 target_paths_(operation->target_paths_) {} |
42 | 42 |
43 virtual ~QueueableTask() { | 43 virtual ~QueueableTask() { |
44 DCHECK(!operation_); | 44 DCHECK(!operation_); |
45 } | 45 } |
46 | 46 |
47 virtual void Run() OVERRIDE { | 47 virtual void Run() override { |
48 if (!operation_) | 48 if (!operation_) |
49 return; | 49 return; |
50 DCHECK(!task_.is_null()); | 50 DCHECK(!task_.is_null()); |
51 task_.Run(); | 51 task_.Run(); |
52 operation_.reset(); | 52 operation_.reset(); |
53 } | 53 } |
54 | 54 |
55 virtual void Cancel() OVERRIDE { | 55 virtual void Cancel() override { |
56 DCHECK(!task_.is_null()); | 56 DCHECK(!task_.is_null()); |
57 if (operation_) | 57 if (operation_) |
58 operation_->OnCancelled(); | 58 operation_->OnCancelled(); |
59 task_.Reset(); | 59 task_.Reset(); |
60 operation_.reset(); | 60 operation_.reset(); |
61 } | 61 } |
62 | 62 |
63 virtual const std::vector<FileSystemURL>& target_paths() const OVERRIDE { | 63 virtual const std::vector<FileSystemURL>& target_paths() const override { |
64 return target_paths_; | 64 return target_paths_; |
65 } | 65 } |
66 | 66 |
67 private: | 67 private: |
68 base::WeakPtr<SyncableFileSystemOperation> operation_; | 68 base::WeakPtr<SyncableFileSystemOperation> operation_; |
69 base::Closure task_; | 69 base::Closure task_; |
70 std::vector<FileSystemURL> target_paths_; | 70 std::vector<FileSystemURL> target_paths_; |
71 DISALLOW_COPY_AND_ASSIGN(QueueableTask); | 71 DISALLOW_COPY_AND_ASSIGN(QueueableTask); |
72 }; | 72 }; |
73 | 73 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 operation_runner_->OnOperationCompleted(target_paths_); | 389 operation_runner_->OnOperationCompleted(target_paths_); |
390 callback.Run(result, bytes, complete); | 390 callback.Run(result, bytes, complete); |
391 } | 391 } |
392 | 392 |
393 void SyncableFileSystemOperation::OnCancelled() { | 393 void SyncableFileSystemOperation::OnCancelled() { |
394 DCHECK(!completion_callback_.is_null()); | 394 DCHECK(!completion_callback_.is_null()); |
395 completion_callback_.Run(base::File::FILE_ERROR_ABORT); | 395 completion_callback_.Run(base::File::FILE_ERROR_ABORT); |
396 } | 396 } |
397 | 397 |
398 } // namespace sync_file_system | 398 } // namespace sync_file_system |
OLD | NEW |