summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/work_item_list.h
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 20:58:35 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 20:58:35 +0000
commitcd9a8e7e38c98a91d86c92084b3f7dd59c9bfa67 (patch)
tree9ee73b0107de33999df45c83c5e3a2d99d76516e /chrome/installer/util/work_item_list.h
parent9b444619c6a49b3798a85ee95eb93cd5eca65694 (diff)
downloadchromium_src-cd9a8e7e38c98a91d86c92084b3f7dd59c9bfa67.zip
chromium_src-cd9a8e7e38c98a91d86c92084b3f7dd59c9bfa67.tar.gz
chromium_src-cd9a8e7e38c98a91d86c92084b3f7dd59c9bfa67.tar.bz2
Add a new type of WorkItemList: NoRollbackWorkItemList.
This list does a best-effort execution of the items in the work list and always executes all items even if one of the items fails. Because of this, the list does also not support Rollback. The usage for this list is intended for uninstallation actions such as when unregistering a COM dll fails and we cannot "rollback" from it since we don't know what went wrong, what is the current state, etc and rolling back would really mean to re-register the DLL. Same applies for registry keys and files that might have been removed by the user. I also added a basic implementation of the Dump() method to all WorkItem derived classes for better diagnostics in the future. BUG=61609 TEST=The class is only used in a pending change list, so there should be no change in current behavior. Review URL: http://codereview.chromium.org/5260002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67309 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/work_item_list.h')
-rw-r--r--chrome/installer/util/work_item_list.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/chrome/installer/util/work_item_list.h b/chrome/installer/util/work_item_list.h
index e8b4238..cd16f52 100644
--- a/chrome/installer/util/work_item_list.h
+++ b/chrome/installer/util/work_item_list.h
@@ -91,7 +91,7 @@ class WorkItemList : public WorkItem {
bool do_register,
bool user_level_registration);
- private:
+ protected:
friend class WorkItem;
typedef std::list<WorkItem*> WorkItems;
@@ -118,4 +118,21 @@ class WorkItemList : public WorkItem {
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:
+ virtual ~NoRollbackWorkItemList();
+
+ // 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.
+ virtual bool Do();
+
+ // Just does a NOTREACHED.
+ virtual void Rollback();
+};
+
#endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_