Index: chrome/installer/util/work_item.cc |
diff --git a/chrome/installer/util/work_item.cc b/chrome/installer/util/work_item.cc |
index e38413d94ef34df56a274cf864eab751493fbb96..988a4711f516983b8b6fb849d10c7a8f007d01f3 100644 |
--- a/chrome/installer/util/work_item.cc |
+++ b/chrome/installer/util/work_item.cc |
@@ -6,6 +6,7 @@ |
#include <windows.h> |
+#include "base/logging.h" |
#include "chrome/installer/util/callback_work_item.h" |
#include "chrome/installer/util/conditional_work_item_list.h" |
#include "chrome/installer/util/copy_tree_work_item.h" |
@@ -19,11 +20,8 @@ |
#include "chrome/installer/util/set_reg_value_work_item.h" |
#include "chrome/installer/util/work_item_list.h" |
-WorkItem::WorkItem() : ignore_failure_(false) { |
-} |
- |
-WorkItem::~WorkItem() { |
-} |
+WorkItem::WorkItem() = default; |
+WorkItem::~WorkItem() = default; |
CallbackWorkItem* WorkItem::CreateCallbackWorkItem( |
base::Callback<bool(const CallbackWorkItem&)> callback) { |
@@ -70,9 +68,8 @@ DeleteRegValueWorkItem* WorkItem::CreateDeleteRegValueWorkItem( |
DeleteTreeWorkItem* WorkItem::CreateDeleteTreeWorkItem( |
const base::FilePath& root_path, |
- const base::FilePath& temp_path, |
- const std::vector<base::FilePath>& key_paths) { |
- return new DeleteTreeWorkItem(root_path, temp_path, key_paths); |
+ const base::FilePath& temp_path) { |
+ return new DeleteTreeWorkItem(root_path, temp_path); |
} |
MoveTreeWorkItem* WorkItem::CreateMoveTreeWorkItem( |
@@ -154,11 +151,30 @@ WorkItemList* WorkItem::CreateWorkItemList() { |
return new WorkItemList(); |
} |
-// static |
-WorkItemList* WorkItem::CreateNoRollbackWorkItemList() { |
- return new NoRollbackWorkItemList(); |
-} |
- |
WorkItemList* WorkItem::CreateConditionalWorkItemList(Condition* condition) { |
return new ConditionalWorkItemList(condition); |
} |
+ |
+bool WorkItem::Do() { |
+ DCHECK_EQ(BEFORE_DO, state_); |
+ const bool success = DoImpl(); |
+ state_ = AFTER_DO; |
+ return best_effort() ? true : success; |
+} |
+ |
+void WorkItem::Rollback() { |
+ DCHECK_EQ(AFTER_DO, state_); |
+ if (rollback_enabled()) |
+ RollbackImpl(); |
+ state_ = AFTER_ROLLBACK; |
+} |
+ |
+void WorkItem::set_best_effort(bool best_effort) { |
+ DCHECK_EQ(BEFORE_DO, state()); |
+ best_effort_ = best_effort; |
+} |
+ |
+void WorkItem::set_rollback_enabled(bool rollback_enabled) { |
+ DCHECK_EQ(BEFORE_DO, state()); |
+ rollback_enabled_ = rollback_enabled; |
+} |