Index: chrome/installer/util/work_item_list.h |
diff --git a/chrome/installer/util/work_item_list.h b/chrome/installer/util/work_item_list.h |
index 8141e7fe2269ba1e05d33992fb95664a707691bc..983ad0c53fa1733447ed13aa5d107e291cd0ec99 100644 |
--- a/chrome/installer/util/work_item_list.h |
+++ b/chrome/installer/util/work_item_list.h |
@@ -24,12 +24,16 @@ |
// provides functionalities to carry out or roll back the sequence of actions |
// defined by the list of WorkItems it contains. |
// The WorkItems are executed in the same order as they are added to the list. |
-// The "best-effort" flag of the WorkItemList is propagated to the WorkItems |
-// when it's true. Likewise, the "rollback enabled" flag of the WorkItemList is |
-// propagated to the WorkItems when it's false. |
class WorkItemList : public WorkItem { |
public: |
~WorkItemList() override; |
+ |
+ // Execute the WorkItems in the same order as they are added to the list. |
+ // It aborts as soon as one WorkItem fails. |
+ bool Do() override; |
+ |
+ // Rollback the WorkItems in the reverse order as they are executed. |
+ void Rollback() override; |
// Add a WorkItem to the list. |
// A WorkItem can only be added to the list before the list's DO() is called. |
@@ -72,8 +76,15 @@ |
REGSAM wow64_access, |
const std::wstring& value_name); |
- // Add a DeleteTreeWorkItem that recursively deletes a file system hierarchy |
- // at the given root path. |
+ // Add a DeleteTreeWorkItem that recursively deletes a file system |
+ // hierarchy at the given root path. A key file can be optionally specified |
+ // by key_path. |
+ virtual WorkItem* AddDeleteTreeWorkItem( |
+ const base::FilePath& root_path, |
+ const base::FilePath& temp_path, |
+ const std::vector<base::FilePath>& key_paths); |
+ |
+ // Same as above but without support for key files. |
virtual WorkItem* AddDeleteTreeWorkItem(const base::FilePath& root_path, |
const base::FilePath& temp_path); |
@@ -133,16 +144,18 @@ |
typedef std::list<WorkItem*> WorkItems; |
typedef WorkItems::iterator WorkItemIterator; |
+ enum ListStatus { |
+ // List has not been executed. Ok to add new WorkItem. |
+ ADD_ITEM, |
+ // List has been executed. Can not add new WorkItem. |
+ LIST_EXECUTED, |
+ // List has been executed and rolled back. No further action is acceptable. |
+ LIST_ROLLED_BACK |
+ }; |
+ |
WorkItemList(); |
- // WorkItem: |
- |
- // Execute the WorkItems in the same order as they are added to the list. It |
- // aborts as soon as one WorkItem fails, unless the best-effort flag is true. |
- bool DoImpl() override; |
- |
- // Rollback the WorkItems in the reverse order as they are executed. |
- void RollbackImpl() override; |
+ ListStatus status_; |
// The list of WorkItems, in the order of them being added. |
WorkItems list_; |
@@ -152,4 +165,21 @@ |
WorkItems executed_list_; |
}; |
+// A specialization of WorkItemList that executes items in the list on a |
+// best-effort basis. Failure of individual items to execute does not prevent |
+// subsequent items from being executed. |
+// Also, as the class name suggests, Rollback is not possible. |
+class NoRollbackWorkItemList : public WorkItemList { |
+ public: |
+ ~NoRollbackWorkItemList() override; |
+ |
+ // Execute the WorkItems in the same order as they are added to the list. |
+ // If a WorkItem fails, the function will return failure but all other |
+ // WorkItems will still be executed. |
+ bool Do() override; |
+ |
+ // No-op. |
+ void Rollback() override; |
+}; |
+ |
#endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ |