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

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

Issue 1882923003: Add best-effort/allow rollback flags on WorkItem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simple_list_tests
Patch Set: fix build error 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
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 9af8fdf05079e770cbca6720634c384b7b6156cf..9a144e8976cae89491ce40a08474c143598675c4 100644
--- a/chrome/installer/util/delete_tree_work_item.h
+++ b/chrome/installer/util/delete_tree_work_item.h
@@ -5,11 +5,6 @@
#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"
#include "chrome/installer/util/work_item.h"
@@ -23,10 +18,6 @@ class DeleteTreeWorkItem : public WorkItem {
public:
~DeleteTreeWorkItem() override;
- bool Do() override;
-
- void Rollback() override;
-
private:
friend class WorkItem;
@@ -35,8 +26,11 @@ class DeleteTreeWorkItem : public WorkItem {
// 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,
- const std::vector<base::FilePath>& key_paths);
+ const base::FilePath& temp_path);
+
+ // WorkItem:
+ bool DoImpl() override;
+ void RollbackImpl() override;
// Return temporary path for work based on |backup_path_| and |root_path_|.
base::FilePath GetBackupPath();
@@ -48,28 +42,16 @@ class DeleteTreeWorkItem : public WorkItem {
bool MoveRootToBackup();
// Root path to delete.
- base::FilePath root_path_;
+ const base::FilePath root_path_;
// Temporary directory that can be used.
- 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_;
+ const base::FilePath temp_path_;
// 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_;
+ bool moved_to_backup_ = false;
};
#endif // CHROME_INSTALLER_UTIL_DELETE_TREE_WORK_ITEM_H_

Powered by Google App Engine
This is Rietveld 408576698