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

Unified Diff: chrome/installer/util/work_item_list.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: self review Created 4 years, 8 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/work_item_list.h
diff --git a/chrome/installer/util/work_item_list.h b/chrome/installer/util/work_item_list.h
index 983ad0c53fa1733447ed13aa5d107e291cd0ec99..07c749f4182d78f5d4c3206fdec1750a6fb0272f 100644
--- a/chrome/installer/util/work_item_list.h
+++ b/chrome/installer/util/work_item_list.h
@@ -28,13 +28,6 @@ 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.
// Once a WorkItem is added to the list. The list owns the WorkItem.
@@ -144,18 +137,16 @@ class WorkItemList : public WorkItem {
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();
- ListStatus status_;
+ // 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;
// The list of WorkItems, in the order of them being added.
WorkItems list_;
@@ -173,13 +164,16 @@ class NoRollbackWorkItemList : public WorkItemList {
public:
~NoRollbackWorkItemList() override;
+ private:
+ // WorkItemList:
+
// 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;
+ bool DoImpl() override;
// No-op.
- void Rollback() override;
+ void RollbackImpl() override;
};
#endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_

Powered by Google App Engine
This is Rietveld 408576698