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

Side by Side Diff: chrome/installer/util/conditional_work_item_list.h

Issue 1976443005: Revert of Add best-effort/allow rollback flags on WorkItem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simple_list_tests
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_INSTALLER_UTIL_CONDITIONAL_WORK_ITEM_LIST_H_ 5 #ifndef CHROME_INSTALLER_UTIL_CONDITIONAL_WORK_ITEM_LIST_H_
6 #define CHROME_INSTALLER_UTIL_CONDITIONAL_WORK_ITEM_LIST_H_ 6 #define CHROME_INSTALLER_UTIL_CONDITIONAL_WORK_ITEM_LIST_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "chrome/installer/util/work_item_list.h" 11 #include "chrome/installer/util/work_item_list.h"
12 12
13 // A WorkItemList subclass that permits conditionally executing a set of 13 // A WorkItemList subclass that permits conditionally executing a set of
14 // WorkItems. 14 // WorkItems.
15 class ConditionalWorkItemList : public WorkItemList { 15 class ConditionalWorkItemList : public WorkItemList {
16 public: 16 public:
17 explicit ConditionalWorkItemList(Condition* condition); 17 explicit ConditionalWorkItemList(Condition* condition);
18 ~ConditionalWorkItemList() override; 18 ~ConditionalWorkItemList() override;
19 19
20 private:
21 // WorkItemList:
22
23 // If condition_->ShouldRun() returns true, then execute the items in this 20 // If condition_->ShouldRun() returns true, then execute the items in this
24 // list and return true iff they all succeed. If condition_->ShouldRun() 21 // list and return true iff they all succeed. If condition_->ShouldRun()
25 // returns false, does nothing and returns true. 22 // returns false, does nothing and returns true.
26 bool DoImpl() override; 23 bool Do() override;
27 24
28 // Does a rollback of the items (if any) that were run in Do. 25 // Does a rollback of the items (if any) that were run in Do.
29 void RollbackImpl() override; 26 void Rollback() override;
30 27
28 protected:
31 // Pointer to a Condition that is used to determine whether to run this 29 // Pointer to a Condition that is used to determine whether to run this
32 // WorkItemList. 30 // WorkItemList.
33 std::unique_ptr<Condition> condition_; 31 std::unique_ptr<Condition> condition_;
34 }; 32 };
35 33
36 34
37 // Pre-defined conditions: 35 // Pre-defined conditions:
38 //------------------------------------------------------------------------------ 36 //------------------------------------------------------------------------------
39 class ConditionRunIfFileExists : public WorkItem::Condition { 37 class ConditionRunIfFileExists : public WorkItem::Condition {
40 public: 38 public:
(...skipping 12 matching lines...) Expand all
53 explicit Not(WorkItem::Condition* original_condition); 51 explicit Not(WorkItem::Condition* original_condition);
54 ~Not() override; 52 ~Not() override;
55 53
56 bool ShouldRun() const override; 54 bool ShouldRun() const override;
57 55
58 private: 56 private:
59 std::unique_ptr<WorkItem::Condition> original_condition_; 57 std::unique_ptr<WorkItem::Condition> original_condition_;
60 }; 58 };
61 59
62 #endif // CHROME_INSTALLER_UTIL_CONDITIONAL_WORK_ITEM_LIST_H_ 60 #endif // CHROME_INSTALLER_UTIL_CONDITIONAL_WORK_ITEM_LIST_H_
OLDNEW
« no previous file with comments | « chrome/installer/util/callback_work_item.cc ('k') | chrome/installer/util/conditional_work_item_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698