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

Side by Side Diff: chrome/browser/sync_file_system/local/syncable_file_system_operation.cc

Issue 666143002: Standardize usage of virtual/override/final in chrome/browser/sync_file_system/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
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 22 matching lines...) Expand all
33 33
34 class SyncableFileSystemOperation::QueueableTask 34 class SyncableFileSystemOperation::QueueableTask
35 : public SyncableFileOperationRunner::Task { 35 : public SyncableFileOperationRunner::Task {
36 public: 36 public:
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 ~QueueableTask() override { DCHECK(!operation_); }
44 DCHECK(!operation_);
45 }
46 44
47 virtual void Run() override { 45 void Run() override {
48 if (!operation_) 46 if (!operation_)
49 return; 47 return;
50 DCHECK(!task_.is_null()); 48 DCHECK(!task_.is_null());
51 task_.Run(); 49 task_.Run();
52 operation_.reset(); 50 operation_.reset();
53 } 51 }
54 52
55 virtual void Cancel() override { 53 void Cancel() override {
56 DCHECK(!task_.is_null()); 54 DCHECK(!task_.is_null());
57 if (operation_) 55 if (operation_)
58 operation_->OnCancelled(); 56 operation_->OnCancelled();
59 task_.Reset(); 57 task_.Reset();
60 operation_.reset(); 58 operation_.reset();
61 } 59 }
62 60
63 virtual const std::vector<FileSystemURL>& target_paths() const override { 61 const std::vector<FileSystemURL>& target_paths() const override {
64 return target_paths_; 62 return target_paths_;
65 } 63 }
66 64
67 private: 65 private:
68 base::WeakPtr<SyncableFileSystemOperation> operation_; 66 base::WeakPtr<SyncableFileSystemOperation> operation_;
69 base::Closure task_; 67 base::Closure task_;
70 std::vector<FileSystemURL> target_paths_; 68 std::vector<FileSystemURL> target_paths_;
71 DISALLOW_COPY_AND_ASSIGN(QueueableTask); 69 DISALLOW_COPY_AND_ASSIGN(QueueableTask);
72 }; 70 };
73 71
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 operation_runner_->OnOperationCompleted(target_paths_); 387 operation_runner_->OnOperationCompleted(target_paths_);
390 callback.Run(result, bytes, complete); 388 callback.Run(result, bytes, complete);
391 } 389 }
392 390
393 void SyncableFileSystemOperation::OnCancelled() { 391 void SyncableFileSystemOperation::OnCancelled() {
394 DCHECK(!completion_callback_.is_null()); 392 DCHECK(!completion_callback_.is_null());
395 completion_callback_.Run(base::File::FILE_ERROR_ABORT); 393 completion_callback_.Run(base::File::FILE_ERROR_ABORT);
396 } 394 }
397 395
398 } // namespace sync_file_system 396 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698