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

Unified Diff: chrome/installer/util/delete_tree_work_item.h

Issue 1976443005: Revert of Add best-effort/allow rollback flags on WorkItem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simple_list_tests
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/delete_reg_value_work_item.cc ('k') | chrome/installer/util/delete_tree_work_item.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/delete_tree_work_item.h
diff --git a/chrome/installer/util/delete_tree_work_item.h b/chrome/installer/util/delete_tree_work_item.h
index 9a144e8976cae89491ce40a08474c143598675c4..9af8fdf05079e770cbca6720634c384b7b6156cf 100644
--- a/chrome/installer/util/delete_tree_work_item.h
+++ b/chrome/installer/util/delete_tree_work_item.h
@@ -4,6 +4,11 @@
#ifndef CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_
#define CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_
+
+#include <stddef.h>
+
+#include <memory>
+#include <vector>
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
@@ -18,6 +23,10 @@
public:
~DeleteTreeWorkItem() override;
+ bool Do() override;
+
+ void Rollback() override;
+
private:
friend class WorkItem;
@@ -26,11 +35,8 @@
// should be on the same volume; otherwise, the move will be simulated
// by a copy-and-delete operation.
DeleteTreeWorkItem(const base::FilePath& root_path,
- const base::FilePath& temp_path);
-
- // WorkItem:
- bool DoImpl() override;
- void RollbackImpl() override;
+ const base::FilePath& temp_path,
+ const std::vector<base::FilePath>& key_paths);
// Return temporary path for work based on |backup_path_| and |root_path_|.
base::FilePath GetBackupPath();
@@ -42,16 +48,28 @@
bool MoveRootToBackup();
// Root path to delete.
- const base::FilePath root_path_;
+ base::FilePath root_path_;
// Temporary directory that can be used.
- const base::FilePath temp_path_;
+ base::FilePath temp_path_;
+
+ // The number of key files.
+ ptrdiff_t num_key_files_;
+
+ // Contains the paths to the key files. If specified, deletion will be
+ // performed only if none of the key files are in use.
+ std::unique_ptr<base::FilePath[]> key_paths_;
+
+ // Contains the temp directories for the backed-up key files. The directories
+ // are created and populated in Do() as-needed. We don't use a standard
+ // container for this since base::ScopedTempDir isn't CopyConstructible.
+ std::unique_ptr<base::ScopedTempDir[]> key_backup_paths_;
// The temporary directory into which the original root_path_ has been moved.
base::ScopedTempDir backup_path_;
// Set to true once root_path_ has been moved into backup_path_.
- bool moved_to_backup_ = false;
+ bool moved_to_backup_;
};
#endif // CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_
« no previous file with comments | « chrome/installer/util/delete_reg_value_work_item.cc ('k') | chrome/installer/util/delete_tree_work_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698