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

Side by Side Diff: chrome/installer/util/copy_tree_work_item.h

Issue 1109043003: Apply automated fixits for Chrome clang plugin to chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 (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 CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_ 5 #ifndef CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_
6 #define CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_ 6 #define CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "chrome/installer/util/work_item.h" 11 #include "chrome/installer/util/work_item.h"
12 12
13 // A WorkItem subclass that recursively copies a file system hierarchy from 13 // A WorkItem subclass that recursively copies a file system hierarchy from
14 // source path to destination path. It also creates all necessary intermediate 14 // source path to destination path. It also creates all necessary intermediate
15 // paths of the destination path if they do not exist. The file system 15 // paths of the destination path if they do not exist. The file system
16 // hierarchy could be a single file, or a directory. 16 // hierarchy could be a single file, or a directory.
17 // Under the cover CopyTreeWorkItem moves the destination path, if existing, 17 // Under the cover CopyTreeWorkItem moves the destination path, if existing,
18 // to the temporary directory passed in, and then copies the source hierarchy 18 // to the temporary directory passed in, and then copies the source hierarchy
19 // to the destination location. During rollback the original destination 19 // to the destination location. During rollback the original destination
20 // hierarchy is moved back. 20 // hierarchy is moved back.
21 // NOTE: It is a best practice to ensure that the temporary directory is on the 21 // NOTE: It is a best practice to ensure that the temporary directory is on the
22 // same volume as the destination path. If this is not the case, the existing 22 // same volume as the destination path. If this is not the case, the existing
23 // destination path is not moved, but rather copied, to the destination path. 23 // destination path is not moved, but rather copied, to the destination path.
24 // This will result in in-use files being left behind, as well as potentially 24 // This will result in in-use files being left behind, as well as potentially
25 // losing ACLs or other metadata in the case of a rollback. 25 // losing ACLs or other metadata in the case of a rollback.
26 class CopyTreeWorkItem : public WorkItem { 26 class CopyTreeWorkItem : public WorkItem {
27 public: 27 public:
28 virtual ~CopyTreeWorkItem(); 28 ~CopyTreeWorkItem() override;
29 29
30 virtual bool Do(); 30 bool Do() override;
31 31
32 virtual void Rollback(); 32 void Rollback() override;
33 33
34 private: 34 private:
35 friend class WorkItem; 35 friend class WorkItem;
36 36
37 // See comments on corresponding member variables for the semantics of 37 // See comments on corresponding member variables for the semantics of
38 // arguments. 38 // arguments.
39 // Notes on temp_path: to facilitate rollback, the caller needs to supply 39 // Notes on temp_path: to facilitate rollback, the caller needs to supply
40 // a temporary directory to save the original files if they exist under 40 // a temporary directory to save the original files if they exist under
41 // dest_path. 41 // dest_path.
42 CopyTreeWorkItem(const base::FilePath& source_path, 42 CopyTreeWorkItem(const base::FilePath& source_path,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 base::ScopedTempDir backup_path_; 80 base::ScopedTempDir backup_path_;
81 81
82 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileSameContent); 82 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileSameContent);
83 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileInUse); 83 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileInUse);
84 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileAndCleanup); 84 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileAndCleanup);
85 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, NewNameAndCopyTest); 85 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, NewNameAndCopyTest);
86 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileInUseAndCleanup); 86 FRIEND_TEST_ALL_PREFIXES(CopyTreeWorkItemTest, CopyFileInUseAndCleanup);
87 }; 87 };
88 88
89 #endif // CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_ 89 #endif // CHROME_INSTALLER_UTIL_COPY_TREE_WORK_ITEM_H_
OLDNEW
« no previous file with comments | « chrome/installer/util/conditional_work_item_list.h ('k') | chrome/installer/util/copy_tree_work_item_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698